Update of /cvsroot/mahogany/M/include
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29298/include
Modified Files:
ConfigSourcesAll.h
Log Message:
made AllConfigSources a singleton
Index: ConfigSourcesAll.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/ConfigSourcesAll.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -u -2 -r1.1 -r1.2
--- ConfigSourcesAll.h 4 Jul 2005 20:53:33 -0000 1.1
+++ ConfigSourcesAll.h 5 Jul 2005 12:34:35 -0000 1.2
@@ -32,5 +32,5 @@
/**
- Constructor fully initializes the config sources list.
+ Static ctor: fully initializes the config sources list.
In order to do this, it first creates the main local config source. It
@@ -44,6 +44,11 @@
@param filename the file used for the default config, may be empty
+ @return the pointer to global AllConfigSources object, same as returned
+ by Get() from now on
*/
- AllConfigSources(const String& filename);
+ static AllConfigSources *Init(const String& filename)
+ {
+ return ms_theInstance = new AllConfigSources(filename);
+ }
/**
@@ -167,14 +172,31 @@
/**
- @name Helper methods for wxConfigMultiplexer only.
+ @name Accessors to config sources themselves.
- Do not use these methods from elsewhere.
+ These methods shouldn't be normally used directly but currently are for
+ configuring the sources list.
*/
//@{
+ /// Get this object itself (created on demand)
+ static AllConfigSources& Get() { return *ms_theInstance; }
+
/// Get the list of all sources
List& GetSources() { return m_sources; }
const List& GetSources() const { return m_sources; }
+ /// Delete the global AllConfigSources object returned by Get()
+ static void Cleanup() { delete ms_theInstance; ms_theInstance = NULL; }
+
+ //@}
+
+
+ /**
+ @name Helper methods for wxConfigMultiplexer only.
+
+ Do not use these methods from elsewhere.
+ */
+ //@{
+
/// Find the config source containing this entry
List::iterator FindEntry(const String& path) const;
@@ -193,4 +215,7 @@
private:
+ // ctor is private, use public static Init() instead
+ AllConfigSources(const String& filename);
+
// public CopyGroup() helper
bool CopyGroup(ConfigSource *config,
@@ -200,4 +225,6 @@
List m_sources;
+ static AllConfigSources *ms_theInstance;
+
DECLARE_NO_COPY_CLASS(AllConfigSources)
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates