ui-utilcpp  1.8.5
Public Member Functions | Static Public Member Functions
UI::Util::URLConverter Class Reference

Converter for URL-Encoding. More...

#include <Recoder.hpp>

Inheritance diagram for UI::Util::URLConverter:
Inheritance graph
Collaboration diagram for UI::Util::URLConverter:
Collaboration graph

Public Member Functions

 URLConverter (bool const encode=true)
 Constructor; inEnc and outEnc are fixed by the encode flag.
 
Conversion const * make (char const *const buf, size_t const bufSize) const
 Convert from byte buffer.
 
- Public Member Functions inherited from UI::Util::Converter
 Converter (std::string const &inEnc, std::string const &outEnc, bool const &sloppy=false)
 Converter base constructor.
 
Conversion const * make (char const *const cStr) const
 Convert from C-String.
 
Conversion const * make (std::string const &str) const
 Convert from std::string.
 
std::string getID () const
 Get id (informational).
 

Static Public Member Functions

static std::string encode (std::string const &url)
 Encode an URL string. More...
 
static std::string decode (std::string const &url)
 Decode an URL encoded string. More...
 

Additional Inherited Members

- Public Types inherited from UI::Util::Converter
enum  ErrorCode { EncUnknown_, ConversionErr_, UnknownErr_ }
 Error codes for exceptions.
 
typedef CodeException< ErrorCodeException
 Exceptions for this class.
 
- Protected Attributes inherited from UI::Util::Converter
std::string const inEnc_
 
std::string const outEnc_
 
bool const sloppy_
 

Detailed Description

Converter for URL-Encoding.

Member Function Documentation

std::string UI::Util::URLConverter::decode ( std::string const &  url)
static

Decode an URL encoded string.

The following rules are applied in the conversion: The alphanumeric characters "a" through "z", "A" through "Z" and "0" through "9" remain the same. The special characters ".", "-", "*", and "_" remain the same. The plus sign "+" is converted into a space character " ". A sequence of the form "%xy" will be treated as representing a byte where xy is the two-digit hexadecimal representation of the 8 bits.

Parameters
urlthe encoded URL string
Returns
the decoded URL

Referenced by make().

std::string UI::Util::URLConverter::encode ( std::string const &  url)
static

Encode an URL string.

The following rules are applied in the conversion: The alphanumeric characters "a" through "z", "A" through "Z" and "0" through "9" remain the same. The special characters ".", "-", "*", and "_" remain the same. The space character " " is converted into a plus sign "+". The other special characters will be converted in a sequence of the form "%xy" which epresenting a byte where xy is the two-digit hexadecimal representation of the 8 bits.

Parameters
urlthe URL to encode
Returns
the encoded URL

Referenced by make().


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