Enum.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 #include <iostream>
00023 #include "Enum.hxx"
00024 #include "XMLAdapter.hxx"
00025 #include "Text.hxx"
00026 
00027 namespace CLAM {
00028 
00029         Enum::~Enum()
00030         {
00031         }
00032 
00033         void Enum::StoreOn( Storage& storage ) const
00034         {
00035                 std::string s = GetString();
00036                 XMLAdapter<std::string> adapter(s);
00037                 storage.Store(adapter);
00038         }
00039 
00040         void Enum::LoadFrom( Storage& storage )
00041         {
00042                 Text s;
00043                 //XMLAdapter<std::string> adapter(s);
00044                 XMLAdapter<Text> adapter(s);
00045                 storage.Load(adapter);
00046                 SetValueSafely(s);
00047         
00048         }
00049 
00050 std::ostream & operator << (std::ostream & os, const Enum & e) throw (IllegalValue) {
00051         os << e.GetString();
00052         return os;
00053 }
00054 
00055 std::istream & operator >> (std::istream & os, Enum & e) throw (IllegalValue) {
00056         std::string s;
00057         os >> s;
00058         e.SetValue(s);
00059         return os;
00060 }
00061 
00062 }
00063 
Generated by  doxygen 1.6.3