DCL 3.7.4
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 79 of file HttpCollection.cpp.

83{
85 _queryString,
86 _queryString.data() + _queryString.length(),
87 _results
88 );
89}
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 91 of file HttpCollection.cpp.

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

◆ isValidType()

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

Definition at line 125 of file HttpCollection.cpp.

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

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