Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / ACE / apps / JAWS2 / HTTPU / http_status.h
blobbba7be512a402de571df5d12959a56117e325124
1 #ifndef HTTPU_HTTP_STATUS_HPP
2 #define HTTPU_HTTP_STATUS_HPP
4 #include "ace/Singleton.h"
6 #if !defined (ACE_LACKS_PRAGMA_ONCE)
7 # pragma once
8 #endif /* ACE_LACKS_PRAGMA_ONCE */
10 #include "HTTPU/http_export.h"
11 #include "ace/Synch_Traits.h"
13 class HTTP_SCode_Base;
15 class HTTPU_Export HTTP_SCode_Node
16 // Constructor should be passed a string literal.
18 friend class HTTP_SCode_Base;
20 public:
21 operator int () const;
22 operator const char * () const;
24 private:
25 HTTP_SCode_Node (int code, const char *code_str);
27 private:
28 int code_;
29 const char *code_str_;
32 class HTTPU_Export HTTP_SCode_Base
34 public:
35 static HTTP_SCode_Node STATUS_OK;
36 static HTTP_SCode_Node STATUS_CREATED;
37 static HTTP_SCode_Node STATUS_ACCEPTED;
38 static HTTP_SCode_Node STATUS_NO_CONTENT;
39 static HTTP_SCode_Node STATUS_MULTIPLE_CHOICES;
40 static HTTP_SCode_Node STATUS_MOVED_PERMANENTLY;
41 static HTTP_SCode_Node STATUS_MOVED_TEMPORARILY;
42 static HTTP_SCode_Node STATUS_NOT_MODIFIED;
43 static HTTP_SCode_Node STATUS_INSUFFICIENT_DATA;
44 static HTTP_SCode_Node STATUS_BAD_REQUEST;
45 static HTTP_SCode_Node STATUS_UNAUTHORIZED;
46 static HTTP_SCode_Node STATUS_FORBIDDEN;
47 static HTTP_SCode_Node STATUS_NOT_FOUND;
48 static HTTP_SCode_Node STATUS_INTERNAL_SERVER_ERROR;
49 static HTTP_SCode_Node STATUS_NOT_IMPLEMENTED;
50 static HTTP_SCode_Node STATUS_BAD_GATEWAY;
51 static HTTP_SCode_Node STATUS_SERVICE_UNAVAILABLE;
52 static HTTP_SCode_Node STATUS_QUIT;
54 enum
56 MIN_STATUS_CODE = 200,
57 MAX_STATUS_CODE = 599
60 private:
61 static HTTP_SCode_Node DUMMY;
64 class HTTPU_Export HTTP_SCode : public HTTP_SCode_Base
66 // = TITLE
67 // Go from numeric status codes to descriptive strings.
69 friend class HTTP_SCode_Node;
70 friend class ACE_Singleton<HTTP_SCode, ACE_SYNCH_MUTEX>;
72 protected:
73 HTTP_SCode ();
74 ~HTTP_SCode ();
76 public:
77 const char * operator[] (int) const;
78 // Return the reason string corresponding to a status code number.
80 static HTTP_SCode *instance ();
81 // Return reference to the singleton.
83 enum
85 SC_TABLE_SIZE = MAX_STATUS_CODE - MIN_STATUS_CODE + 1
88 void dump ();
90 private:
91 static const char *table_[SC_TABLE_SIZE];
95 typedef ACE_Singleton<HTTP_SCode, ACE_SYNCH_MUTEX>
96 HTTP_SCode_Singleton;
98 #if defined (ACE_HAS_INLINED_OSCALLS)
99 # if defined (ACE_INLINE)
100 # undef ACE_INLINE
101 # endif /* ACE_INLINE */
102 # define ACE_INLINE inline
103 # include "HTTPU/http_status.inl"
104 # endif /* ACE_HAS_INLINED_OSCALLS */
106 #endif /* HTTPU_HTTP_STATUS_HPP */