libcamgm
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
ca_mgm::url::ViewOptions Struct Reference

#include <UrlBase.hpp>

Public Types

enum  EViewOption {
  WITH_SCHEME = 1L << 0, WITH_USERNAME = 1L << 1, WITH_PASSWORD = 1L << 2, WITH_HOST = 1L << 3,
  WITH_PORT = 1L << 4, WITH_PATH_NAME = 1L << 5, WITH_PATH_PARAMS = 1L << 6, WITH_QUERY_STR = 1L << 7,
  WITH_FRAGMENT = 1L << 8, EMPTY_AUTHORITY = 1L << 10, EMPTY_PATH_NAME = 1L << 11, EMPTY_PATH_PARAMS = 1L << 12,
  EMPTY_QUERY_STR = 1L << 13, EMPTY_FRAGMENT = 1L << 14
}
 

Public Member Functions

 ViewOptions ()
 
ViewOptionsoperator= (const ViewOptions &v)
 
ViewOptionsoperator+= (const ViewOptions &v)
 
ViewOptionsoperator+= (EViewOption o)
 
ViewOptionsoperator-= (const ViewOptions &v)
 
ViewOptionsoperator-= (EViewOption o)
 
bool has (EViewOption o) const
 
bool has (const ViewOptions &v) const
 

Private Member Functions

 ViewOptions (int o)
 

Private Attributes

int opt
 

Friends

ViewOptions operator+ (const ViewOptions &lv, const ViewOptions &rv)
 
ViewOptions operator+ (const ViewOptions &v, EViewOption o)
 
ViewOptions operator+ (const EViewOption lo, EViewOption ro)
 
ViewOptions operator- (const ViewOptions &vl, const ViewOptions &vr)
 
ViewOptions operator- (const ViewOptions &v, EViewOption o)
 

Detailed Description

Url::asString() view options.

A instance of this class represents a combination of view options.

It provides ViewOptions::operator+() and ViewOptions::operator-() to modify a view option combination and a ViewOptions::has() method, to check if a specified option is enabled or not.

Member Enumeration Documentation

Enumeration of view option constants.

Enumerator
WITH_SCHEME 

Option to include scheme name in the URL string.

Disabling this option causes, that the URL string contains the path, query and fragment components only, for example just "/foo/bar.txt".

This option is enabled by default.

WITH_USERNAME 

Option to include username in the URL string.

This option depends on a enabled WITH_SCHEME and WITH_HOST options and is enabled by default.

WITH_PASSWORD 

Option to include password in the URL string.

This option depends on a enabled WITH_SCHEME, WITH_HOST and WITH_USERNAME options and is disabled by default, causing to hide the password in the URL authority.

WITH_HOST 

Option to include hostname in the URL string.

This option depends on a enabled WITH_SCHEME option and is enabled by default.

WITH_PORT 

Option to include port number in the URL string.

This option depends on a enabled WITH_SCHEME and WITH_HOST options and is enabled by default.

WITH_PATH_NAME 

Option to include path name in the URL string.

This option is enabled by default.

WITH_PATH_PARAMS 

Option to include path parameters in the URL string.

This option depends on a enabled WITH_PATH_NAME option and is disabled by default, causing to hide the path parameters.

WITH_QUERY_STR 

Option to include query string in the URL string.

This option is enabled by default.

WITH_FRAGMENT 

Option to include fragment string in the URL string.

This option is enabled by default.

EMPTY_AUTHORITY 

Explicitely include the URL authority separator "//".

It causes, that the URL string includes an empty URL authority, for example: "file:///foo.txt" instead of just "file:/foo.txt".

This option depends on a enabled WITH_SCHEME view option and is enabled by default.

EMPTY_PATH_NAME 

Explicitely include the "/" path character.

It causes, that a "/" is added to the Url if the path name is empty, for example:

"http://localhost/" instead of just "http://localhost".

This option depends on a enabled WITH_PATH_NAME view option and is enabled by default.

EMPTY_PATH_PARAMS 

Explicitely include the path parameters separator ";".

It causes, that the URL allways contains the ";" path parameters separator.

This option depends on a enabled EMPTY_PATH_NAME view option and is disabled by default.

EMPTY_QUERY_STR 

Explicitely include the query string separator "?".

It causes, that if the query string is requested using the WITH_QUERY_STR option, the URL allways contains the "?" query string separator, even if the query string is empty. This option depends on a enabled WITH_QUERY_STR view option and is disabled by default.

EMPTY_FRAGMENT 

Explicitely include the fragment string separator "#".

It causes, that if the fragment string is requested using the WITH_FRAGMENT option, the URL allways contains the "#" fragment string separator, even if the fragment string is empty. This option depends on a enabled WITH_FRAGMENT view option and is disabled by default.

Constructor & Destructor Documentation

ca_mgm::url::ViewOptions::ViewOptions ( )

Create instance with default combination of view options.

By default, following view options are enabled: WITH_SCHEME, WITH_USERNAME, WITH_HOST, WITH_PORT, WITH_PATH_NAME, WITH_QUERY_STR, WITH_FRAGMENT, EMPTY_AUTHORITY, EMPTY_PATH_NAME.

ca_mgm::url::ViewOptions::ViewOptions ( int  o)
private

Member Function Documentation

bool ca_mgm::url::ViewOptions::has ( EViewOption  o) const
inline

Check if specified option o is set in the current object.

Parameters
oA view option constant.
Returns
True, if specified option o is set/enabled in the current object.
bool ca_mgm::url::ViewOptions::has ( const ViewOptions v) const
inline

Check if specified options o are set in the current object.

Parameters
oA view options set.
Returns
True, if specified options o are set/enabled in the current object.

References opt.

ViewOptions& ca_mgm::url::ViewOptions::operator+= ( const ViewOptions v)
inline

References opt.

ViewOptions& ca_mgm::url::ViewOptions::operator+= ( EViewOption  o)
inline
ViewOptions& ca_mgm::url::ViewOptions::operator-= ( const ViewOptions v)
inline

References opt.

ViewOptions& ca_mgm::url::ViewOptions::operator-= ( EViewOption  o)
inline
ViewOptions& ca_mgm::url::ViewOptions::operator= ( const ViewOptions v)
inline

Assign specified option combination o to the current object.

Parameters
oThe option or option combination to make a copy of.
Returns
A reference to this option combination.

References opt.

Friends And Related Function Documentation

ViewOptions operator+ ( const ViewOptions lv,
const ViewOptions rv 
)
friend

Adds l and r to a new option combination.

Returns
The new option combination.
ViewOptions operator+ ( const ViewOptions v,
EViewOption  o 
)
friend
ViewOptions operator+ ( const EViewOption  lo,
EViewOption  ro 
)
friend
ViewOptions operator- ( const ViewOptions vl,
const ViewOptions vr 
)
friend

Substract r from l to a new option combination.

Returns
The new option combination.
ViewOptions operator- ( const ViewOptions v,
EViewOption  o 
)
friend

Member Data Documentation

int ca_mgm::url::ViewOptions::opt
private

Referenced by has(), operator+=(), operator-=(), and operator=().


The documentation for this struct was generated from the following file: