libtgd 4.2
A library that makes working with multidimensional arrays in C++ easy
Public Member Functions | List of all members
TGD::TagList Class Reference

A tag list to store key/value pairs, where both key and value are strings. More...

#include <taglist.hpp>

Public Member Functions

 TagList ()
 Constructor. More...
 
 TagList (std::initializer_list< std::pair< std::string, std::string > > tags)
 Construct a tag list from a list of key/value pairs. More...
 
size_t size () const
 Returns the number of key/value pairs in this tag list. More...
 
std::map< std::string, std::string >::const_iterator cbegin () const noexcept
 Iterator, for accessing all key/value pairs in this tag list. More...
 
std::map< std::string, std::string >::const_iterator cend () const noexcept
 Iterator, for accessing all key/value pairs in this tag list. More...
 
void clear ()
 Clear the tag list. More...
 
void set (const std::string &key, const std::string &value)
 Set a key to a value. More...
 
void unset (const std::string &key)
 Unset a key. More...
 
bool contains (const std::string &key) const
 Check if this list contains a given key. More...
 
const std::string & value (const std::string &key, const std::string &defaultValue=std::string()) const
 Return the value to a given key, or the defaultValue if the key is not set. More...
 
bool value (const std::string &key, signed char *result) const
 Return the value to a given key in result and return true, or return false if the key is not set. More...
 
signed char value (const std::string &key, signed char defaultValue) const
 Return the value to a given key, falling back to defaultValue if necessary. More...
 
bool value (const std::string &key, unsigned char *result) const
 Return the value to a given key in result and return true, or return false if the key is not set. More...
 
unsigned char value (const std::string &key, unsigned char defaultValue) const
 Return the value to a given key, falling back to defaultValue if necessary. More...
 
bool value (const std::string &key, signed short *result) const
 Return the value to a given key in result and return true, or return false if the key is not set. More...
 
signed short value (const std::string &key, signed short defaultValue) const
 Return the value to a given key, falling back to defaultValue if necessary. More...
 
bool value (const std::string &key, unsigned short *result) const
 Return the value to a given key in result and return true, or return false if the key is not set. More...
 
unsigned short value (const std::string &key, unsigned short defaultValue) const
 Return the value to a given key, falling back to defaultValue if necessary. More...
 
bool value (const std::string &key, signed int *result) const
 Return the value to a given key in result and return true, or return false if the key is not set. More...
 
signed int value (const std::string &key, signed int defaultValue) const
 Return the value to a given key, falling back to defaultValue if necessary. More...
 
bool value (const std::string &key, unsigned int *result) const
 Return the value to a given key in result and return true, or return false if the key is not set. More...
 
unsigned int value (const std::string &key, unsigned int defaultValue) const
 Return the value to a given key, falling back to defaultValue if necessary. More...
 
bool value (const std::string &key, signed long *result) const
 Return the value to a given key in result and return true, or return false if the key is not set. More...
 
signed long value (const std::string &key, signed long defaultValue) const
 Return the value to a given key, falling back to defaultValue if necessary. More...
 
bool value (const std::string &key, unsigned long *result) const
 Return the value to a given key in result and return true, or return false if the key is not set. More...
 
unsigned long value (const std::string &key, unsigned long defaultValue) const
 Return the value to a given key, falling back to defaultValue if necessary. More...
 
bool value (const std::string &key, signed long long *result) const
 Return the value to a given key in result and return true, or return false if the key is not set. More...
 
signed long long value (const std::string &key, signed long long defaultValue) const
 Return the value to a given key, falling back to defaultValue if necessary. More...
 
bool value (const std::string &key, unsigned long long *result) const
 Return the value to a given key in result and return true, or return false if the key is not set. More...
 
unsigned long long value (const std::string &key, unsigned long long defaultValue) const
 Return the value to a given key, falling back to defaultValue if necessary. More...
 
bool value (const std::string &key, float *result) const
 Return the value to a given key in result and return true, or return false if the key is not set. More...
 
float value (const std::string &key, float defaultValue) const
 Return the value to a given key, falling back to defaultValue if necessary. More...
 
bool value (const std::string &key, double *result) const
 Return the value to a given key in result and return true, or return false if the key is not set. More...
 
double value (const std::string &key, double defaultValue) const
 Return the value to a given key, falling back to defaultValue if necessary. More...
 
bool value (const std::string &key, long double *result) const
 Return the value to a given key in result and return true, or return false if the key is not set. More...
 
long double value (const std::string &key, long double defaultValue) const
 Return the value to a given key, falling back to defaultValue if necessary. More...
 

Detailed Description

A tag list to store key/value pairs, where both key and value are strings.

Constructor & Destructor Documentation

◆ TagList() [1/2]

TGD::TagList::TagList ( )
inline

Constructor.

◆ TagList() [2/2]

TGD::TagList::TagList ( std::initializer_list< std::pair< std::string, std::string > >  tags)
inline

Construct a tag list from a list of key/value pairs.

Member Function Documentation

◆ cbegin()

std::map< std::string, std::string >::const_iterator TGD::TagList::cbegin ( ) const
inlinenoexcept

Iterator, for accessing all key/value pairs in this tag list.

◆ cend()

std::map< std::string, std::string >::const_iterator TGD::TagList::cend ( ) const
inlinenoexcept

Iterator, for accessing all key/value pairs in this tag list.

◆ clear()

void TGD::TagList::clear ( )
inline

Clear the tag list.

◆ contains()

bool TGD::TagList::contains ( const std::string &  key) const
inline

Check if this list contains a given key.

◆ set()

void TGD::TagList::set ( const std::string &  key,
const std::string &  value 
)
inline

Set a key to a value.

◆ size()

size_t TGD::TagList::size ( ) const
inline

Returns the number of key/value pairs in this tag list.

◆ unset()

void TGD::TagList::unset ( const std::string &  key)
inline

Unset a key.

◆ value() [1/27]

const std::string & TGD::TagList::value ( const std::string &  key,
const std::string &  defaultValue = std::string() 
) const
inline

Return the value to a given key, or the defaultValue if the key is not set.

◆ value() [2/27]

bool TGD::TagList::value ( const std::string &  key,
double *  result 
) const
inline

Return the value to a given key in result and return true, or return false if the key is not set.

◆ value() [3/27]

double TGD::TagList::value ( const std::string &  key,
double  defaultValue 
) const
inline

Return the value to a given key, falling back to defaultValue if necessary.

◆ value() [4/27]

bool TGD::TagList::value ( const std::string &  key,
float *  result 
) const
inline

Return the value to a given key in result and return true, or return false if the key is not set.

◆ value() [5/27]

float TGD::TagList::value ( const std::string &  key,
float  defaultValue 
) const
inline

Return the value to a given key, falling back to defaultValue if necessary.

◆ value() [6/27]

bool TGD::TagList::value ( const std::string &  key,
long double *  result 
) const
inline

Return the value to a given key in result and return true, or return false if the key is not set.

◆ value() [7/27]

long double TGD::TagList::value ( const std::string &  key,
long double  defaultValue 
) const
inline

Return the value to a given key, falling back to defaultValue if necessary.

◆ value() [8/27]

bool TGD::TagList::value ( const std::string &  key,
signed char *  result 
) const
inline

Return the value to a given key in result and return true, or return false if the key is not set.

◆ value() [9/27]

signed char TGD::TagList::value ( const std::string &  key,
signed char  defaultValue 
) const
inline

Return the value to a given key, falling back to defaultValue if necessary.

◆ value() [10/27]

bool TGD::TagList::value ( const std::string &  key,
signed int *  result 
) const
inline

Return the value to a given key in result and return true, or return false if the key is not set.

◆ value() [11/27]

signed int TGD::TagList::value ( const std::string &  key,
signed int  defaultValue 
) const
inline

Return the value to a given key, falling back to defaultValue if necessary.

◆ value() [12/27]

bool TGD::TagList::value ( const std::string &  key,
signed long *  result 
) const
inline

Return the value to a given key in result and return true, or return false if the key is not set.

◆ value() [13/27]

signed long TGD::TagList::value ( const std::string &  key,
signed long  defaultValue 
) const
inline

Return the value to a given key, falling back to defaultValue if necessary.

◆ value() [14/27]

bool TGD::TagList::value ( const std::string &  key,
signed long long *  result 
) const
inline

Return the value to a given key in result and return true, or return false if the key is not set.

◆ value() [15/27]

signed long long TGD::TagList::value ( const std::string &  key,
signed long long  defaultValue 
) const
inline

Return the value to a given key, falling back to defaultValue if necessary.

◆ value() [16/27]

bool TGD::TagList::value ( const std::string &  key,
signed short *  result 
) const
inline

Return the value to a given key in result and return true, or return false if the key is not set.

◆ value() [17/27]

signed short TGD::TagList::value ( const std::string &  key,
signed short  defaultValue 
) const
inline

Return the value to a given key, falling back to defaultValue if necessary.

◆ value() [18/27]

bool TGD::TagList::value ( const std::string &  key,
unsigned char *  result 
) const
inline

Return the value to a given key in result and return true, or return false if the key is not set.

◆ value() [19/27]

unsigned char TGD::TagList::value ( const std::string &  key,
unsigned char  defaultValue 
) const
inline

Return the value to a given key, falling back to defaultValue if necessary.

◆ value() [20/27]

bool TGD::TagList::value ( const std::string &  key,
unsigned int *  result 
) const
inline

Return the value to a given key in result and return true, or return false if the key is not set.

◆ value() [21/27]

unsigned int TGD::TagList::value ( const std::string &  key,
unsigned int  defaultValue 
) const
inline

Return the value to a given key, falling back to defaultValue if necessary.

◆ value() [22/27]

bool TGD::TagList::value ( const std::string &  key,
unsigned long *  result 
) const
inline

Return the value to a given key in result and return true, or return false if the key is not set.

◆ value() [23/27]

unsigned long TGD::TagList::value ( const std::string &  key,
unsigned long  defaultValue 
) const
inline

Return the value to a given key, falling back to defaultValue if necessary.

◆ value() [24/27]

bool TGD::TagList::value ( const std::string &  key,
unsigned long long *  result 
) const
inline

Return the value to a given key in result and return true, or return false if the key is not set.

◆ value() [25/27]

unsigned long long TGD::TagList::value ( const std::string &  key,
unsigned long long  defaultValue 
) const
inline

Return the value to a given key, falling back to defaultValue if necessary.

◆ value() [26/27]

bool TGD::TagList::value ( const std::string &  key,
unsigned short *  result 
) const
inline

Return the value to a given key in result and return true, or return false if the key is not set.

◆ value() [27/27]

unsigned short TGD::TagList::value ( const std::string &  key,
unsigned short  defaultValue 
) const
inline

Return the value to a given key, falling back to defaultValue if necessary.


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