Skip to content

Commit

Permalink
Move mime_types and charset_types to the header matching the defining…
Browse files Browse the repository at this point in the history
… cpp
  • Loading branch information
ras0219 authored and ras0219-msft committed Apr 8, 2016
1 parent 9869462 commit 9b5ecb1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 31 deletions.
29 changes: 0 additions & 29 deletions Release/include/cpprest/details/http_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,45 +34,16 @@ namespace web { namespace http
namespace details
{

/// <summary>
/// Constants for MIME types.
/// </summary>
class mime_types
{
public:
#define _MIME_TYPES
#define DAT(a,b) _ASYNCRTIMP const static utility::string_t a;
#include "cpprest/details/http_constants.dat"
#undef _MIME_TYPES
#undef DAT
};

/// <summary>
/// Constants for charset types.
/// </summary>
class charset_types
{
public:
#define _CHARSET_TYPES
#define DAT(a,b) _ASYNCRTIMP const static utility::string_t a;
#include "cpprest/details/http_constants.dat"
#undef _CHARSET_TYPES
#undef DAT
};

/// <summary>
/// Helper function to get the default HTTP reason phrase for a status code.
/// </summary>
utility::string_t get_default_reason_phrase(status_code code);

// simple helper functions to trim whitespace.
_ASYNCRTIMP void __cdecl ltrim_whitespace(utility::string_t &str);
_ASYNCRTIMP void __cdecl rtrim_whitespace(utility::string_t &str);
_ASYNCRTIMP void __cdecl trim_whitespace(utility::string_t &str);

bool validate_method(const utility::string_t& method);


namespace chunked_encoding
{
// Transfer-Encoding: chunked support
Expand Down
30 changes: 30 additions & 0 deletions Release/include/cpprest/http_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,36 @@ class status_codes
#undef DAT
};

namespace details {

/// <summary>
/// Constants for MIME types.
/// </summary>
class mime_types
{
public:
#define _MIME_TYPES
#define DAT(a,b) _ASYNCRTIMP const static utility::string_t a;
#include "cpprest/details/http_constants.dat"
#undef _MIME_TYPES
#undef DAT
};

/// <summary>
/// Constants for charset types.
/// </summary>
class charset_types
{
public:
#define _CHARSET_TYPES
#define DAT(a,b) _ASYNCRTIMP const static utility::string_t a;
#include "cpprest/details/http_constants.dat"
#undef _CHARSET_TYPES
#undef DAT
};

}

/// Message direction
namespace message_direction
{
Expand Down
4 changes: 2 additions & 2 deletions Release/src/http/common/http_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ utility::string_t get_default_reason_phrase(status_code code)
}


void ltrim_whitespace(utility::string_t &str)
static void ltrim_whitespace(utility::string_t &str)
{
size_t index;
for (index = 0; index < str.size() && isspace(str[index]); ++index);
str.erase(0, index);
}
void rtrim_whitespace(utility::string_t &str)
static void rtrim_whitespace(utility::string_t &str)
{
size_t index;
for (index = str.size(); index > 0 && isspace(str[index - 1]); --index);
Expand Down

0 comments on commit 9b5ecb1

Please sign in to comment.