Main Page | Namespace List | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals

Utility class for converting strings to and from URL encoding. More...


Data Structures

class  monsterworks::cgi::NWWWCodec::XInvalidString
 thrown if an improperly www-url-encoded string is attempt to be decoded More...

Functions

std::string ToWWW (const std::string &inPlainText)
 converts a string to WWW URL encoded string
std::string FromWWW (const std::string &inCypherText)
 converts a string from WWW URL encoded string
std::string EscapeHTML (const std::string &inPlainText)
 escapes all HTML in a string so that it can be displayed as text
monsterworks::cgi::FormPairs StringToPairs (const std::string &inEncodedString)
 converts the string into a series of key/value pairs appropriate for form processing
monsterworks::cgi::QueryWords StringToWords (const std::string &inEncodedString)
 converts the string into a series of keywords appropriate for form processiong


Detailed Description

Utility class for converting strings to and from URL encoding.

Function Documentation

std::string monsterworks::cgi::NWWWCodec::EscapeHTML const std::string &  inPlainText  ) 
 

escapes all HTML in a string so that it can be displayed as text

encodes a string so that it will display appropriately as HTML

characterencoded as
<&lt
>&gt
&&amp
"&quot
any other characteritself

Returns:
the result of the encoding
Parameters:
inPlainText  the text to be encoded
Definition at line 173 of file NWWWCodec.cp.

std::string monsterworks::cgi::NWWWCodec::FromWWW const std::string &  inCypherText  ) 
 

converts a string from WWW URL encoded string

decodes an www-url-encoded string

encoded characterdecoded to
+space
%[hex][hex]ASCII character [hex][hex]
sequences of 0x0D & 0x0Aa single newline (\n)
other control charactersstripped
everything elseitself

Returns:
the unecoded string
Exceptions:
XInvalidString if string has improper encoding
Parameters:
inCypherText  the string to decode
Definition at line 94 of file NWWWCodec.cp.

Referenced by StringToPairs(), and StringToWords().

monsterworks::cgi::FormPairs monsterworks::cgi::NWWWCodec::StringToPairs const std::string &  inEncodedString  ) 
 

converts the string into a series of key/value pairs appropriate for form processing

decodes a string as a sequence of key/value pairs

Returns:
the pairs in a FormPairs structure
Exceptions:
XInvalidString if string has incorrect encoding, see FromWWW()
Parameters:
inEncodedString  the string to be decoded
Definition at line 247 of file NWWWCodec.cp.

References monsterworks::cgi::FormPairs, and FromWWW().

Referenced by NFormInitialize().

monsterworks::cgi::QueryWords monsterworks::cgi::NWWWCodec::StringToWords const std::string &  inEncodedString  ) 
 

converts the string into a series of keywords appropriate for form processiong

decodes a www-url-encoded string as a sequence of words appropriate for use as query string from a form

Returns:
the words in a QueryWords structure
Exceptions:
XInvalidString if string has invalid encoding, see FromWWW()
Parameters:
inEncodedString  the string to be decoded
Definition at line 213 of file NWWWCodec.cp.

References FromWWW(), and monsterworks::cgi::QueryWords.

Referenced by NFormInitialize().

std::string monsterworks::cgi::NWWWCodec::ToWWW const std::string &  inPlainText  ) 
 

converts a string to WWW URL encoded string

encodes as string in to ww-url-encoded form:
plaintext characterencoded as
space+
alphanumericitself
nonalphanumeric%[hex][hex]

Returns:
the result of the encoding
Parameters:
inPlainText  the string to be encoded
Definition at line 51 of file NWWWCodec.cp.


monsterworks Code by Monsterworks. Made available under the GNU Public License.
Documentation by doxygen.