Commit a803ba6bc6efddff73b60d43908ad5fa50d1503f
1 parent
1e3c4bd5
update
Showing
1 changed file
with
13 additions
and
14 deletions
src/xml/GXml.cpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * GXml.cpp - XML class implementation * | 2 | * GXml.cpp - XML class implementation * |
| 3 | * ----------------------------------------------------------------------- * | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010 by Jurgen Knodlseder * | 4 | + * copyright (C) 2010-2011 by Jurgen Knodlseder * |
| 5 | * ----------------------------------------------------------------------- * | 5 | * ----------------------------------------------------------------------- * |
| 6 | * * | 6 | * * |
| 7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
| @@ -57,7 +57,7 @@ | @@ -57,7 +57,7 @@ | ||
| 57 | ***************************************************************************/ | 57 | ***************************************************************************/ |
| 58 | GXml::GXml(void) | 58 | GXml::GXml(void) |
| 59 | { | 59 | { |
| 60 | - // Initialise private members for clean destruction | 60 | + // Initialise members |
| 61 | init_members(); | 61 | init_members(); |
| 62 | 62 | ||
| 63 | // Return | 63 | // Return |
| @@ -68,11 +68,11 @@ GXml::GXml(void) | @@ -68,11 +68,11 @@ GXml::GXml(void) | ||
| 68 | /***********************************************************************//** | 68 | /***********************************************************************//** |
| 69 | * @brief Copy constructor | 69 | * @brief Copy constructor |
| 70 | * | 70 | * |
| 71 | - * @param[in] xml Object from which the instance should be built. | 71 | + * @param[in] xml XML object. |
| 72 | ***************************************************************************/ | 72 | ***************************************************************************/ |
| 73 | GXml::GXml(const GXml& xml) | 73 | GXml::GXml(const GXml& xml) |
| 74 | { | 74 | { |
| 75 | - // Initialise private members for clean destruction | 75 | + // Initialise members |
| 76 | init_members(); | 76 | init_members(); |
| 77 | 77 | ||
| 78 | // Copy members | 78 | // Copy members |
| @@ -86,11 +86,11 @@ GXml::GXml(const GXml& xml) | @@ -86,11 +86,11 @@ GXml::GXml(const GXml& xml) | ||
| 86 | /***********************************************************************//** | 86 | /***********************************************************************//** |
| 87 | * @brief Load constructor | 87 | * @brief Load constructor |
| 88 | * | 88 | * |
| 89 | - * @param[in] filename XML file from which object should be constructed. | 89 | + * @param[in] filename XML file name. |
| 90 | ***************************************************************************/ | 90 | ***************************************************************************/ |
| 91 | GXml::GXml(const std::string& filename) | 91 | GXml::GXml(const std::string& filename) |
| 92 | { | 92 | { |
| 93 | - // Initialise private members for clean destruction | 93 | + // Initialise members |
| 94 | init_members(); | 94 | init_members(); |
| 95 | 95 | ||
| 96 | // Load XML file | 96 | // Load XML file |
| @@ -123,7 +123,7 @@ GXml::~GXml(void) | @@ -123,7 +123,7 @@ GXml::~GXml(void) | ||
| 123 | /***********************************************************************//** | 123 | /***********************************************************************//** |
| 124 | * @brief Assignment operator | 124 | * @brief Assignment operator |
| 125 | * | 125 | * |
| 126 | - * @param[in] xml Object which should be assigned. | 126 | + * @param[in] xml XML object. |
| 127 | ***************************************************************************/ | 127 | ***************************************************************************/ |
| 128 | GXml& GXml::operator= (const GXml& xml) | 128 | GXml& GXml::operator= (const GXml& xml) |
| 129 | { | 129 | { |
| @@ -133,7 +133,7 @@ GXml& GXml::operator= (const GXml& xml) | @@ -133,7 +133,7 @@ GXml& GXml::operator= (const GXml& xml) | ||
| 133 | // Free members | 133 | // Free members |
| 134 | free_members(); | 134 | free_members(); |
| 135 | 135 | ||
| 136 | - // Initialise private members for clean destruction | 136 | + // Initialise members |
| 137 | init_members(); | 137 | init_members(); |
| 138 | 138 | ||
| 139 | // Copy members | 139 | // Copy members |
| @@ -203,7 +203,7 @@ void GXml::load(const std::string& filename) | @@ -203,7 +203,7 @@ void GXml::load(const std::string& filename) | ||
| 203 | // Check if file exists | 203 | // Check if file exists |
| 204 | if (!file_exists(filename)) | 204 | if (!file_exists(filename)) |
| 205 | throw GException::file_not_found(G_LOAD, filename); | 205 | throw GException::file_not_found(G_LOAD, filename); |
| 206 | - | 206 | + |
| 207 | // Open parameter file | 207 | // Open parameter file |
| 208 | FILE* fptr = fopen(filename.c_str(), "r"); | 208 | FILE* fptr = fopen(filename.c_str(), "r"); |
| 209 | if (fptr == NULL) | 209 | if (fptr == NULL) |
| @@ -356,7 +356,6 @@ void GXml::copy_members(const GXml& xml) | @@ -356,7 +356,6 @@ void GXml::copy_members(const GXml& xml) | ||
| 356 | ***************************************************************************/ | 356 | ***************************************************************************/ |
| 357 | void GXml::free_members(void) | 357 | void GXml::free_members(void) |
| 358 | { | 358 | { |
| 359 | - | ||
| 360 | // Return | 359 | // Return |
| 361 | return; | 360 | return; |
| 362 | } | 361 | } |
| @@ -414,7 +413,7 @@ void GXml::parse(FILE* fptr) | @@ -414,7 +413,7 @@ void GXml::parse(FILE* fptr) | ||
| 414 | else if (c == '>') { | 413 | else if (c == '>') { |
| 415 | segment.append(1, (char)c); | 414 | segment.append(1, (char)c); |
| 416 | throw GException::xml_syntax_error(G_PARSE, segment, | 415 | throw GException::xml_syntax_error(G_PARSE, segment, |
| 417 | - "unexpected closing bracket '>' encountered"); | 416 | + "unexpected closing bracket \">\" encountered"); |
| 418 | } | 417 | } |
| 419 | 418 | ||
| 420 | // ... otherwise add character to segment | 419 | // ... otherwise add character to segment |
| @@ -442,7 +441,7 @@ void GXml::parse(FILE* fptr) | @@ -442,7 +441,7 @@ void GXml::parse(FILE* fptr) | ||
| 442 | else if (c == '<') { | 441 | else if (c == '<') { |
| 443 | segment.append(1, (char)c); | 442 | segment.append(1, (char)c); |
| 444 | throw GException::xml_syntax_error(G_PARSE, segment, | 443 | throw GException::xml_syntax_error(G_PARSE, segment, |
| 445 | - "unexpected opening bracket '<' encountered"); | 444 | + "unexpected opening bracket \"<\" encountered"); |
| 446 | } | 445 | } |
| 447 | 446 | ||
| 448 | // ... otherwise add character to segment | 447 | // ... otherwise add character to segment |
| @@ -504,7 +503,7 @@ void GXml::process_markup(GXmlNode** current, const std::string& segment) | @@ -504,7 +503,7 @@ void GXml::process_markup(GXmlNode** current, const std::string& segment) | ||
| 504 | // Check if we have the correct end tag | 503 | // Check if we have the correct end tag |
| 505 | GXmlElement* element = (GXmlElement*)(*current); | 504 | GXmlElement* element = (GXmlElement*)(*current); |
| 506 | element->parse_stop(segment); | 505 | element->parse_stop(segment); |
| 507 | - | 506 | + |
| 508 | // Set current node pointer back to parent of the current node | 507 | // Set current node pointer back to parent of the current node |
| 509 | (*current) = element->parent(); | 508 | (*current) = element->parent(); |
| 510 | } | 509 | } |
| @@ -620,7 +619,7 @@ GXml::MarkupType GXml::get_markuptype(const std::string& segment) const | @@ -620,7 +619,7 @@ GXml::MarkupType GXml::get_markuptype(const std::string& segment) const | ||
| 620 | { | 619 | { |
| 621 | // Initialise with invalid Markup Type | 620 | // Initialise with invalid Markup Type |
| 622 | MarkupType type = MT_INVALID; | 621 | MarkupType type = MT_INVALID; |
| 623 | - | 622 | + |
| 624 | // Get length of segment | 623 | // Get length of segment |
| 625 | int n = segment.length(); | 624 | int n = segment.length(); |
| 626 | 625 |