WARPXM v1.10.0
Loading...
Searching...
No Matches
WxCrypt Class Reference

WxCrypt provides a container to store/retrive name-value pairs. More...

#include <wxcrypt.h>

Inheritance diagram for WxCrypt:
WxCryptSet

Detailed Description

WxCrypt provides a container to store/retrive name-value pairs.

The names are of type std::string while the associated values can be of arbitrary types supporting the copy constructor. Note that for efficiency reasons WxCrypt should be used to store only "light-weight" objects like native-type objects (int, double, string etc.) or small objects which are not expensive to copy.

WxCrypt objects are immutable: values once added can not be removed or modifed.

Public Types

typedef std::map< std::string, WxAny, std::less< std::string > > AnyMap_t
 
typedef std::pair< std::string, WxAnyAnyPair_t
 
typedef int crypt_signed_int_t
 

Public Member Functions

 WxCrypt ()
 
virtual ~WxCrypt ()
 
 WxCrypt (const WxCrypt &crypt)
 Copy ctor: make a deep copy of 'crypt'.
 
WxCryptoperator= (const WxCrypt &rhs)
 Assignment operator: LHS is a deep copy of 'rhs'.
 
template<typename VALUETYPE >
bool add (const std::string &name, const VALUETYPE &value)
 Insert a name, value pair.
 
bool has (const std::string &name) const
 Returns true if the 'name' exists in the crypt.
 
template<typename VALUETYPE >
VALUETYPE get (const std::string &name) const
 Retrieve the value associated with name.
 
template<typename VALUETYPE >
VALUETYPE getWithDefault (const std::string &name, const VALUETYPE defaultValue) const
 Retrieve the value associated with name, or the given default value if no such key is in the cryptset.
 
const WxAnyget (const std::string &name) const
 Gets the raw WxAny value associated with name.
 
WxAnyget (const std::string &name)
 Gets the raw WxAny value associated with name.
 
void set (const std::string &name, const WxAny &val)
 Ensures a value with name is this wxcrypt, either by adding it or changing the existing map.
 
void set (const std::string &name, WxAny &&val)
 Ensures a value with name is this wxcrypt, either by adding it or changing the existing map.
 
template<class T >
void set (const std::string &name, T val)
 
template<typename VALUETYPE >
std::vector< VALUETYPE > getVec (const std::string &name) const
 Retrieve list of values associated with name.
 

Member Typedef Documentation

◆ AnyMap_t

typedef std::map<std::string, WxAny, std::less<std::string> > WxCrypt::AnyMap_t

◆ AnyPair_t

typedef std::pair<std::string, WxAny> WxCrypt::AnyPair_t

◆ crypt_signed_int_t

Constructor & Destructor Documentation

◆ WxCrypt() [1/2]

WxCrypt::WxCrypt ( )

◆ ~WxCrypt()

virtual WxCrypt::~WxCrypt ( )
virtual

◆ WxCrypt() [2/2]

WxCrypt::WxCrypt ( const WxCrypt crypt)

Copy ctor: make a deep copy of 'crypt'.

Member Function Documentation

◆ add()

template<typename VALUETYPE >
bool WxCrypt::add ( const std::string &  name,
const VALUETYPE &  value 
)
inline

Insert a name, value pair.

Returns true if the insertion worked, false otherwise

Parameters
nameName of object
valueValue of object

◆ get() [1/3]

WxAny & WxCrypt::get ( const std::string &  name)
inline

Gets the raw WxAny value associated with name.

◆ get() [2/3]

template<typename VALUETYPE >
VALUETYPE WxCrypt::get ( const std::string &  name) const
inline

Retrieve the value associated with name.

Parameters
nameReturn value associated with 'name'

◆ get() [3/3]

const WxAny & WxCrypt::get ( const std::string &  name) const
inline

Gets the raw WxAny value associated with name.

Parameters
name

◆ getVec()

template<typename VALUETYPE >
std::vector< VALUETYPE > WxCrypt::getVec ( const std::string &  name) const
inline

Retrieve list of values associated with name.

Parameters
nameReturn list of values associated with 'name'

◆ getWithDefault()

template<typename VALUETYPE >
VALUETYPE WxCrypt::getWithDefault ( const std::string &  name,
const VALUETYPE  defaultValue 
) const
inline

Retrieve the value associated with name, or the given default value if no such key is in the cryptset.

Parameters
nameThe key to retrieve

◆ has()

bool WxCrypt::has ( const std::string &  name) const

Returns true if the 'name' exists in the crypt.

Parameters
nameName of object to check.

◆ operator=()

WxCrypt & WxCrypt::operator= ( const WxCrypt rhs)

Assignment operator: LHS is a deep copy of 'rhs'.

◆ set() [1/3]

void WxCrypt::set ( const std::string &  name,
const WxAny val 
)
inline

Ensures a value with name is this wxcrypt, either by adding it or changing the existing map.

◆ set() [2/3]

template<class T >
void WxCrypt::set ( const std::string &  name,
val 
)
inline

◆ set() [3/3]

void WxCrypt::set ( const std::string &  name,
WxAny &&  val 
)
inline

Ensures a value with name is this wxcrypt, either by adding it or changing the existing map.


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