Lexical cast the text() of a node as an int
| 54 | |
| 55 | // Lexical cast the text() of a node as an int |
| 56 | boost::optional<int> lexicalCastToInt(const pugi::xml_node& element) { |
| 57 | boost::optional<int> result; |
| 58 | if (element) { |
| 59 | try { |
| 60 | result = boost::lexical_cast<int>(element.text().as_string()); |
| 61 | } catch (const boost::bad_lexical_cast&) { |
| 62 | // LOG(Error, "Cannot convert element text to double"); |
| 63 | } |
| 64 | } |
| 65 | return result; |
| 66 | } |
| 67 | |
| 68 | // Lexical cast the text() of an attribute as a double |
| 69 | boost::optional<double> lexicalCastToDouble(const pugi::xml_attribute& attr) { |
no test coverage detected