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

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>

Inheritance diagram for WxCryptSet:
WxCrypt

Detailed Description

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, WxAnyAnyPair_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.
 
WxCryptSetoperator= (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 WxCryptSetgetSet (const std::string &name) const
 Get cryptset with given name.
 
WxCryptSetgetSet (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'.
 
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.
 

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).
 

Member Typedef Documentation

◆ CryptSetMap_t

typedef std::map<std::string, WxCryptSet*, std::less<std::string> > WxCryptSet::CryptSetMap_t

◆ CryptSetPair_t

typedef std::pair<std::string, WxCryptSet*> WxCryptSet::CryptSetPair_t

◆ DependencyList_t

typedef std::pair<std::string, std::vector<std::pair<std::string, std::string> > > WxCryptSet::DependencyList_t

◆ TypeMap_t

typedef std::map<std::string, std::vector<std::string> > WxCryptSet::TypeMap_t

◆ TypePair_t

typedef std::pair<std::string, std::vector<std::string> > WxCryptSet::TypePair_t

Constructor & Destructor Documentation

◆ WxCryptSet() [1/4]

WxCryptSet::WxCryptSet ( )

Create nameless cryptset.

◆ WxCryptSet() [2/4]

WxCryptSet::WxCryptSet ( const std::string &  name)

Create empty cryptset with given name.

Parameters
nameName of the set

◆ WxCryptSet() [3/4]

WxCryptSet::WxCryptSet ( std::istream &  istr)

Create cryptset by parsing input from specified stream.

Parameters
istrThe input stream from which the cryptset is constructed

◆ ~WxCryptSet()

virtual WxCryptSet::~WxCryptSet ( )
virtual

◆ WxCryptSet() [4/4]

WxCryptSet::WxCryptSet ( const WxCryptSet wxc)

Copy ctor: makes a deep copy of the supplied set.

Member Function Documentation

◆ addSet()

void WxCryptSet::addSet ( const WxCryptSet wxc)

Add a new WxCryptSet.

Parameters
wxcAdd given cryptset to this set.

◆ getNamesOfType()

std::vector< std::string > WxCryptSet::getNamesOfType ( const std::string &  type) const

Return list of cryptset names with the given type.

Parameters
typeType name
Returns
list of cryptset of the supplied type

◆ getNamesOfTypes() [1/5]

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

Parameters
typeType name
Returns
list of cryptset of the supplied types

◆ getNamesOfTypes() [2/5]

std::vector< std::string > WxCryptSet::getNamesOfTypes ( const std::string &  t0,
const std::string &  t1,
const std::string &  t2 
) const

◆ getNamesOfTypes() [3/5]

std::vector< std::string > WxCryptSet::getNamesOfTypes ( const std::string &  t0,
const std::string &  t1,
const std::string &  t2,
const std::string &  t3 
) const

◆ getNamesOfTypes() [4/5]

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

◆ getNamesOfTypes() [5/5]

std::vector< std::string > WxCryptSet::getNamesOfTypes ( const std::vector< std::string > &  types) const

Return list of cryptset names with the given types.

Parameters
typeList of types
Returns
list of cryptset of the supplied types

◆ getSet() [1/2]

WxCryptSet & WxCryptSet::getSet ( const std::string &  name)

◆ getSet() [2/2]

const WxCryptSet & WxCryptSet::getSet ( const std::string &  name) const

Get cryptset with given name.

The returned set is immutable.

Parameters
nameName of cryptset to get.

◆ hasSet()

bool WxCryptSet::hasSet ( const std::string &  name) const

Returns true if specified cyrptset exists.

Parameters
nameName of cryptset to test for.

◆ name()

std::string WxCryptSet::name ( ) const
inline

Name of crypt set.

◆ operator=()

WxCryptSet & WxCryptSet::operator= ( const WxCryptSet wxc)

Assignment operator: makes a deep copy of supplied set.

◆ parseDependencyString()

static DependencyList_t WxCryptSet::parseDependencyString ( const std::string &  ds)
static

Parses dependency string and returns the child and list of dependencies (can be none).

Parameters
dependencyString
Returns
child name string paired with a vector of pairs (prerequisite names, prerequisite types )

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