|
From: Emilien K. <cur...@us...> - 2005-02-13 14:15:44
|
Update of /cvsroot/wxdevcenter/wxDevCenter/include/wxDevCenter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31497/include/wxDevCenter Modified Files: Config.h Log Message: Ajout du système de sous-configuration. Index: Config.h =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/include/wxDevCenter/Config.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Config.h 12 Feb 2005 16:54:34 -0000 1.2 --- Config.h 13 Feb 2005 14:15:26 -0000 1.3 *************** *** 26,29 **** --- 26,93 ---- #define __WXDEVCENTER_CONFIG + + #include <wx/confbase.h> + #include <wx/hashmap.h> + + /** Déclaration d'un dictionnaire de configurations pour stocker les configurations. + */ + WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxConfigBase*, wxConfigMap, class WXDC_DLL_BASE); + + + /** Classe de configuration nulle. + * Aucune donnée n'est enregistrée ni lue. + */ + class WXDC_DLL_BASE wxNullConfig : public wxConfigBase + { + public: + wxNullConfig(const wxString& WXUNUSED(appName) = wxEmptyString, + const wxString& WXUNUSED(vendorName) = wxEmptyString, + const wxString& WXUNUSED(localFilename) = wxEmptyString, + const wxString& WXUNUSED(globalFilename) = wxEmptyString, + long WXUNUSED(style) = wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_GLOBAL_FILE, + wxMBConv& WXUNUSED(conv) = wxConvUTF8) + { + } + + #if wxUSE_STREAMS + wxNullConfig(wxInputStream &WXUNUSED(inStream), wxMBConv& WXUNUSED(conv = wxConvUTF8)) {} + #endif + + virtual ~wxNullConfig() {} + + void SetUmask(int WXUNUSED(mode)) { } + virtual void SetPath(const wxString& WXUNUSED(strPath)) {} + virtual const wxString& GetPath() const { return wxEmptyString; } + virtual bool GetFirstGroup(wxString& WXUNUSED(str), long& WXUNUSED(lIndex)) const {return false;} + virtual bool GetNextGroup (wxString& WXUNUSED(str), long& WXUNUSED(lIndex)) const {return false;} + virtual bool GetFirstEntry(wxString& WXUNUSED(str), long& WXUNUSED(lIndex)) const {return false;} + virtual bool GetNextEntry (wxString& WXUNUSED(str), long& WXUNUSED(lIndex)) const {return false;} + virtual size_t GetNumberOfEntries(bool WXUNUSED(bRecursive) = false) const {return 0;} + virtual size_t GetNumberOfGroups(bool WXUNUSED(bRecursive) = false) const {return 0;} + virtual bool HasGroup(const wxString& WXUNUSED(strName)) const {return false;} + virtual bool HasEntry(const wxString& WXUNUSED(strName)) const {return false;} + virtual bool Flush(bool WXUNUSED(bCurrentOnly) = false) {return true;} + virtual bool RenameEntry(const wxString& WXUNUSED(oldName), const wxString& WXUNUSED(newName)) {return false;} + virtual bool RenameGroup(const wxString& WXUNUSED(oldName), const wxString& WXUNUSED(newName)) {return false;} + virtual bool DeleteEntry(const wxString& WXUNUSED(key), bool WXUNUSED(bGroupIfEmptyAlso) = true) {return false;} + virtual bool DeleteGroup(const wxString& WXUNUSED(szKey)) {return false;} + virtual bool DeleteAll() {return false;} + + #if wxUSE_STREAMS + virtual bool Save(wxOutputStream& WXUNUSED(os), wxMBConv& WXUNUSED(conv) = wxConvUTF8) {return true;} + #endif + + protected: + virtual bool DoReadString(const wxString& WXUNUSED(key), wxString *WXUNUSED(pStr)) const {return false;} + virtual bool DoReadLong(const wxString& WXUNUSED(key), long *WXUNUSED(pl)) const {return false;} + virtual bool DoWriteString(const wxString& WXUNUSED(key), const wxString& WXUNUSED(szValue)) {return false;} + virtual bool DoWriteLong(const wxString& WXUNUSED(key), long WXUNUSED(lValue)) {return false;} + + DECLARE_NO_COPY_CLASS(wxNullConfig) + }; + + + + namespace wxDevCenter { *************** *** 95,98 **** --- 159,187 ---- virtual void CreateUserProfile()=0; /** @} */ + + + /** @name Sous-configurations + * Configurations des sous modules et des plugins. + * @{ */ + /** Retourne un accesseur sur la sous-configuration voulue. + * @param strSubConfName Nom de la sous-configuration à retourner. + * @return Accesseur sur la sous-configuration.*/ + virtual wxConfigBase& GetSubConfig(wxString strSubConfName); + /** Opérateur d'accesseur sur les sous-configurations. + * @param strSubConfName Nom de la sous-configuration à retourner. + * @return Accesseur sur la sous-configuration.*/ + virtual wxConfigBase& operator[](wxString strSubConfName){return GetSubConfig(strSubConfName);} + protected: + /** Crée une sous-configuration et la place dans le dictionnaire. + * @param strSubConfName Nom de la sous-configuration à créer. + * @return True si sous-configuration crée avec succes.*/ + virtual bool CreateSubConfig(wxString strSubConfName); + /** Dictionnaire des sous-configurations.*/ + wxConfigMap m_SubConfigMap; + /** Sous-configuration nulle.*/ + static wxNullConfig m_ConfigNull; + /** @} */ + + }; |