InformationTextAdapter.cxx

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG)
00003  *                         UNIVERSITAT POMPEU FABRA
00004  *
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 
00023 #include "InformationTextAdapter.hxx"
00024 #include "Assert.hxx"
00025 #include "XMLAdapter.hxx"
00026 #include "XMLStorage.hxx"
00027 
00028 namespace CLAM
00029 {
00030         InformationTextAdapter::InformationTextAdapter( int coordX, int coordY, const Text & text)
00031                 : _coordX(coordX)
00032                 ,_coordY(coordY)
00033                 ,_text(text)
00034         {}
00035 
00036         InformationTextAdapter::~InformationTextAdapter()
00037         {}
00038 
00039         void InformationTextAdapter::StoreOn (Storage & store) const
00040         {
00041                 Text text(_text);
00042 
00043                 XMLAdapter<int> coordXAdapter( _coordX, "x", true);
00044                 XMLAdapter<int> coordYAdapter( _coordY, "y", true);
00045                 XMLAdapter<Text> infoAdapter( _text, "text", true);
00046         
00047                 store.Store(coordXAdapter);
00048                 store.Store(coordYAdapter);
00049                 store.Store(infoAdapter);
00050         }
00051 
00052         void InformationTextAdapter::LoadFrom (Storage & store) 
00053         {
00054                 XMLAdapter<int> coordXAdapter( _coordX, "x", true);
00055                 if (not store.Load(coordXAdapter))
00056                         _coordX=0;
00057 
00058                 XMLAdapter<int> coordYAdapter( _coordY, "y", true);
00059                 if (not store.Load(coordYAdapter))
00060                         _coordY=0;
00061 
00062                 XMLAdapter<Text> infoAdapter( _text, "text", true);
00063                 if (not store.Load(infoAdapter))
00064                         _text=Text("");
00065         }
00066 } // namespace CLAM
00067 
Generated by  doxygen 1.6.3