InformationTextAdapter.cxx
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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 }
00067