customer.cpp
Go to the documentation of this file.00001 /*************************************************************************** 00002 file : $URL: https://frepple.svn.sourceforge.net/svnroot/frepple/trunk/src/model/customer.cpp $ 00003 version : $LastChangedRevision: 744 $ $LastChangedBy: jdetaeye $ 00004 date : $LastChangedDate: 2008-04-12 18:30:32 +0200 (Sat, 12 Apr 2008) $ 00005 ***************************************************************************/ 00006 00007 /*************************************************************************** 00008 * * 00009 * Copyright (C) 2007 by Johan De Taeye * 00010 * * 00011 * This library is free software; you can redistribute it and/or modify it * 00012 * under the terms of the GNU Lesser General Public License as published * 00013 * by the Free Software Foundation; either version 2.1 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 * This library is distributed in the hope that it will be useful, * 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser * 00019 * General Public License for more details. * 00020 * * 00021 * You should have received a copy of the GNU Lesser General Public * 00022 * License along with this library; if not, write to the Free Software * 00023 * Foundation Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * 00024 * * 00025 ***************************************************************************/ 00026 00027 #define FREPPLE_CORE 00028 #include "frepple/model.h" 00029 00030 namespace frepple 00031 { 00032 00033 template<class Customer> DECLARE_EXPORT Tree HasName<Customer>::st; 00034 00035 00036 DECLARE_EXPORT void Customer::writeElement(XMLOutput* o, const Keyword& tag, mode m) const 00037 { 00038 // Writing a reference 00039 if (m == REFERENCE) 00040 { 00041 o->writeElement(tag, Tags::tag_name, getName()); 00042 return; 00043 } 00044 00045 // Write the complete object 00046 if (m != NOHEADER) o->BeginObject(tag, Tags::tag_name, getName()); 00047 00048 // Write the fields 00049 HasDescription::writeElement(o, tag); 00050 HasHierarchy<Customer>::writeElement(o, tag); 00051 o->EndObject(tag); 00052 } 00053 00054 00055 DECLARE_EXPORT void Customer::beginElement(XMLInput& pIn, const Attribute& pAttr) 00056 { 00057 HasHierarchy<Customer>::beginElement(pIn, pAttr); 00058 } 00059 00060 00061 DECLARE_EXPORT void Customer::endElement(XMLInput& pIn, const Attribute& pAttr, const DataElement& pElement) 00062 { 00063 HasDescription::endElement(pIn, pAttr, pElement); 00064 HasHierarchy<Customer>::endElement(pIn, pAttr, pElement); 00065 } 00066 00067 00068 DECLARE_EXPORT Customer::~Customer() 00069 { 00070 // Remove all references from demands to this customer 00071 for (Demand::iterator i = Demand::begin(); i != Demand::end(); ++i) 00072 if (i->getCustomer() == this) i->setCustomer(NULL); 00073 } 00074 00075 00076 }
Documentation generated by
