本文整理汇总了C++中Profile::DecRef方法的典型用法代码示例。如果您正苦于以下问题:C++ Profile::DecRef方法的具体用法?C++ Profile::DecRef怎么用?C++ Profile::DecRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profile
的用法示例。
在下文中一共展示了Profile::DecRef方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Create
bool MFolderFromProfile::Create(const String& fullname)
{
// update the count of children in the immediate parent of the folder we're
// going to create
// split path into '/' separated components
wxArrayString components;
wxSplitPath(components, fullname);
bool updatedCount = false;
String path, component;
Profile *profile = Profile::CreateFolderProfile(wxEmptyString);
size_t n,
count = components.GetCount();
for ( n = 0; n < count; n++ )
{
CHECK( profile, false, _T("failed to create profile?") );
component = components[n];
if ( !updatedCount )
{
if ( profile->readEntryFromHere(component + _T('/') + MP_FOLDER_TYPE,
MF_ILLEGAL) == MF_ILLEGAL )
{
MFolderFromProfile *folder = (MFolderFromProfile *)MFolder::Get(path);
if ( !folder )
{
FAIL_MSG( _T("this folder must already exist!") );
}
else
{
// we have to invalidate it - unfortunately we can't just
// increase it because we may have a situation like this:
//
// 1. Create("a/b/c")
// 2. Create("a/b")
// 3. Create("a")
//
// and then, assuming 'a' hadn't existed before, the children
// count of the root folder would be incremented thrice even
// though only one new children was created
folder->m_nChildren = INVALID_CHILDREN_COUNT;
folder->DecRef();
}
// this is the the last existing folder for which we have anything to
// update
updatedCount = true;
}
}
// go down
if ( !path.empty() )
path += _T('/');
path += components[n];
profile->DecRef();
profile = Profile::CreateFolderProfile(path);
}
// we need to write something to this group to really create it
profile->writeEntry(MP_FOLDER_TYPE, MF_ILLEGAL);
profile->DecRef();
return true;
}