CSEngine
Loading...
Searching...
No Matches
XValue Class Reference
Inheritance diagram for XValue:

Public Member Functions

 XValue (const std::string &str)
 
XValueoperator= (const std::string &str)
 
std::vector< float > toFloatVector () const
 
std::vector< int > toIntegerVector () const
 
std::vector< std::string > toStringVector () const
 

Detailed Description

Definition at line 14 of file XML.h.

Constructor & Destructor Documentation

◆ XValue() [1/2]

XValue::XValue ( )

Definition at line 7 of file XML.cpp.

7{}

◆ XValue() [2/2]

XValue::XValue ( const std::string &  str)

Definition at line 9 of file XML.cpp.

9: std::string(str) {}

Member Function Documentation

◆ operator=()

XValue & XValue::operator= ( const std::string &  str)

Definition at line 11 of file XML.cpp.

11 {
12 this->assign(str);
13 return *this;
14}

◆ toFloatVector()

std::vector< float > XValue::toFloatVector ( ) const

Definition at line 16 of file XML.cpp.

16 {
17 std::string buffer = "";
18 std::vector<float> array;
19
20 for (unsigned int i = 0; i < this->length(); i++) {
21 int acsii = (int) this->at(i);
22 buffer += (char) acsii;
23
24 if (acsii == 32 || i == this->length() - 1) {
25 float f = atof(buffer.c_str());
26 array.push_back(f);
27 buffer.clear();
28 }
29 }
30
31 return array;
32}

◆ toIntegerVector()

std::vector< int > XValue::toIntegerVector ( ) const

Definition at line 34 of file XML.cpp.

34 {
35 std::string buffer = "";
36 std::vector<int> array;
37
38 for (unsigned int i = 0; i < this->length(); i++) {
39 int acsii = (int) this->at(i);
40 buffer += (char) acsii;
41
42 if (acsii == 32 || i == this->length() - 1) {
43 float f = atoi(buffer.c_str());
44 array.push_back(f);
45 buffer.clear();
46 }
47 }
48
49 return array;
50}

◆ toStringVector()

std::vector< std::string > XValue::toStringVector ( ) const

Definition at line 52 of file XML.cpp.

52 {
53 std::string buffer = "";
54 std::vector<std::string> array;
55
56 for (unsigned int i = 0; i < this->length(); i++) {
57 int acsii = (int) this->at(i);
58 buffer += (char) acsii;
59
60 if (acsii == 32 || i == this->length() - 1) {
61 array.push_back(buffer);
62 buffer.clear();
63 }
64 }
65
66 return array;
67}

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