infoInterface.h

Go to the documentation of this file.
00001 /* -*- Mode: c++ -*- */
00002 /*
00003  *  this is part of Spm
00004  *
00005  *  Copyright (c) 2005-2007 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 __INFO_INTERFACE_H__
00022 #define __INFO_INTERFACE_H__
00023 
00024 #include "interface.h"
00025 #include <util/net.h>
00026 #include <vector>
00027 
00028 #define SPM_INFO_PLUGIN(plugin)                                         \
00029   extern "C"                                                            \
00030   {                                                                     \
00031     Spm::Plugin::pluginDescription_t getSpmPluginDescription ()         \
00032     {                                                                   \
00033       return plugin ().getDescription ();                               \
00034     }                                                                   \
00035                                                                         \
00036     plugin * getSpmPlugin (const miniXml::ustring & url)                \
00037     {                                                                   \
00038       return new plugin (url);                                          \
00039     }                                                                   \
00040                                                                         \
00041     plugin * getSpmPluginInfo ()                                        \
00042     {                                                                   \
00043       return new plugin ();                                             \
00044     }                                                                   \
00045   }
00046 
00047 namespace Spm
00048 {
00049   namespace Plugin
00050   {
00055     class InfoInterface : public Interface
00056     {
00057     public:
00058       struct element;
00063       struct version
00064       {
00065         element * parent_;
00066         miniXml::ustring version_;
00067         std::vector<miniXml::ustring> urls_;
00068         version * replaced_;
00069       };
00070 
00075       struct element
00076       {
00077         miniXml::ustring element_;
00078         miniXml::ustring description_;
00079         miniXml::ustring homePage_;
00080         std::vector<version *> versions_;
00081       };
00082 
00087       struct set : public element
00088       {
00089         std::vector<element *> elements_;
00090       };
00091 
00096       struct package : public element
00097       {
00098         std::map<version *,
00099                  std::vector<version *> > requiredDependencys_;
00100         std::map<version *,
00101                  std::vector<version *> > recommendedDependencys_;
00102         std::map<version *,
00103                  std::vector<version *> > optionalDependencys_; 
00104       };
00105 
00106     protected:
00107       miniXml::ustring url_;
00108 
00109       InfoInterface () : Interface ()
00110       {
00111       }
00112 
00113     public:
00114       InfoInterface (const miniXml::ustring & url) : url_(url)
00115       {
00116       }
00117       
00123       virtual void listAll (std::vector<element *> & elements,
00124                             int modifiedSince) = 0;
00125     };
00126   }
00127 }
00128 
00129 #endif

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