当前位置: 首页>>代码示例>>C++>>正文


C++ Profile::DecRef方法代码示例

本文整理汇总了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;
}
开发者ID:mark711,项目名称:mahogany,代码行数:72,代码来源:MFolder.cpp


注:本文中的Profile::DecRef方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。