Revision: 7445
          http://mahogany.svn.sourceforge.net/mahogany/?rev=7445&view=rev
Author:   vadz
Date:     2008-05-01 18:13:17 -0700 (Thu, 01 May 2008)

Log Message:
-----------
added convenient ProfileHolder helper class

Modified Paths:
--------------
    trunk/M/include/Profile.h

Modified: trunk/M/include/Profile.h
===================================================================
--- trunk/M/include/Profile.h   2008-05-02 00:40:02 UTC (rev 7444)
+++ trunk/M/include/Profile.h   2008-05-02 01:13:17 UTC (rev 7445)
@@ -443,6 +443,28 @@
 };
 
 // ----------------------------------------------------------------------------
+// a helper class which doesn't take ownership of Profile (unlike Profile_obj)
+// but ensures that it's kept alive during its own lifetime
+// ----------------------------------------------------------------------------
+
+class ProfileHolder
+{
+public:
+   ProfileHolder(Profile *profile) : m_profile(profile) { SafeIncRef(profile); 
}
+   ~ProfileHolder() { SafeDecRef(m_profile); }
+
+   // don't DecRef() the pointer returned by this method
+   Profile *GetProfile() const { return m_profile; }
+
+protected:
+   Profile * const m_profile;
+
+private:
+   ProfileHolder(const ProfileHolder&);
+   ProfileHolder& operator=(const ProfileHolder&);
+};
+
+// ----------------------------------------------------------------------------
 // a small class to temporarily suspend env var expansion
 // ----------------------------------------------------------------------------
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to