category.h

Go to the documentation of this file.
00001 /* -*- Mode: c++ -*- */
00002 /*
00003  *  this is part of Spm
00004  *
00005  *  Copyright (c) 2003-2006 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 __CATEGORY_H__
00022 #define __CATEGORY_H__
00023 
00024 #include <list>
00025 #include "coreException.h"
00026 #include <util/object.h>
00027 
00028 namespace Spm
00029 {
00030   namespace Core
00031   {
00032     class Category : public Util::Object
00033     {
00034     public :
00035       friend class CategoryStore;
00036       typedef std::list<Category *>::iterator iterator;
00037       typedef std::list<Category *>::const_iterator const_iterator;
00038 
00039       typedef std::list<Category *>::reverse_iterator reverse_iterator;
00040       typedef std::list<Category *>::const_reverse_iterator const_reverse_iterator;
00041 
00042     private :
00043       friend class PackageSystem;
00044       std::list<Category *> categorys_;
00045       Category * topCategory_;
00046 
00047     public :
00048       Category();
00052       Category (const miniXml::ustring & categoryName);
00053 
00054       ~Category ();
00055 
00059       void add (Category * aSubCategory);
00063       Category * remove (const miniXml::ustring & aSubCategory);
00068       const Category * getCategory (const miniXml::ustring & aSubCategory);
00069 
00073       const std::list<Category *> & getCategorys ();
00074 
00078       miniXml::ustring getCompleteName ();
00079 
00083       miniXml::ustring getCompleteName () const;
00084 
00088       void setName (const miniXml::ustring & aName);
00089 
00093       void setTopCategory (const Category * category);
00094 
00098       const Category * getTopCategory ();
00099       const Category * getTopCategory () const;
00100       
00101       inline iterator begin ()
00102       {
00103         return categorys_.begin ();
00104       }
00105 
00106       inline reverse_iterator rbegin ()
00107       {
00108         return categorys_.rbegin ();
00109       }
00110 
00111       inline iterator end ()
00112       {
00113         return categorys_.end ();
00114       }
00115 
00116       inline reverse_iterator rend ()
00117       {
00118         return categorys_.rend ();
00119       }
00120 
00121       inline const_iterator begin () const
00122       {
00123         return categorys_.begin ();
00124       }
00125 
00126       inline const_reverse_iterator rbegin () const
00127       {
00128         return categorys_.rbegin ();
00129       }
00130 
00131       inline const_iterator end () const
00132       {
00133         return categorys_.end ();
00134       }
00135 
00136       inline const_reverse_iterator rend () const
00137       {
00138         return categorys_.rend ();
00139       }
00140 
00141       bool operator< (const Category * p) const;
00142       bool operator< (const Category & p) const;
00143     };
00144 
00145     struct equalCategory : public std::binary_function<Category *, miniXml::ustring, bool>
00146     {
00147       bool operator() (Category * category,
00148                        const miniXml::ustring & categoryName) const;
00149     };
00150   }
00151 }
00152 #endif

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