Samchon Framework for CPP  1.0.0
samchon::library::URLVariables Class Reference

URLVariables class is for representing variables of HTTP. More...

#include <URLVariables.hpp>

Collaboration diagram for samchon::library::URLVariables:

Public Member Functions

 URLVariables ()
 Default Constructor. More...
 
 URLVariables (const WeakString &flashVars)
 Constructor by a string representing encoded properties. More...
 
auto toString () const -> std::string
 Get the string representing URLVariables. More...
 
- Public Member Functions inherited from samchon::HashMap< std::string, std::string >
auto has (const std::string &key) const -> bool
 Whether have the item or not. More...
 
auto get (const std::string &key) -> std::string &
 Get element. More...
 
void set (const std::string &key, const std::string &val)
 Set element. More...
 
auto pop (const std::string &key) -> std::string
 Pop item. More...
 

Static Public Member Functions

static auto encode (const WeakString &) -> std::string
 Encode a string into a valid URI. More...
 
static auto decode (const WeakString &) -> std::string
 Decode a URI string. More...
 

Detailed Description

URLVariables class is for representing variables of HTTP.

URLVariables class allows you to transfer variables between an application and server. When transfering, URLVariables will be converted to a URI string.

  • URI: Uniform Resource Identifier

Use URLVariabels objects with methods of HTTPLoader class.

library_http.png

Example code

See also
samchon::library
Author
Jeongho Nam http://samchon.org

Definition at line 30 of file URLVariables.hpp.

Constructor & Destructor Documentation

URLVariables::URLVariables ( )

Default Constructor.

Definition at line 11 of file URLVariables.cpp.

URLVariables::URLVariables ( const WeakString flashVars)

Constructor by a string representing encoded properties.

Converts the variable string to properties of the specified URLVariables object.

Parameters
Auri-encoded string containing pair of properties

Definition at line 15 of file URLVariables.cpp.

References decode(), samchon::WeakString::find(), samchon::WeakString::split(), and samchon::WeakString::substr().

Here is the call graph for this function:

Member Function Documentation

auto URLVariables::encode ( const WeakString wstr) -> std::string
static

Encode a string into a valid URI.

Encodes a string to follow URI standard format.

Parameters
Astring to encode to URI
Returns
A string converted to URI

Definition at line 37 of file URLVariables.cpp.

Referenced by toString().

Here is the caller graph for this function:

auto URLVariables::decode ( const WeakString wstr) -> std::string
static

Decode a URI string.

Decodes a URI string to its original

Parameters
Astring encoded
Returns
A string decoded from URI

Definition at line 66 of file URLVariables.cpp.

Referenced by URLVariables().

Here is the caller graph for this function:

auto URLVariables::toString ( ) const -> std::string

Get the string representing URLVariables.

Returns a string object representing URLVariables following the URI

  • URLVariables({{"id", "jhnam88"}, {"name", "Jeongho Nam <http://samchon.org>"}}).toString() => "id=jhnam88&name=Jeongho+Nam"
Returns
A string representing URLVariables following the URI

Definition at line 118 of file URLVariables.cpp.

References encode().

Here is the call graph for this function:


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