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

Public Member Functions | |
| jobBuilder (const char *tag) | |
| void | Build (const xmli::AttributeList &attr, const std::string &buffer) |
|
|
Definition at line 24 of file jobBuilder.cxx. 00024 : xmli::Builder(tag) { }
|
|
||||||||||||
|
Builders must implement this method which constructs a C++ object from XML attributes
<beetle name="ringo" instrument="drums">
Ringo is my favorite
</beetle>
is passed as two attributes name=ringo, and instrument=drums and with buffer='Ringo is my favorite'Once C++ object is created, it should be placed on a xmli::Stack to be used by other pieces of code
Implements xmli::Builder. Definition at line 28 of file jobBuilder.cxx. References jobc::Stack::AdoptJob(), jobc::Stack::Instance(), xmli::Stack< T >::Instance(), jobc::Node::IsSequence(), and jobc::Sequence::PushFront(). 00030 {
00031 //======================================================================
00032 // Handle the link tag.
00033 //
00034 // At the end of the tag, parse each of the files listed in "buffer"
00035 //======================================================================
00036 std::string name;
00037
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 << "jobBuilder:" << __LINE__
00045 << " Bad attribute for <job>=" << n
00046 << "=" << v << std::endl;
00047 exit(1);
00048 }
00049
00050 Job* j = new Job(name.c_str());
00051
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()) { j->PushFront( *s ); delete s; }
00057 else { j->PushFront( *n ); delete n; }
00058 }
00059 Stack::Instance().AdoptJob(j);
00060 }
|
1.3.9.1