DCL 4.0
Loading...
Searching...
No Matches
HttpQueryStringDecoder Class Reference

#include <HttpCollection.h>

Static Public Member Functions

static void decode (const ByteString &_queryString, ListedStringToStringArrayMap &_results)
static void decode (const char *_begin, const char *_end, ListedStringToStringArrayMap &_results)
static bool isValidType (const char *_contentType)

Detailed Description

Definition at line 43 of file HttpCollection.h.

Member Function Documentation

◆ decode() [1/2]

void HttpQueryStringDecoder::decode ( const ByteString & _queryString,
ListedStringToStringArrayMap & _results )
static

Definition at line 78 of file HttpCollection.cpp.

82{
84 _queryString,
85 _queryString.data() + _queryString.length(),
86 _results
87 );
88}
static void decode(const ByteString &_queryString, ListedStringToStringArrayMap &_results)

◆ decode() [2/2]

void HttpQueryStringDecoder::decode ( const char * _begin,
const char * _end,
ListedStringToStringArrayMap & _results )
static

Definition at line 90 of file HttpCollection.cpp.

95{
96 ByteStringArray elements;
97 ByteString::split(_begin, _end, '&', elements);
98
99 for(ByteStringArray::Iterator it = elements.begin();
100 it != elements.end(); it++)
101 {
102 ByteStringArray pair;
103 ByteString name;
104 ByteString value;
105
106 (*it).split(L'=', pair);
107 ByteStringArray::Iterator itPair = pair.begin();
108
109 if (itPair != pair.end()) {
110 //name = URLDecoder::decode(*itPair); // .trim();
111 name = *itPair;
112 if (!name.isEmpty()) {
113 itPair++;
114 value = itPair != pair.end() ?
115 URLDecoder::decode(*itPair) : "";
116
117 (_results[UTF8Decoder::decode(name)])
118 .add(UTF8Decoder::decode(value));
119 }
120 }
121 }
122}
static ByteString decode(const char *_begin, const char *_end)
Definition URI.cpp:46

◆ isValidType()

bool HttpQueryStringDecoder::isValidType ( const char * _contentType)
static

Definition at line 124 of file HttpCollection.cpp.

127{
128 __DCL_ASSERT(_contentType != NULL
129 && *_contentType != '\0');
130
131 while(isspace((wint_t)*_contentType))
132 _contentType++;
133
134 return ByteString::compareNoCase(
135 _contentType,
136 "application/x-www-form-urlencoded",
137 33
138 ) == 0;
139}
#define NULL
Definition Config.h:340
#define __DCL_ASSERT(expr)
Definition Object.h:371

The documentation for this class was generated from the following files: