Rev 1601 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1601 | Rev 1914 | ||
|---|---|---|---|
| Line 75... | Line 75... | ||
| 75 | void Node::Parse(std::string data) |
75 | void Node::Parse(std::string data) |
| 76 | { |
76 | { |
| 77 | char c; |
77 | char c; |
| 78 | int position = 0; |
78 | int position = 0; |
| 79 | 79 | ||
| 80 | while (position < data.length()) |
80 | while ((unsigned int)position < data.length()) |
| 81 | { |
81 | { |
| 82 | c = data.at(position); |
82 | c = data.at(position); |
| 83 | 83 | ||
| 84 | switch (c) |
84 | switch (c) |
| 85 | { |
85 | { |
| Line 131... | Line 131... | ||
| 131 | std::string buffer; |
131 | std::string buffer; |
| 132 | int pos = 0; |
132 | int pos = 0; |
| 133 | char c; |
133 | char c; |
| 134 | int s, e; |
134 | int s, e; |
| 135 | 135 | ||
| 136 | while (pos < tag_string.length()) |
136 | while ((unsigned int)pos < tag_string.length()) |
| 137 | { |
137 | { |
| 138 | c = tag_string.at(pos); |
138 | c = tag_string.at(pos); |
| 139 | 139 | ||
| 140 | switch (c) |
140 | switch (c) |
| 141 | { |
141 | { |
| Line 185... | Line 185... | ||
| 185 | 185 | ||
| 186 | position = end_position; |
186 | position = end_position; |
| 187 | 187 | ||
| 188 | if (!found_end) |
188 | if (!found_end) |
| 189 | { |
189 | { |
| 190 | while (position < data.length()) |
190 | while ((unsigned int)position < data.length()) |
| 191 | { |
191 | { |
| 192 | c = data.at(position); |
192 | c = data.at(position); |
| 193 | 193 | ||
| 194 | switch (c) |
194 | switch (c) |
| 195 | { |
195 | { |
| Line 234... | Line 234... | ||
| 234 | return position; |
234 | return position; |
| 235 | } |
235 | } |
| 236 | 236 | ||
| 237 | Node Node::FindChild(std::string tag_name) |
237 | Node Node::FindChild(std::string tag_name) |
| 238 | { |
238 | { |
| 239 | for (int n = 0; n < this->children_.size(); n++) |
239 | for (unsigned int n = 0; n < this->children_.size(); n++) |
| 240 | { |
240 | { |
| 241 | if (this->children_[n].GetTagName().compare(tag_name) == 0) |
241 | if (this->children_[n].GetTagName().compare(tag_name) == 0) |
| 242 | { |
242 | { |
| 243 | return this->children_[n]; |
243 | return this->children_[n]; |
| 244 | } |
244 | } |
| Line 247... | Line 247... | ||
| 247 | throw std::runtime_error("No child with that tag name found, " + tag_name); |
247 | throw std::runtime_error("No child with that tag name found, " + tag_name); |
| 248 | } |
248 | } |
| 249 | 249 | ||
| 250 | Node Node::SelectChild(std::string attribute_name, std::string attribute_value) |
250 | Node Node::SelectChild(std::string attribute_name, std::string attribute_value) |
| 251 | { |
251 | { |
| 252 | for (int n = 0; n < this->children_.size(); n++) |
252 | for (unsigned int n = 0; n < this->children_.size(); n++) |
| 253 | { |
253 | { |
| 254 | if (this->children_[n].GetAttributeValue(attribute_name) == attribute_value) |
254 | if (this->children_[n].GetAttributeValue(attribute_name) == attribute_value) |
| 255 | { |
255 | { |
| 256 | return this->children_[n]; |
256 | return this->children_[n]; |
| 257 | } |
257 | } |
| Line 260... | Line 260... | ||
| 260 | throw std::runtime_error("No child with that attribute combination found, " + attribute_name + " = " + attribute_value); |
260 | throw std::runtime_error("No child with that attribute combination found, " + attribute_name + " = " + attribute_value); |
| 261 | } |
261 | } |
| 262 | 262 | ||
| 263 | Node Node::SelectChild(std::string attribute_name1, std::string attribute_value1, std::string attribute_name2, std::string attribute_value2) |
263 | Node Node::SelectChild(std::string attribute_name1, std::string attribute_value1, std::string attribute_name2, std::string attribute_value2) |
| 264 | { |
264 | { |
| 265 | for (int n = 0; n < this->children_.size(); n++) |
265 | for (unsigned int n = 0; n < this->children_.size(); n++) |
| 266 | { |
266 | { |
| 267 | if (this->children_[n].GetAttributeValue(attribute_name1) == attribute_value1 && this->children_[n].GetAttributeValue(attribute_name2) == attribute_value2) |
267 | if (this->children_[n].GetAttributeValue(attribute_name1) == attribute_value1 && this->children_[n].GetAttributeValue(attribute_name2) == attribute_value2) |
| 268 | { |
268 | { |
| 269 | return this->children_[n]; |
269 | return this->children_[n]; |
| 270 | } |
270 | } |