Update of /cvsroot/mahogany/M/src/classes
In directory sc8-pr-cvs1:/tmp/cvs-serv31533/src/classes
Modified Files:
Profile.cpp
Log Message:
added CreateTemp()
Index: Profile.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/classes/Profile.cpp,v
retrieving revision 1.151
retrieving revision 1.152
diff -b -u -2 -r1.151 -r1.152
--- Profile.cpp 3 Oct 2003 12:50:57 -0000 1.151
+++ Profile.cpp 7 Oct 2003 22:49:40 -0000 1.152
@@ -647,4 +647,44 @@
};
+/**
+ Temporary profile.
+
+ This class is a subtree of its parent profile and it deletes this subtree
+ from config when it is itself deleted.
+ */
+class TempProfile : public ProfileImpl
+{
+public:
+ TempProfile(Profile *parent)
+ {
+ if ( !parent )
+ parent = mApplication->GetProfile();
+
+ // find the first unused temporary name
+ for( int n = 0; ; n++ )
+ {
+ m_name.Printf(_T("__Temp%d__"), n);
+ if ( !parent->HasGroup(m_name) )
+ break;
+ }
+
+ m_parent = parent;
+ m_parent->IncRef();
+
+ m_ProfileName << GetRootPath() << _T('/') << m_name;
+ }
+
+ ~TempProfile()
+ {
+ m_parent->DeleteGroup(m_name);
+ m_parent->DecRef();
+ }
+
+private:
+ Profile *m_parent;
+
+ String m_name;
+};
+
// ============================================================================
// AllConfigSources implementation
@@ -1148,4 +1188,10 @@
{
return CreateProfile(foldername);
+}
+
+Profile *
+Profile::CreateTemp(Profile *parent)
+{
+ return new TempProfile(parent);
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates