1 #ifndef HTTPU_HTTP_STATUS_HPP
2 #define HTTPU_HTTP_STATUS_HPP
4 #include "ace/Singleton.h"
6 #if !defined (ACE_LACKS_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
;
21 operator int () const;
22 operator const char * () const;
25 HTTP_SCode_Node (int code
, const char *code_str
);
29 const char *code_str_
;
32 class HTTPU_Export HTTP_SCode_Base
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
;
56 MIN_STATUS_CODE
= 200,
61 static HTTP_SCode_Node DUMMY
;
64 class HTTPU_Export HTTP_SCode
: public HTTP_SCode_Base
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
>;
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.
85 SC_TABLE_SIZE
= MAX_STATUS_CODE
- MIN_STATUS_CODE
+ 1
91 static const char *table_
[SC_TABLE_SIZE
];
95 typedef ACE_Singleton
<HTTP_SCode
, ACE_SYNCH_MUTEX
>
98 #if defined (ACE_HAS_INLINED_OSCALLS)
99 # if defined (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 */