本文整理汇总了C++中CChars::Empty方法的典型用法代码示例。如果您正苦于以下问题:C++ CChars::Empty方法的具体用法?C++ CChars::Empty怎么用?C++ CChars::Empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CChars
的用法示例。
在下文中一共展示了CChars::Empty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Split
//////////////////////////////////////////////////////////////////////////
// //
// //
//////////////////////////////////////////////////////////////////////////
BOOL CArrayString::Split(char* szString, char cSplitter)
{
CChars szTemp;
szTemp.Init(szString);
if (!szTemp.Empty())
{
szTemp.Split(this, cSplitter);
szTemp.Kill();
return TRUE;
}
else
{
return FALSE;
}
}
示例2: ImportCelSource
BOOL CImageCelsSourceXML::ImportCelSource(CMarkupTag* pcBrushSourceTag, char* szTexturePath)
{
CMarkupTag* pcFileName;
CChars szFileName;
CChars szShortFileName;
BOOL bResult;
CMarkupTag* pcCels;
CFileUtil cFileUtil;
pcFileName = CMarkupTextParser::GetTag(pcBrushSourceTag, "FileName");
if (!pcFileName)
{
return FALSE;
}
szShortFileName.Init();
pcFileName->GetText(&szShortFileName);
if (szFileName.Empty())
{
szShortFileName.Kill();
CMarkupTextParser::LogErrorTagWasEmpty(pcBrushSourceTag);
return FALSE;
}
pcCels = CMarkupTextParser::GetTag(pcBrushSourceTag, "Cels");
if (!pcCels)
{
szShortFileName.Kill();
return FALSE;
}
szFileName.Init(szTexturePath);
cFileUtil.AppendToPath(&szFileName, szShortFileName.Text());
bResult = ImportCels(pcCels, szFileName.Text());
return bResult;
}
示例3: ImportImage
BOOL CObjectSourcesXML::ImportImage(CTileType* pcType, CMarkupTag* pcTag)
{
CMarkupTag* pcName;
CMarkupTag* pcCelIndex;
CMarkupTag* pcBrushID;
CMarkupTag* pcSourceName;
CMarkupTag* pcProperties;
CChars szName;
int iCelIndex;
int iBrushID;
CChars szSourceName;
CTileImageCel* pcTile;
Ptr<CImageCelGroup> pcGroup;
CImageCel* pcCel;
pcName = CMarkupTextParser::GetTag(pcTag, "Name");
if (!pcName)
{
return FALSE;
}
pcCelIndex = CMarkupTextParser::GetTag(pcTag, "CelIndex");
if (!pcCelIndex)
{
return FALSE;
}
pcBrushID = CMarkupTextParser::GetTag(pcTag, "BrushID");
if (!pcBrushID)
{
return FALSE;
}
pcSourceName = CMarkupTextParser::GetTag(pcTag, "SourceName");
if (!pcSourceName)
{
return FALSE;
}
pcProperties = CMarkupTextParser::GetTag(pcTag, "Properties");
szName.Init();
pcName->GetText(&szName);
if (!CMarkupTextParser::ReadInteger(pcCelIndex, &iCelIndex))
{
szName.Kill();
return FALSE;
}
if (!CMarkupTextParser::ReadInteger(pcBrushID, &iBrushID))
{
szName.Kill();
return FALSE;
}
szSourceName.Init();
pcSourceName->GetText(&szSourceName);
if (szSourceName.Empty())
{
CMarkupTextParser::LogErrorTagWasEmpty(pcSourceName);
szName.Kill();
szSourceName.Kill();
return FALSE;
}
pcGroup = mpcWorld->GetGroup(szSourceName.Text());
if (!pcGroup)
{
szName.Kill();
szSourceName.Kill();
gcLogger.Error("Couldn't find Cel Group.");
return FALSE;
}
pcCel = pcGroup->GetCel(iCelIndex);
if (!pcCel)
{
szName.Kill();
szSourceName.Kill();
gcLogger.Error("Couldn't find Cel.");
return FALSE;
}
pcTile = UMalloc(CTileImageCel);
pcTile->Init(pcCel, pcType, szName.Text());
pcType->AddTile(pcTile);
return TRUE;
}
示例4: ImportTiles
BOOL CTileMapXML::ImportTiles(CMarkupTag* pcTag, CTileLayer* pcLayer)
{
CChars szCSV;
CCSVFileImmutable cCSVFile;
CMemoryFile cMemoryFile;
int iRow;
SCSVRowImmutable* psRow;
int i;
char* szCelIndex;
CTextParser cTextParser;
TRISTATE tResult;
int iCelIndex;
CChars szError;
CTile* pcTile;
szCSV.Init(128);
pcTag->GetText(&szCSV);
if (szCSV.Empty())
{
szCSV.Kill();
CMarkupTextParser::LogErrorTagWasEmpty(pcTag);
return FALSE;
}
szCSV.StripWhiteSpace(TRUE);
//szCSV.Replace(" ", ""); //Write a test for this, why does it not work?
cMemoryFile.Init(szCSV.Text(), szCSV.Length());
cCSVFile.Init(',');
cCSVFile.Open(&cMemoryFile);
cCSVFile.ReadAllLines();
for (iRow = 0; iRow < cCSVFile.NumRows(); iRow++)
{
psRow = cCSVFile.Get(iRow);
for (i = 0; i < psRow->iNumFields; i++)
{
szCelIndex = psRow->Get(i);
cTextParser.Init(szCelIndex);
tResult = cTextParser.GetInteger(&iCelIndex);
if (tResult != TRITRUE)
{
szError.Init("CSV cell [");
szError.Append(i);
szError.Append(", ");
szError.Append(iRow);
szError.Append("] could not be parsed as an integer.");
CMarkupTextParser::LogError(pcTag, szError.Text());
szError.Kill();
cCSVFile.Close();
cMemoryFile.Kill();
szCSV.Kill();
return FALSE;
}
pcTile = pcLayer->mpcTileType->Get(iCelIndex);
if (pcTile)
{
pcLayer->Set(i, iRow, pcTile);
}
}
}
cCSVFile.Close();
cMemoryFile.Kill();
szCSV.Kill();
return TRUE;
}
示例5: ImportLayer
BOOL CTileMapXML::ImportLayer(CMarkupTag* pcTag, CTileMap* pcMap)
{
CMarkupTag* pcName;
CMarkupTag* pcObjectClass;
CMarkupTag* pcTiles;
CChars szName;
CChars szObjectClass;
BOOL bResult;
CTileType* pcType;
CTileLayer* pcLayer;
pcName = CMarkupTextParser::GetTag(pcTag, "Name");
if (!pcName)
{
return FALSE;
}
pcObjectClass = CMarkupTextParser::GetTag(pcTag, "ObjectClass");
if (!pcObjectClass)
{
return FALSE;
}
pcTiles = CMarkupTextParser::GetTag(pcTag, "Tiles");
if (!pcTiles)
{
return FALSE;
}
szName.Init();
pcName->GetText(&szName);
if (szName.Empty())
{
szName.Kill();
CMarkupTextParser::LogErrorTagWasEmpty(pcName);
return FALSE;
}
szObjectClass.Init();
pcObjectClass->GetText(&szObjectClass);
if (szObjectClass.Empty())
{
szName.Kill();
szObjectClass.Kill();
CMarkupTextParser::LogErrorTagWasEmpty(pcObjectClass);
return FALSE;
}
pcType = mpcWorld->GetType(szObjectClass.Text());
if (!pcType)
{
CMarkupTextParser::LogError(pcObjectClass, "Could not find a TileType for Tag.");
return FALSE;
}
pcLayer = pcMap->AddLayer(szName.Text(), pcType);
bResult = ImportTiles(pcTiles, pcLayer);
szObjectClass.Kill();
szName.Kill();
return bResult;
}
示例6: ImportMap
BOOL CTileMapXML::ImportMap(CMarkupTag* pcTag)
{
CMarkupTag* pcTileMap;
CMarkupTag* pcName;
CMarkupTag* pcCelWidth;
CMarkupTag* pcCelHeight;
BOOL bResult;
CChars szName;
int iCelWidth;
int iCelHeight;
CTileMap* pcMap;
pcTileMap = CMarkupTextParser::GetTag(pcTag, "TileMap");
if (!pcTileMap)
{
return FALSE;
}
pcName = CMarkupTextParser::GetTag(pcTag, "Name");
if (!pcName)
{
return FALSE;
}
pcCelWidth = CMarkupTextParser::GetTag(pcTag, "CelWidth");
if (!pcCelWidth)
{
return FALSE;
}
pcCelHeight = CMarkupTextParser::GetTag(pcTag, "CelHeight");
if (!pcCelHeight)
{
return FALSE;
}
if (!CMarkupTextParser::ReadInteger(pcCelWidth, &iCelWidth))
{
return FALSE;
}
if (!CMarkupTextParser::ReadInteger(pcCelHeight, &iCelHeight))
{
return FALSE;
}
szName.Init();
pcName->GetText(&szName);
if (szName.Empty())
{
szName.Kill();
CMarkupTextParser::LogErrorTagWasEmpty(pcName);
return FALSE;
}
pcMap = mpcWorld->AddMap(szName.Text(), iCelWidth, iCelHeight);
bResult = ImportMap2(pcTileMap, pcMap);
if (!bResult)
{
return FALSE;
}
szName.Kill();
return TRUE;
}