Go to the documentation of this file.00001
00019 #ifndef __DATAPAIRS
00020
00021 #define __DATAPAIRS
00022
00023 #include <string>
00024 #include <cstdlib>
00025 #include <vector>
00026 #include <utility>
00027
00028 #include "configuration.h"
00029
00030
00033 class DataPairs
00034 {
00035 protected:
00037 std::vector< std::vector< std::string > > values;
00038
00039 public:
00041 unsigned int getLength();
00042
00044 void setMaxSize(unsigned int size);
00045
00046 bool getItem(unsigned int index, std::vector< std::string > &item);
00047
00049 unsigned int getMaxSize();
00051 void add(std::string attribute, std::string value, bool replace = false);
00052
00054 void clear();
00055
00063 int getIndex(std::string attr, std::vector<unsigned int> &ids);
00064 int getFirstIndex(std::string str);
00065
00073 void getStrings(std::string str, std::vector<std::string> &result);
00074
00075
00077 int getInt(std::string str, int defaultValue = 0);
00079 float getFloat(std::string str, float defaultValue = 0.0);
00081 std::string getString(std::string str, std::string defaultValue = "");
00083 bool getBool(std::string str, bool defaultValue = false);
00084
00085
00087 bool getIntValue(std::string str, int &result);
00089 bool getFloatValue(std::string str, float &result);
00091 bool getStringValue(std::string str, std::string &result);
00093 bool getBoolValue(std::string str, bool &result);
00094
00096 void copyFrom(DataPairs &other);
00097
00099 void print();
00100
00101 void resolveString(std::string input, std::string &output);
00102 std::string resolveString(std::string input);
00103 void resolve();
00104
00105 void loadFromXml(CConfiguration &config, TiXmlElement* node, DataPairs* replace = NULL);
00106 };
00107
00108
00109 #endif