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

Public Member Functions | |
| floatBuilder (const char *tag) | |
| void | Build (const AttributeList &attr, const std::string &buffer) |
Definition at line 13 of file floatBuilder.h.
|
|
Definition at line 19 of file floatBuilder.cxx.
00019 : xmli::Builder(tag) { } |
|
||||||||||||
|
Definition at line 23 of file floatBuilder.cxx. References xmli::AttributeList, and xmli::ChString::Split().
00025 {
00026 //======================================================================
00027 // Build a vector<float> from XML data and add it to the stack
00028 // attr - unused
00029 // buffer - list of space-separated floating point numbers
00030 //======================================================================
00031 float f;
00032 std::vector<std::string> vs;
00033 std::vector<float> vf;
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 f = atof(itr->c_str());
00042 vf.push_back(f);
00043 }
00044
00045 // Add this vector of floatean values into the "global" stack
00046 xmli::Stack<std::vector<float> >::Instance().push(vf);
00047 }
|
1.3.5