#include <sequenceBuilder.h>
Inheritance diagram for jobc::sequenceBuilder:

Public Member Functions | |
| sequenceBuilder (const char *tag) | |
| void | Build (const xmli::AttributeList &attr, const std::string &buffer) |
|
|
Definition at line 23 of file sequenceBuilder.cxx.
00023 : 00024 xmli::Builder(tag) 00025 { } |
|
||||||||||||
|
Builders must implement this method which constructs a C++ object from XML attributes
Implements xmli::Builder. Definition at line 29 of file sequenceBuilder.cxx. References xmli::AttributeList, xmli::Stack< T >::Instance(), jobc::Node::IsSequence(), and jobc::Sequence::PushFront().
00031 {
00032 //======================================================================
00033 // Handle the link tag.
00034 //
00035 // At the end of the tag, parse each of the files listed in "buffer"
00036 //======================================================================
00037 std::string name;
00038 xmli::AttributeList::const_iterator itr ( attr.begin() );
00039 xmli::AttributeList::const_iterator itrEnd( attr.end() );
00040 for (; itr!=itrEnd; ++itr) {
00041 std::string n = itr->Name();
00042 std::string v = itr->Value();
00043 if (n=="name") { name = v; continue; }
00044 std::cerr << "Bad attribute for <sequence>=" << itr->Name() << std::endl;
00045 exit(1);
00046 }
00047
00048 // Build the sequence
00049 Sequence seq(name.c_str());
00050
00051 // Add nodes -- note they will come off the stack in reverse order
00052 xmli::Stack<Node*>& stk = xmli::Stack<Node*>::Instance();
00053 for (; !stk.empty(); stk.pop()) {
00054 Node* n = stk.top();
00055 Sequence* s = static_cast<Sequence*>(n);
00056 if (n->IsSequence()) { seq.PushFront( *s ); delete s; }
00057 else { seq.PushFront( *n ); delete n; }
00058 }
00059 SeqTable::Instance().Insert(seq);
00060 }
|
1.3.5