WARPXM v1.10.0
|
WxCryptSet extends WxCrypt by providing, in addition to name-value pairs, an set of named WxCryptSets, thus providing a powerful way of representing hierarchical data. More...
#include <wxcryptset.h>
WxCryptSet extends WxCrypt by providing, in addition to name-value pairs, an set of named WxCryptSets, thus providing a powerful way of representing hierarchical data.
In effect the WxCryptSet is a n-ary tree with non-unique keys.
Copying (or assignment of) a WxCryptSet can be expensive as the complete tree is copied (deep-copy semantics). In general this is not a problem as the creation of the set is usually done at start-up time and the resulting set is never modified.
Like its parent WxCrypt, WxCryptSet is also immutable: sets once added can not be deleted or modified.
Public Types | |
typedef std::map< std::string, WxCryptSet *, std::less< std::string > > | CryptSetMap_t |
typedef std::pair< std::string, WxCryptSet * > | CryptSetPair_t |
typedef std::map< std::string, std::vector< std::string > > | TypeMap_t |
typedef std::pair< std::string, std::vector< std::string > > | TypePair_t |
typedef std::pair< std::string, std::vector< std::pair< std::string, std::string > > > | DependencyList_t |
Public Types inherited from WxCrypt | |
typedef std::map< std::string, WxAny, std::less< std::string > > | AnyMap_t |
typedef std::pair< std::string, WxAny > | AnyPair_t |
typedef int | crypt_signed_int_t |
Public Member Functions | |
WxCryptSet () | |
Create nameless cryptset. | |
WxCryptSet (const std::string &name) | |
Create empty cryptset with given name. | |
WxCryptSet (std::istream &istr) | |
Create cryptset by parsing input from specified stream. | |
virtual | ~WxCryptSet () |
WxCryptSet (const WxCryptSet &wxc) | |
Copy ctor: makes a deep copy of the supplied set. | |
WxCryptSet & | operator= (const WxCryptSet &wxc) |
Assignment operator: makes a deep copy of supplied set. | |
std::string | name () const |
Name of crypt set. | |
void | addSet (const WxCryptSet &wxc) |
Add a new WxCryptSet. | |
bool | hasSet (const std::string &name) const |
Returns true if specified cyrptset exists. | |
const WxCryptSet & | getSet (const std::string &name) const |
Get cryptset with given name. | |
WxCryptSet & | getSet (const std::string &name) |
std::vector< std::string > | getNamesOfType (const std::string &type) const |
Return list of cryptset names with the given type. | |
std::vector< std::string > | getNamesOfTypes (const std::vector< std::string > &types) const |
Return list of cryptset names with the given types. | |
std::vector< std::string > | getNamesOfTypes (const std::string &t0, const std::string &t1) const |
Return list of cryptset names with the given types. | |
std::vector< std::string > | getNamesOfTypes (const std::string &t0, const std::string &t1, const std::string &t2) const |
std::vector< std::string > | getNamesOfTypes (const std::string &t0, const std::string &t1, const std::string &t2, const std::string &t3) const |
std::vector< std::string > | getNamesOfTypes (const std::string &t0, const std::string &t1, const std::string &t2, const std::string &t3, const std::string &t4) const |
Public Member Functions inherited from WxCrypt | |
WxCrypt () | |
virtual | ~WxCrypt () |
WxCrypt (const WxCrypt &crypt) | |
Copy ctor: make a deep copy of 'crypt'. | |
WxCrypt & | operator= (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 WxAny & | get (const std::string &name) const |
Gets the raw WxAny value associated with name. | |
WxAny & | get (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. | |
Static Public Member Functions | |
static DependencyList_t | parseDependencyString (const std::string &ds) |
Parses dependency string and returns the child and list of dependencies (can be none). | |
typedef std::map<std::string, WxCryptSet*, std::less<std::string> > WxCryptSet::CryptSetMap_t |
typedef std::pair<std::string, WxCryptSet*> WxCryptSet::CryptSetPair_t |
typedef std::pair<std::string, std::vector<std::pair<std::string, std::string> > > WxCryptSet::DependencyList_t |
typedef std::map<std::string, std::vector<std::string> > WxCryptSet::TypeMap_t |
typedef std::pair<std::string, std::vector<std::string> > WxCryptSet::TypePair_t |
WxCryptSet::WxCryptSet | ( | ) |
Create nameless cryptset.
WxCryptSet::WxCryptSet | ( | const std::string & | name | ) |
Create empty cryptset with given name.
name | Name of the set |
WxCryptSet::WxCryptSet | ( | std::istream & | istr | ) |
Create cryptset by parsing input from specified stream.
istr | The input stream from which the cryptset is constructed |
|
virtual |
WxCryptSet::WxCryptSet | ( | const WxCryptSet & | wxc | ) |
Copy ctor: makes a deep copy of the supplied set.
void WxCryptSet::addSet | ( | const WxCryptSet & | wxc | ) |
Add a new WxCryptSet.
wxc | Add given cryptset to this set. |
std::vector< std::string > WxCryptSet::getNamesOfType | ( | const std::string & | type | ) | const |
Return list of cryptset names with the given type.
type | Type name |
std::vector< std::string > WxCryptSet::getNamesOfTypes | ( | const std::string & | t0, |
const std::string & | t1 | ||
) | const |
Return list of cryptset names with the given types.
TODO: When moving to C++11 we should switch to variadic templates for these functions
type | Type name |
std::vector< std::string > WxCryptSet::getNamesOfTypes | ( | const std::string & | t0, |
const std::string & | t1, | ||
const std::string & | t2 | ||
) | const |
std::vector< std::string > WxCryptSet::getNamesOfTypes | ( | const std::string & | t0, |
const std::string & | t1, | ||
const std::string & | t2, | ||
const std::string & | t3 | ||
) | const |
std::vector< std::string > WxCryptSet::getNamesOfTypes | ( | const std::string & | t0, |
const std::string & | t1, | ||
const std::string & | t2, | ||
const std::string & | t3, | ||
const std::string & | t4 | ||
) | const |
std::vector< std::string > WxCryptSet::getNamesOfTypes | ( | const std::vector< std::string > & | types | ) | const |
Return list of cryptset names with the given types.
type | List of types |
WxCryptSet & WxCryptSet::getSet | ( | const std::string & | name | ) |
const WxCryptSet & WxCryptSet::getSet | ( | const std::string & | name | ) | const |
Get cryptset with given name.
The returned set is immutable.
name | Name of cryptset to get. |
bool WxCryptSet::hasSet | ( | const std::string & | name | ) | const |
Returns true if specified cyrptset exists.
name | Name of cryptset to test for. |
|
inline |
Name of crypt set.
WxCryptSet & WxCryptSet::operator= | ( | const WxCryptSet & | wxc | ) |
Assignment operator: makes a deep copy of supplied set.
|
static |
Parses dependency string and returns the child and list of dependencies (can be none).
dependencyString |