1 |
afaq |
1.1 |
#ifndef _Util_hpp_included_
|
2 |
|
|
#define _Util_hpp_included_
|
3 |
|
|
#include <string>
|
4 |
|
|
#include "ResultSet.hpp"
|
5 |
|
|
#include "RowInterface.hpp"
|
6 |
|
|
#include "common.hpp"
|
7 |
|
|
|
8 |
|
|
class Util {
|
9 |
|
|
|
10 |
|
|
public:
|
11 |
|
|
Util();
|
12 |
|
|
std::string getToken(std::string, int);
|
13 |
|
|
std::string getTokenAt(std::string, int);
|
14 |
|
|
std::string eraseEndChars(std::string, int);
|
15 |
|
|
bool isSet(RowInterface*, std::string, std::string);
|
16 |
|
|
bool isKeySet(RowInterface*, Keys_iter, Keys_iter);
|
17 |
|
|
bool isListOfKeySet(RowInterface*, ListOfLists_iter, ListOfLists_iter);
|
18 |
|
|
bool isConsistant(RowInterface*, RowInterface*);
|
19 |
|
|
bool isInMultiRef(std::string, Dictionary_iter, Dictionary_iter);
|
20 |
|
|
bool toSetCol(std::string, Dictionary_iter, Dictionary_iter);
|
21 |
|
|
ListOfLists_iter getListOfKey(RowInterface*, ListOfLists_iter, ListOfLists_iter);
|
22 |
|
|
std::string getDataType(std::string);
|
23 |
|
|
std::string getStrValue(RowInterface*, std::string, std::string);
|
24 |
|
|
void setValue(RowInterface* aRow, std::string name, std::string dataType, std::string value);
|
25 |
|
|
Dictionary_iter getMappedValue(std::string, Dictionary_iter, Dictionary_iter);
|
26 |
|
|
//Keys_iter getKey(RowInterface*, Keys_iter, Keys_iter);
|
27 |
|
|
void equatePKWithRef(RowInterface* aRow, Dictionary_iter b, Dictionary_iter e);
|
28 |
|
|
void equatePKWithMultiRef(RowInterface* aRow, Dictionary_iter b, Dictionary_iter e);
|
29 |
|
|
Keys getKey(RowInterface*, Keys_iter, Keys_iter);
|
30 |
|
|
Keys_iter getNullKey(RowInterface*, Keys_iter, Keys_iter);
|
31 |
|
|
Keys getPrimaryKeys(Keys_iter, Keys_iter, Dictionary_iter, Dictionary_iter);
|
32 |
|
|
|
33 |
|
|
void setSchema(Dictionary*);
|
34 |
|
|
|
35 |
|
|
// Simple convertion functions.
|
36 |
|
|
std::string itoa(int i);
|
37 |
|
|
int atoi(std::string);
|
38 |
|
|
|
39 |
|
|
std::string Util::ctoa(char c);
|
40 |
|
|
std::string Util::ftoa(float f);
|
41 |
|
|
float Util::atof(std::string);
|
42 |
|
|
|
43 |
|
|
void tokenize(const string& str, vector<string>& tokens, const string& delimiters = " ");
|
44 |
|
|
long getTime();
|
45 |
|
|
private:
|
46 |
|
|
Dictionary* schema;
|
47 |
|
|
void fillPrimaryKeys(std::string, Keys &, Dictionary_iter, Dictionary_iter);
|
48 |
|
|
};
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
#endif
|
52 |
|
|
|