@@ -20,7 +20,7 @@ Initially, the data was taken from [for-GET/know-your-http-well](https://github.
2020> - [ Status Codes Enum] ( #status-codes-enum )
2121> - [ Category/Class Tests] ( #categoryclass-tests )
2222> - [ Reason Phrases] ( #reason-phrases )
23- > - [ QNetworkReply::NetworkError Mapping ] ( #qnetworkreplynetworkerror-mapping )
23+ > - [ Conversion Functions ] ( #conversion-functions )
2424> - [ License] ( #license )
2525
2626
@@ -65,7 +65,7 @@ void printReplyStatus(MyHttpReplyClass reply)
6565
6666For the complete list of defined enums, see one of the header files.
6767
68- #### C Variant ####
68+ ##### C Variant # ####
6969```c
7070enum HttpStatus_Code
7171{
@@ -75,7 +75,7 @@ enum HttpStatus_Code
7575};
7676```
7777
78- #### C++11 Variant ####
78+ ##### C++11 Variant # ####
7979``` c++
8080namespace HttpStatus {
8181enum class Code
@@ -87,7 +87,7 @@ enum class Code
8787}
8888```
8989
90- #### Other Variants ####
90+ ##### Other Variants # ####
9191``` c++
9292namespace HttpStatus {
9393enum Code
@@ -102,7 +102,7 @@ enum Code
102102
103103### Category/Class Tests ###
104104
105- #### C Variant ####
105+ ##### C Variant # ####
106106``` c
107107char HttpStatus_isInformational (int code);
108108char HttpStatus_isSuccessful(int code);
@@ -120,7 +120,7 @@ Returns `1` if the given _code_ is either a client error, a server error or any
120120Non-standard error codes are status codes with a value of 600 or higher.
121121Returns ` 0 ` otherwise.
122122
123- #### Other Variants ####
123+ ##### Other Variants # ####
124124> ** Note:** The C++11 variant also provides overloads for ` HttpStatus::Code ` . So there is no need to cast.
125125
126126``` c++
@@ -145,31 +145,36 @@ Returns `false` otherwise.
145145
146146### Reason Phrases ###
147147
148- #### C Variant ####
148+ ##### C Variant # ####
149149``` c
150150const char * HttpStatus_reasonPhrase (int code);
151151```
152152Returns the HTTP reason phrase string corresponding to the given _code_.
153153
154- #### C++/C++11 Variants ####
154+ ##### C++/C++11 Variants # ####
155155> **Note:** The C++11 variant also provides an overload for `HttpStatus::Code`. So there is no need to cast.
156156```c++
157157std::string HttpStatus::reasonPhrase(int code);
158158```
159159Returns the HTTP reason phrase string corresponding to the given _ code_ .
160160
161- #### Qt Variant ####
161+ ##### Qt Variant # ####
162162``` c++
163163QString HttpStatus::reasonPhrase (int code);
164164```
165165Returns the HTTP reason phrase string corresponding to the given _code_.
166166
167167
168- ### QNetworkReply::NetworkError Mapping ###
168+ ### Conversion Functions ###
169169
170- > **Note:** Available only in the Qt variant and if the Qt::Network module is available.
170+ ##### C++11 Variant #####
171+ ```c++
172+ int HttpStatus::toInt(HttpStatus::Code code);
173+ ```
174+ Returns the integer value corresponding to a given a _ code_ .
175+ This is a convenience function as replacement for a ` static_cast<int>() ` .
171176
172- #### Qt Variant ####
177+ ##### Qt Variant # ####
173178``` c++
174179int HttpStatus::networkErrorToStatusCode (QNetworkReply::NetworkError error);
175180```
@@ -180,7 +185,7 @@ Otherwise, `-1` is returned.
180185QNetworkReply::NetworkError HttpStatus::statusCodeToNetworkError(int code);
181186```
182187Returns the ` QNetworkReply::NetworkError ` corresponding to the given _ code_ if there is one.
183- For codes where there is no exact match, the best matchnig "catch all" code (`QNetworkReply::NoError`,
188+ For codes where there is no exact match, the best matching "catch all" code (` QNetworkReply::NoError ` ,
184189` QNetworkReply::UnknownContentError ` , ` QNetworkReply::UnknownServerError ` or ` QNetworkReply::ProtocolFailure ` )
185190is returned.
186191
0 commit comments