store.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 __STORE_H__
00022 #define __STORE_H__
00023 
00024 #include <boost/shared_ptr.hpp>
00025 #include <miniXml/ustring.h>
00026 
00027 namespace Spm
00028 {
00029   namespace Util
00030   {
00031     class PropertyList;
00032   }
00033   namespace Core
00034   {
00035     class PackageManager;
00036     class Element;
00037     class Category;
00038     class Branch;
00039     class InstalledVersion;
00040     class Package;
00041     class DependencyManager;
00042     class Dependency;
00043     class Versionned;
00044     class RepositeryManager;
00045     class Repositery;
00046     class FileSystemManager;
00047     struct fileSystemElement_;
00048 
00049     class ElementStore
00050     {
00051     protected:
00052       void add (PackageManager * pSystem,
00053                 Element * element);
00054       void add (Package * package,
00055                 InstalledVersion * iv,
00056                 PackageManager * pSystem);
00057       InstalledVersion * newInstalledVersion (Package * package,
00058                                               const miniXml::ustring & version,
00059                                               const miniXml::ustring & prefix);
00060       Package * newPackage (const miniXml::ustring & packageName);
00061     public:
00062       virtual ~ElementStore()
00063       {
00064       }
00065       virtual void init (PackageManager * pManager) = 0;
00066       virtual void store (PackageManager * pSystem) = 0;
00067       virtual void store (Element * element) = 0;
00068       virtual void store (Versionned * element) = 0;
00069       virtual void remove (Element * element) = 0;
00070       virtual void remove (Versionned * branch) = 0;
00071     };
00072     
00073     class CategoryStore
00074     {
00075     protected:
00076       void add (PackageManager * pSystem,
00077                 const miniXml::ustring & topCategoryName,
00078                 Category * category);
00079       void setCategoryUser (Category * category,
00080                             const miniXml::ustring & user);
00081     public:
00082       virtual ~CategoryStore()
00083       {
00084       }
00085       virtual void init (PackageManager * pManager) = 0;
00086       virtual void store (Category * category) = 0;
00087       virtual void store (PackageManager * pSystem) = 0;
00088       virtual void remove (Category * category) = 0;
00089     };
00090 
00091     class DependencyManagerStore
00092     {
00093     protected:
00094       void add (Dependency * dependency,
00095                 DependencyManager * pDependencyManager,
00096                 const boost::shared_ptr<PackageManager> & pSystem);
00097     public:
00098       virtual ~DependencyManagerStore()
00099       {
00100       }
00101       virtual void init (DependencyManager * pDependencyManager,
00102                          boost::shared_ptr<PackageManager> & pSystem) = 0;
00103       virtual void store (Dependency * dependency) = 0;
00104       virtual void store (DependencyManager * pDependencyManager) = 0;
00105       virtual void remove (Dependency * dependency) = 0;
00106     };
00107 
00108     class FileSystemManagerStore
00109     {
00110     protected:
00111       void add(const fileSystemElement_ & element,
00112                FileSystemManager * pFileSystemManager);
00113     public:
00114       virtual ~FileSystemManagerStore()
00115       {
00116       }
00117       virtual void init (FileSystemManager * pFileSystemManager) = 0;
00118       virtual void store (FileSystemManager * pFileSystemManager) = 0;
00119       virtual void store (InstalledVersion * version,
00120                           const miniXml::ustring & path) = 0;
00121       virtual void remove (InstalledVersion * version) = 0;
00122     };
00123 
00124     class RepositeryManagerStore
00125     {
00126     public:
00127       virtual ~RepositeryManagerStore ()
00128       {
00129       }
00130       virtual void init (RepositeryManager * pRepositeryManager) = 0;
00131       virtual void store (Repositery * repositery) = 0;
00132       virtual void store (RepositeryManager * pRepositeryManager) = 0;
00133       virtual void remove (Repositery * repositery) = 0;
00134     };
00135   }
00136 }
00137 
00138 #endif

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