installedVersion.h

Go to the documentation of this file.
00001 /* -*- Mode:c++ -*- */
00002 /*
00003  *  this is part of Spm
00004  *
00005  *  Copyright (c) 2008 Guillaume Chevallereau
00006  *
00007  *  This program is free software. You can redistribute it and/or modify it 
00008  *  under the terms of the GNU General Public License as published by the 
00009  *  Free Software Foundation. Either version 2 of the license or (at your 
00010  *  option) any later version.
00011  *
00012  *  This program is distributed in the hope that it will be usefull but WITHOUT
00013  *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
00014  *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
00015  *  more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License along 
00018  *  with this program; if not, write to the Free Software Foundation, Inc., 
00019  *  59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
00020  */
00021 #ifndef __INSTALLED_VERSION__
00022 #define __INSTALLED_VERSION__
00023 
00024 #include <core/branch.h>
00025 #include <util/propertyList.h>
00026 #include <boost/filesystem/path.hpp>
00027 
00028 namespace Spm
00029 {
00030   namespace Core 
00031   {
00032     class InstalledVersion : public Versionned
00033     {     
00034     private :
00035       friend class Element;
00036       friend class PackageManager;
00037       friend class ElementStore;
00038       InstalledVersion (Element * parent,
00039                         const miniXml::ustring & version,
00040                         const boost::filesystem::path & prefix);
00041       ~InstalledVersion ()
00042       {
00043       }
00044     public :
00045       static const miniXml::ustring PROPERTY_MICRO;
00046       static const miniXml::ustring PROPERTY_EXTRA;
00047       static const miniXml::ustring PROPERTY_PREFIX;
00048       static const miniXml::ustring PROPERTY_SIZE;
00049       const miniXml::ustring & getName () const;
00050       const miniXml::ustring & getName ();
00051 
00052       void setMicro (const miniXml::ustring & micro)
00053       {
00054         set (PROPERTY_MICRO,
00055              micro);
00056         name_ = "";
00057         modified_(this);
00058       }
00059 
00060       void setExtra (const miniXml::ustring & extra)
00061       {
00062         set (PROPERTY_EXTRA,
00063              extra);
00064         name_ = "";
00065         modified_(this);
00066       }
00067 
00068       inline miniXml::ustring getMicro ()
00069       {
00070         return getString (PROPERTY_MICRO);
00071       }
00072 
00073       inline miniXml::ustring getExtra ()
00074       {
00075         return getString (PROPERTY_EXTRA);
00076       }
00077 
00078       inline boost::filesystem::path getPrefix ()
00079       {
00080         return boost::filesystem::path(getString (PROPERTY_PREFIX),
00081                                        boost::filesystem::no_check);
00082       }
00083       
00084       inline int getSize ()
00085       {
00086         return getInteger (PROPERTY_SIZE);
00087       }
00088 
00089       inline miniXml::ustring getMicro () const
00090       {
00091         return getString (PROPERTY_MICRO);
00092       }
00093 
00094       inline miniXml::ustring getExtra () const
00095       {
00096         return getString (PROPERTY_EXTRA);
00097       }
00098 
00099       inline boost::filesystem::path getPrefix () const
00100       {
00101         return boost::filesystem::path(getString (PROPERTY_PREFIX),
00102                                        boost::filesystem::no_check);
00103       }
00104       
00105       inline int getSize () const
00106       {
00107         return getInteger (PROPERTY_SIZE);
00108       }
00109 
00110       bool operator< (const miniXml::ustring & version);
00111       bool operator<= (const miniXml::ustring & version);
00112     };
00113   }
00114 }
00115 
00116 #endif

Generated on Sat Mar 21 17:00:14 2009 for libSpm by  doxygen 1.5.2