#ifndef AGDBSECTIONHH #define AGDBSECTIONHH #include "ExpatInterface/Element.h" #include "agdbBase.hh" #include "agdbVolume.hh" #include "agdbAttribute.hh" #include "agdbCompos.hh" // LESTER Remove me namespace agdb { class Section : public Base { private: vector _baseVec; Attribute _name; Attribute _version; Attribute _date; Attribute _author; Attribute _topVolAtt; Volume * _topVolPtr; public: Section() : Base("section"), _baseVec(), _name ("name" , Attribute::required), _version ("version" , Attribute::required), _date ("date" , Attribute::required), _author ("author" , Attribute::required), _topVolAtt("top_volume", Attribute::required), _topVolPtr(0) { }; void putMeIn(xml::Element & parent) { cout << "section put me in" << endl; xml::Element * child = new xml::Element(); assert(child); parent.addChild(child); child->setTagName(Base::getTagName()); _name .addAttributeTo(child); _version .addAttributeTo(child); _date .addAttributeTo(child); _author .addAttributeTo(child); _topVolAtt.addAttributeTo(child); //child->addAttribute("name", _name); // LESTER Must complete ... add checks // Lastly the children. for (unsigned int i=0; i<_baseVec.size(); i++) { //cout << "part " << i+1 << " of " << _baseVec.size() << endl; //cout << "is tagged " << _baseVec[i]->getTagName() << endl; //cout << "is called " << _baseVec[i]->getName() << endl; _baseVec[i]->putMeIn(*child); }; }; public: Section & addVolume(Volume * volume) { assert(volume); _baseVec.push_back(volume); return *this; }; Section & addVolume(Volume & volume) { _baseVec.push_back(&volume); return *this; }; Section & setName(const string & s) { _name.setValue(s); return *this; }; Section & setVersion(const string & s) { _version.setValue(s); return *this; }; Section & setDate() { _date.setValue("right now"); return *this; }; // LESTER Must Complete Section & setAuthor() { _author.setValue("me"); return *this; }; // LESTER Must Complete Section & setTopVol(Volume & volume) { _topVolPtr = &volume; _topVolAtt.setValue( volume.getName() ); return *this; }; Section & setEnvelope(); // LESTER Must Complete }; } // end of agdb namespace #endif