Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

xmli::boolBuilder Class Reference

Builder of a vector<bool> from XML data. More...

#include <boolBuilder.h>

Inheritance diagram for xmli::boolBuilder:

xmli::Builder List of all members.

Public Member Functions

 boolBuilder (const char *tag)
void Build (const AttributeList &attr, const std::string &buffer)

Detailed Description

Builder of a vector<bool> from XML data.

Definition at line 14 of file boolBuilder.h.


Constructor & Destructor Documentation

xmli::boolBuilder::boolBuilder const char *  tag  ) 
 

Definition at line 19 of file boolBuilder.cxx.

00019 : xmli::Builder(tag) { }


Member Function Documentation

void xmli::boolBuilder::Build const AttributeList attr,
const std::string &  buffer
 

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 }


The documentation for this class was generated from the following files:
Generated on Fri Jul 25 02:05:55 2008 for NOvA Offline by doxygen 1.3.5