X-Git-Url: http://git.maemo.org/git/?p=lordsawar;a=blobdiff_plain;f=src%2Fprodslot.cpp;fp=src%2Fprodslot.cpp;h=bbc5b5879c2b53bbb01d5ea64a34246ad48efdae;hp=0000000000000000000000000000000000000000;hb=9eda00ff73353c55ecef6f82131166d5d4a85e29;hpb=3d34d4aa85a929f912464f71158396a388274f27 diff --git a/src/prodslot.cpp b/src/prodslot.cpp new file mode 100644 index 0000000..bbc5b58 --- /dev/null +++ b/src/prodslot.cpp @@ -0,0 +1,83 @@ +// Copyright (C) 2008, Ben Asselstine +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Library General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +// 02110-1301, USA. + +#include "prodslot.h" + +#include "armyprodbase.h" +#include "xmlhelper.h" + +std::string ProdSlot::d_tag = "slot"; + +//#define debug(x) {std::cerr<<__FILE__<<": "<<__LINE__<<": "<registerTag(ArmyProdBase::d_tag, + sigc::mem_fun(this, &ProdSlot::load)); + +} + +bool ProdSlot::load(std::string tag, XML_Helper *helper) +{ + if (tag == ArmyProdBase::d_tag) + { + d_armyprodbase = new ArmyProdBase(helper); + return true; + } + return false; +} + +ProdSlot::~ProdSlot() +{ + if (d_armyprodbase) + { + delete d_armyprodbase; + d_armyprodbase = NULL; + } +} + +bool ProdSlot::save(XML_Helper *helper) const +{ + bool retval = true; + retval &= helper->openTag(ProdSlot::d_tag); + if (d_armyprodbase) + retval &= d_armyprodbase->save(helper); + retval &= helper->closeTag(); + return retval; +} + +void ProdSlot::clear() +{ + if (d_armyprodbase) + delete d_armyprodbase; + d_armyprodbase = NULL; +};