Update of /cvsroot/mahogany/M/src/mail
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv23278/src/mail

Modified Files:
        MFPool.cpp 
Log Message:
slight cleanup: made global functions members of MFClassPool

Index: MFPool.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/MFPool.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -b -u -2 -r1.10 -r1.11
--- MFPool.cpp  12 Oct 2003 17:24:19 -0000      1.10
+++ MFPool.cpp  27 May 2006 15:13:56 -0000      1.11
@@ -42,10 +42,7 @@
 
 // ----------------------------------------------------------------------------
-// global module variables
+// MFConnection caches information about a single connection
 // ----------------------------------------------------------------------------
 
-// as MFPool is a singleton class we use the module globals instead of the
-// member static variables to reduce compilation dependencies
-
 // a cached folder connection
 struct MFConnection
@@ -62,13 +59,40 @@
 M_LIST_OWN(MFConnectionList, MFConnection);
 
+// ----------------------------------------------------------------------------
+// MFClassPool caches information about all connections for the given driver
+// ----------------------------------------------------------------------------
+
 // the pool of folders of one class
 struct MFClassPool
 {
-   String driverName;
+   // ctor for a new pool corresponding to the driver with the given name
+   MFClassPool(const String& driverName_) : driverName(driverName_) { }
+
+   // find the class pool for the given driver name
+   //
+   // returns NULL if not found
+   static MFClassPool *Find(const String& driverName);
+
+   // find the connection with the given spec in this pool
+   //
+   // returns NULL if not found
+   MFConnection *FindConnection(const String& spec) const;
+
+
+   const String driverName;
    MFConnectionList connections;
 
-   MFClassPool(const String& kind_) : driverName(kind_) { }
+
+   // no assignment operator because driverName is const
+   MFClassPool& operator=(const MFClassPool&);
 };
 
+// ----------------------------------------------------------------------------
+// global module variables
+// ----------------------------------------------------------------------------
+
+// as MFPool is a singleton class we use the module globals instead of the
+// member static variables to reduce compilation dependencies
+
 // the global pool is a linked list of class pools
 M_LIST_OWN(MFClassPoolList, MFClassPool) gs_pool;
@@ -130,22 +154,8 @@
 
 // ----------------------------------------------------------------------------
-// MFPool::Cookie
+// MFClassPool
 // ----------------------------------------------------------------------------
 
-MFPool::Cookie::Cookie()
-{
-   m_impl = new CookieImpl;
-}
-
-MFPool::Cookie::~Cookie()
-{
-   delete m_impl;
-}
-
-// ----------------------------------------------------------------------------
-// helper functions
-// ----------------------------------------------------------------------------
-
-static MFClassPool *FindClassPool(const String& driverName)
+MFClassPool *MFClassPool::Find(const String& driverName)
 {
    for ( MFClassPoolList::iterator i = gs_pool.begin();
@@ -160,11 +170,8 @@
 }
 
-static
-MFConnection *
-FindConnectionInPool(const MFClassPool *pool,
-                     const String& spec)
+MFConnection *MFClassPool::FindConnection(const String& spec) const
 {
-   for ( MFConnectionList::iterator i = pool->connections.begin();
-         i != pool->connections.end();
+   for ( MFConnectionList::iterator i = connections.begin();
+         i != connections.end();
          ++i )
    {
@@ -177,4 +184,18 @@
 
 // ----------------------------------------------------------------------------
+// MFPool::Cookie
+// ----------------------------------------------------------------------------
+
+MFPool::Cookie::Cookie()
+{
+   m_impl = new CookieImpl;
+}
+
+MFPool::Cookie::~Cookie()
+{
+   delete m_impl;
+}
+
+// ----------------------------------------------------------------------------
 // MFPool operations
 // ----------------------------------------------------------------------------
@@ -191,5 +212,5 @@
    const String driverName = wxConvertMB2WX(driver->GetName());
 
-   MFClassPool *pool = FindClassPool(driverName);
+   MFClassPool *pool = MFClassPool::Find(driverName);
    if ( !pool )
    {
@@ -202,5 +223,5 @@
    const String spec = driver->GetFullSpec(folder, login);
 
-   MFConnection *conn = FindConnectionInPool(pool, spec);
+   MFConnection *conn = pool->FindConnection(spec);
    CHECK_RET( !conn, _T("MFPool::Add(): folder already in the pool") );
 
@@ -218,5 +239,5 @@
    CHECK( driver, NULL, _T("MFPool::Find(): NULL driver") );
 
-   MFClassPool *pool = FindClassPool(wxConvertMB2WX(driver->GetName()));
+   MFClassPool *pool = MFClassPool::Find(wxConvertMB2WX(driver->GetName()));
    if ( !pool )
    {
@@ -225,6 +246,6 @@
    }
 
-   MFConnection *
-      conn = FindConnectionInPool(pool, driver->GetFullSpec(folder, login));
+   MFConnection * const
+      conn = pool->FindConnection(driver->GetFullSpec(folder, login));
 
    if ( !conn )



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to