#include <boolBuilder.h>
Inheritance diagram for xmli::boolBuilder:

Public Member Functions | |
| boolBuilder (const char *tag) | |
| void | Build (const AttributeList &attr, const std::string &buffer) |
Definition at line 14 of file boolBuilder.h.
|
|
Definition at line 19 of file boolBuilder.cxx.
00019 : xmli::Builder(tag) { } |
|
||||||||||||
|
Definition at line 23 of file boolBuilder.cxx. References xmli::AttributeList, xmli::ChString::IsFalse(), xmli::ChString::IsTrue(), and xmli::ChString::Split().
00025 {
00026 //======================================================================
00027 // Construct a vector<bool> from XML data
00028 // attr - unused...
00029 // buffer - space-separated tokens representing bool values
00030 //======================================================================
00031 bool b;
00032 std::vector<std::string> vs;
00033 std::vector<bool> vb;
00034
00035 // Split the string in to sub fields and extra the values from each
00036 // sub-field
00037 xmli::ChString::Split(buffer.c_str()," ,\n\t\r",vs);
00038 std::vector<std::string>::iterator itr(vs.begin());
00039 std::vector<std::string>::iterator itrEnd(vs.end());
00040 for (; itr!=itrEnd; ++itr) {
00041 if (xmli::ChString::IsTrue(*itr)) b = 1;
00042 else if (xmli::ChString::IsFalse(*itr)) b = 0;
00043 else abort();
00044 vb.push_back(b);
00045 }
00046
00047 // Add this vector of boolean values into the "global" stack
00048 xmli::Stack<std::vector<bool> >::Instance().push(vb);
00049 }
|
1.3.5