Crypto++ 8.7
Free C++ class library of cryptographic schemes
|
Interface for retrieving values given their names. More...
#include <cryptlib.h>
Classes | |
class | ValueTypeMismatch |
Thrown when an unexpected type is encountered. More... | |
Public Member Functions | |
template<class T > | |
bool | GetThisObject (T &object) const |
Get a copy of this object or subobject. More... | |
template<class T > | |
bool | GetThisPointer (T *&ptr) const |
Get a pointer to this object. More... | |
template<class T > | |
bool | GetValue (const char *name, T &value) const |
Get a named value. More... | |
template<class T > | |
T | GetValueWithDefault (const char *name, T defaultValue) const |
Get a named value. More... | |
CRYPTOPP_DLL std::string | GetValueNames () const |
Get a list of value names that can be retrieved. More... | |
CRYPTOPP_DLL bool | GetIntValue (const char *name, int &value) const |
Get a named value with type int. More... | |
CRYPTOPP_DLL int | GetIntValueWithDefault (const char *name, int defaultValue) const |
Get a named value with type int, with default. More... | |
CRYPTOPP_DLL bool | GetWord64Value (const char *name, word64 &value) const |
Get a named value with type word64. More... | |
CRYPTOPP_DLL word64 | GetWord64ValueWithDefault (const char *name, word64 defaultValue) const |
Get a named value with type word64, with default. More... | |
template<class T > | |
void | GetRequiredParameter (const char *className, const char *name, T &value) const |
Retrieves a required name/value pair. More... | |
CRYPTOPP_DLL void | GetRequiredIntParameter (const char *className, const char *name, int &value) const |
Retrieves a required name/value pair. More... | |
virtual CRYPTOPP_DLL bool | GetVoidValue (const char *name, const std::type_info &valueType, void *pValue) const =0 |
Get a named value. More... | |
Static Public Member Functions | |
static CRYPTOPP_DLL void | ThrowIfTypeMismatch (const char *name, const std::type_info &stored, const std::type_info &retrieving) |
Ensures an expected name and type is present. More... | |
Interface for retrieving values given their names.
This class is used to safely pass a variable number of arbitrarily typed arguments to functions and to read values from keys and crypto parameters.
To obtain an object that implements NameValuePairs for the purpose of parameter passing, use the MakeParameters() function.
To get a value from NameValuePairs, you need to know the name and the type of the value. Call GetValueNames() on a NameValuePairs object to obtain a list of value names that it supports. then look at the Name namespace documentation to see what the type of each value is, or alternatively, call GetIntValue() with the value name, and if the type is not int, a ValueTypeMismatch exception will be thrown and you can get the actual type from the exception object.
Definition at line 321 of file cryptlib.h.
|
inlinevirtual |
Definition at line 324 of file cryptlib.h.
|
inline |
Get a copy of this object or subobject.
T | class or type |
object | reference to a variable that receives the value |
Definition at line 357 of file cryptlib.h.
|
inline |
Get a pointer to this object.
T | class or type |
ptr | reference to a pointer to a variable that receives the value |
Definition at line 366 of file cryptlib.h.
|
inline |
Get a named value.
T | class or type |
name | the name of the object or value to retrieve |
value | reference to a variable that receives the value |
Definition at line 379 of file cryptlib.h.
|
inline |
Get a named value.
T | class or type |
name | the name of the object or value to retrieve |
defaultValue | the default value of the class or type if it does not exist |
Definition at line 392 of file cryptlib.h.
|
inline |
Get a list of value names that can be retrieved.
the items in the list are delimited with a colon.
Definition at line 404 of file cryptlib.h.
|
inline |
Get a named value with type int.
name | the name of the value to retrieve |
value | the value retrieved upon success |
GetIntValue() is used to ensure we don't accidentally try to get an unsigned int or some other type when we mean int (which is the most common case)
Definition at line 415 of file cryptlib.h.
|
inline |
Get a named value with type int, with default.
name | the name of the value to retrieve |
defaultValue | the default value if the name does not exist |
Definition at line 424 of file cryptlib.h.
|
inline |
Get a named value with type word64.
name | the name of the value to retrieve |
value | the value retrieved upon success |
Definition at line 433 of file cryptlib.h.
|
inline |
Get a named value with type word64, with default.
name | the name of the value to retrieve |
defaultValue | the default value if the name does not exist |
Definition at line 442 of file cryptlib.h.
|
inlinestatic |
Ensures an expected name and type is present.
name | the name of the value |
stored | the type that was stored for the name |
retrieving | the type that is being retrieved for the name |
ValueTypeMismatch |
ThrowIfTypeMismatch() effectively performs a type safety check. stored and retrieving are C++ mangled names for the type.
Definition at line 454 of file cryptlib.h.
|
inline |
Retrieves a required name/value pair.
T | class or type |
className | the name of the class |
name | the name of the value |
value | reference to a variable to receive the value |
InvalidArgument |
GetRequiredParameter() throws InvalidArgument if the name is not present or not of the expected type T.
Definition at line 468 of file cryptlib.h.
|
inline |
Retrieves a required name/value pair.
className | the name of the class |
name | the name of the value |
value | reference to a variable to receive the value |
InvalidArgument |
GetRequiredParameter() throws InvalidArgument if the name is not present or not of the expected type T.
Definition at line 483 of file cryptlib.h.
|
pure virtual |
Get a named value.
name | the name of the object or value to retrieve |
valueType | reference to a variable that receives the value |
pValue | void pointer to a variable that receives the value |
GetVoidValue() retrieves the value of name if it exists.
Implemented in CombinedNameValuePairs, AlgorithmParameters, DL_GroupParameters_EC< EC >, DL_PrivateKey_ECGDSA< EC >, ESIGNFunction, InvertibleESIGNFunction, DL_GroupParameters_IntegerBased, DL_GroupParameters_IntegerBasedImpl< GROUP_PRECOMP, BASE_PRECOMP >, DL_GroupParameters_IntegerBasedImpl< ModExpPrecomputation >, DL_GroupParameters_IntegerBasedImpl< DL_GroupPrecomputation_LUC, DL_BasePrecomputation_LUC >, DL_GroupParameters_GFP, LUCFunction, InvertibleLUCFunction, DL_GroupParameters_LUC, DL_GroupParameters< T >, DL_GroupParameters< typename GROUP_PRECOMP::Element >, DL_GroupParameters< Integer >, DL_PrivateKeyImpl< GP >, DL_PrivateKeyImpl< DL_GroupParameters_EC< EC > >, DL_PublicKeyImpl< GP >, DL_PublicKeyImpl< DL_GroupParameters_EC< EC > >, RabinFunction, InvertibleRabinFunction, RSAFunction, InvertibleRSAFunction, RWFunction, InvertibleRWFunction, x25519, ed25519PrivateKey, ed25519PublicKey, and XTR_DH.