Data Storage Class (Attribute-Value Pairs) More...
#include <datapairs.h>
Public Member Functions | |
void | add (std::string attribute, std::string value, bool replace=false) |
Adds the attribute-value pair attribute, value. | |
void | clear () |
Clears storage buffer. | |
void | copyFrom (DataPairs &other) |
Copies all Attribute-Value pairs. | |
bool | getBool (std::string str, bool defaultValue=false) |
bool | getBoolValue (std::string str, bool &result) |
int | getFirstIndex (std::string str) |
float | getFloat (std::string str, float defaultValue=0.0) |
bool | getFloatValue (std::string str, float &result) |
int | getIndex (std::string attr, std::vector< unsigned int > &ids) |
Retrieves all indexes of Attribute-Value pairs with Attribute name equal to attr. | |
int | getInt (std::string str, int defaultValue=0) |
bool | getIntValue (std::string str, int &result) |
bool | getItem (unsigned int index, std::vector< std::string > &item) |
unsigned int | getLength () |
Returns Number of pairs stored. | |
unsigned int | getMaxSize () |
Returns Max. number of stored pairs. | |
std::string | getString (std::string str, std::string defaultValue="") |
void | getStrings (std::string str, std::vector< std::string > &result) |
Retrieves all Attribute-Value pairs with Attribute name equal to attr. | |
bool | getStringValue (std::string str, std::string &result) |
void | loadFromXml (CConfiguration &config, TiXmlElement *node, DataPairs *replace=NULL) |
void | print () |
Prints all Attribute-Value pairs. | |
void | resolve () |
void | resolveString (std::string input, std::string &output) |
std::string | resolveString (std::string input) |
void | setMaxSize (unsigned int size) |
Sets number of storable items to size. | |
Protected Attributes | |
std::vector< std::vector < std::string > > | values |
Attribute Names and Values. |
Data Storage Class (Attribute-Value Pairs)
Copyright (c) 2016, Aumann Florian, Heller Florian, Jäkel Rainer, Wittenbeck Valerij All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition at line 33 of file datapairs.h.
void DataPairs::add | ( | std::string | attribute, |
std::string | value, | ||
bool | replace = false |
||
) |
Adds the attribute-value pair attribute, value.
Definition at line 160 of file datapairs.cpp.
void DataPairs::clear | ( | ) |
Clears storage buffer.
Definition at line 126 of file datapairs.cpp.
void DataPairs::copyFrom | ( | DataPairs & | other | ) |
Copies all Attribute-Value pairs.
Definition at line 38 of file datapairs.cpp.
bool DataPairs::getBool | ( | std::string | str, |
bool | defaultValue = false |
||
) |
Definition at line 150 of file datapairs.cpp.
bool DataPairs::getBoolValue | ( | std::string | str, |
bool & | result | ||
) |
Definition at line 273 of file datapairs.cpp.
int DataPairs::getFirstIndex | ( | std::string | str | ) |
Definition at line 70 of file datapairs.cpp.
float DataPairs::getFloat | ( | std::string | str, |
float | defaultValue = 0.0 |
||
) |
Definition at line 105 of file datapairs.cpp.
bool DataPairs::getFloatValue | ( | std::string | str, |
float & | result | ||
) |
Definition at line 197 of file datapairs.cpp.
int DataPairs::getIndex | ( | std::string | attr, |
std::vector< unsigned int > & | ids | ||
) |
Retrieves all indexes of Attribute-Value pairs with Attribute name equal to attr.
str | Attribute-Name to search for |
ids | Array of retrieved indexes, has to be allocated |
len | Number of retrieved pairs |
Definition at line 80 of file datapairs.cpp.
int DataPairs::getInt | ( | std::string | str, |
int | defaultValue = 0 |
||
) |
Definition at line 95 of file datapairs.cpp.
bool DataPairs::getIntValue | ( | std::string | str, |
int & | result | ||
) |
Definition at line 180 of file datapairs.cpp.
bool DataPairs::getItem | ( | unsigned int | index, |
std::vector< std::string > & | item | ||
) |
Copyright (c) 2016, Aumann Florian, Heller Florian, Jäkel Rainer, Wittenbeck Valerij All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition at line 27 of file datapairs.cpp.
unsigned int DataPairs::getLength | ( | ) |
Returns Number of pairs stored.
Definition at line 131 of file datapairs.cpp.
unsigned int DataPairs::getMaxSize | ( | ) |
Returns Max. number of stored pairs.
std::string DataPairs::getString | ( | std::string | str, |
std::string | defaultValue = "" |
||
) |
Definition at line 116 of file datapairs.cpp.
void DataPairs::getStrings | ( | std::string | str, |
std::vector< std::string > & | result | ||
) |
Retrieves all Attribute-Value pairs with Attribute name equal to attr.
str | Attribute-Name to search for |
result | Array of pointers to retrieved Value-strings, has to be of allocated |
len | Number of retrieved pairs |
Definition at line 137 of file datapairs.cpp.
bool DataPairs::getStringValue | ( | std::string | str, |
std::string & | result | ||
) |
Definition at line 214 of file datapairs.cpp.
void DataPairs::loadFromXml | ( | CConfiguration & | config, |
TiXmlElement * | node, | ||
DataPairs * | replace = NULL |
||
) |
Definition at line 359 of file datapairs.cpp.
void DataPairs::print | ( | ) |
Prints all Attribute-Value pairs.
Definition at line 49 of file datapairs.cpp.
void DataPairs::resolve | ( | ) |
Definition at line 350 of file datapairs.cpp.
void DataPairs::resolveString | ( | std::string | input, |
std::string & | output | ||
) |
Definition at line 284 of file datapairs.cpp.
std::string DataPairs::resolveString | ( | std::string | input | ) |
Definition at line 343 of file datapairs.cpp.
void DataPairs::setMaxSize | ( | unsigned int | size | ) |
Sets number of storable items to size.
Definition at line 61 of file datapairs.cpp.
std::vector< std::vector< std::string > > DataPairs::values [protected] |
Attribute Names and Values.
Definition at line 37 of file datapairs.h.