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


C++ CButeMgr::Save方法代码示例

本文整理汇总了C++中CButeMgr::Save方法的典型用法代码示例。如果您正苦于以下问题:C++ CButeMgr::Save方法的具体用法?C++ CButeMgr::Save怎么用?C++ CButeMgr::Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CButeMgr的用法示例。


在下文中一共展示了CButeMgr::Save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: WriteBans

bool BanIPMgr_Impl::WriteBans( )
{
	// If not initialized, we can't write out the bans yet.
	if( !m_bInitialized )
		  

		return false;

	CButeMgr banBute;
	char szBanKey[128] = "";
	char szClientIP[16] = "";
	int nBanIndex = 0;

	// Look through list of banned ip's.
	for( BanList::iterator iter = m_BanList.begin( ); iter != m_BanList.end( ); iter++ )
	{
		ClientIP const& bannedIP = *iter;

		// Convert it to a string.
		if( !ConvertClientIPToString( bannedIP, szClientIP, ARRAY_LEN( szClientIP )))
			return false;

		// Write the banned IP.
		sprintf( szBanKey, "Ban%d", nBanIndex );
		banBute.SetString( "Bans", szBanKey, szClientIP );

		nBanIndex++;
	}

	// Save the list.
	banBute.Save( "BanList.txt" );

	return true;
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:34,代码来源:BanIPMgr.cpp

示例2: _tmain


//.........这里部分代码省略.........
		CFile file;
		if (!file.Open(lpszButeFilename, CFile::modeCreate | CFile::modeNoTruncate))
		{
			printf("Error: Unable to open the file: %s\r\n", lpszButeFilename);
			return 1;
		}
		file.Close();
	}

	// Initialize ButeMgr	
	CButeMgr buteMgr;
	buteMgr.Init(MessageDisplay);

	// Parse the file
	if (!buteMgr.Parse(lpszButeFilename))
	{
		return 1;
	}		

	// Indicate that properties are being added
	printf("Adding properties...\r\n");

	// Get the classes
	int nClasses=cb_GetNumClassDefs(hModule);
	ClassDef **pClasses=cb_GetClassDefs(hModule);

	// Go through each class
	int i;
	for (i=0; i < nClasses; i++)
	{
		// This turns to TRUE once a property for this class has been added
		BOOL bClassAdded=FALSE;

		// Get the class name
		const char *lpszClassName=pClasses[i]->m_ClassName;
		
		CString sTagName;
		sTagName.Format("%s", lpszClassName);

		// Check to see if the description exists
		if (!buteMgr.Exist(sTagName, "ClassDescription"))
		{
			// Add the description
			buteMgr.SetString(sTagName, "ClassDescription", "");

			// Display that this was added
			if (!bClassAdded)
			{
				printf("\r\n[%s]\r\n", sTagName);
				bClassAdded=TRUE;
			}
			printf("ClassDescription\r\n");
		}

		// Add the properties
		AddClassProperties(pClasses[i], sTagName, bClassAdded, buteMgr);		
	}	

	// Get the tags in the bute file
	CStringArray tagArray;
	buteMgr.GetTags(GetTagsCallback, (void *)&tagArray);

	// This indicates if the old tag header has been printed
	BOOL bOldTagHeader=FALSE;

	// Find the classes that are in the bute file but aren't in the object.lto file	
	for (i=0; i < tagArray.GetSize(); i++)
	{
		BOOL bFound=FALSE;

		// Search the classes
		int n;
		for (n=0; n < nClasses; n++)
		{
			if (tagArray[i] == pClasses[n]->m_ClassName)
			{
				bFound=TRUE;
				break;
			}
		}

		// Print out the name if it hasn't been found
		if (!bFound)
		{
			// Print the old tag header if needed
			if (!bOldTagHeader)
			{
				printf("\r\nThese classes do not exist in the object.lto file:\r\n");
				bOldTagHeader=TRUE;
			}
			printf("%s\r\n", tagArray[i]);
		}
	}

	// Save the bute file
	buteMgr.Save();

	printf("\r\nSuccess!\r\n");
	return 0;
}
开发者ID:Joincheng,项目名称:lithtech,代码行数:101,代码来源:PropHelpGen.cpp


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