本文整理汇总了C++中CChars::Length方法的典型用法代码示例。如果您正苦于以下问题:C++ CChars::Length方法的具体用法?C++ CChars::Length怎么用?C++ CChars::Length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CChars
的用法示例。
在下文中一共展示了CChars::Length方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Difference
void CChars::Difference(CArrayInt* paiNewToOldIndices, CArrayInt* paiOldToNewIndices, CChars szOldString)
{
int i;
int j;
CChars cTemp;
char cNew;
char cOld;
//This will find the index of each character in this string in the old string.
paiOldToNewIndices->SetUsedElements(szOldString.Length());
paiOldToNewIndices->SetArrayValues(-1);
paiNewToOldIndices->SetUsedElements(Length());
paiNewToOldIndices->SetArrayValues(-1);
cTemp.Init(szOldString);
for (j = 0; j < Length(); j++)
{
cNew = GetChar(j);
for (i = 0; i < cTemp.Length(); i++)
{
cOld = cTemp.GetChar(i);
if (cOld == cNew)
{
cTemp.SetChar(i, 1);
paiOldToNewIndices->SetValue(i, j);
paiNewToOldIndices->SetValue(j, i);
break;
}
}
}
cTemp.Kill();
}
示例2: QuoteTokens
//////////////////////////////////////////////////////////////////////////
// //
// //
//////////////////////////////////////////////////////////////////////////
CPPToken* CPreprocessor::QuoteTokens(CPPTokenHolder* pcDest, CPPAbstractHolder* pcHolder)
{
int j;
BOOL bQuoteNextReplacement;
CChars szQuoted;
char* szInStrings;
CPPText* pcQuoted;
CPPToken* pcToken;
szQuoted.Init(100);
szQuoted.Append('"');
for (j = 0; j < pcHolder->mcTokens.mcArray.NumElements(); j++)
{
pcToken = *(pcHolder->mcTokens.mcArray.Get(j));
pcToken->Append(&szQuoted);
}
szQuoted.Append('"');
bQuoteNextReplacement = FALSE;
szInStrings = (char*)gcTokenStrings.Add(szQuoted.Length()+1);
memcpy(szInStrings, szQuoted.Text(), szQuoted.Length()+1);
pcQuoted = CPPText::Construct(mpcStack->Add(sizeof(CPPText)));
pcQuoted->Init(PPT_DoubleQuoted, -1, -1, szInStrings, szInStrings+szQuoted.Length());
pcDest->Add((CPPToken**)&pcQuoted);
szQuoted.Kill();
return pcQuoted;
}
示例3: RightAlign
void CChars::RightAlign(CChars sz, char cPadCharacter, int iWidth)
{
if (sz.Length() <= iWidth)
{
Append(cPadCharacter, iWidth-sz.Length());
Append(sz);
}
else
{
AppendSubString(sz, 0, iWidth);
}
}
示例4: DumpFroms
void CBaseObject::DumpFroms(void)
{
CChars sz;
int i;
int iNumEmbedded;
CEmbeddedObject* pcEmbedded;
int j;
int iNumHeapFroms;
CBaseObject* pcFromObject;
int iLength;
CChars szLine;
sz.Init();
sz.Append("-- ");
PrintObject(&sz);
sz.Append(" --\n");
iLength = sz.Length()-1;
szLine.Init('-', iLength);
szLine.AppendNewLine();
sz.Insert(0, &szLine);
sz.Append("Total Heap Froms [");
sz.Append(NumHeapFroms());
sz.Append("], ");
sz.Append("Stack Froms [");
sz.Append(NumStackFroms());
sz.Append("]\n");
iNumEmbedded = GetNumEmbedded();
for (i = 0; i < iNumEmbedded; i++)
{
pcEmbedded = GetEmbeddedObject(i);
iNumHeapFroms = pcEmbedded->CEmbeddedObject::NumHeapFroms();
sz.Append("Embedded ");
sz.Append(i);
sz.Append(" Heap Froms [");
sz.Append(iNumHeapFroms);
sz.Append("], ");
sz.Append("Stack Froms [");
sz.Append(pcEmbedded->CEmbeddedObject::NumStackFroms());
sz.Append("]\n");
for (j = 0; j < iNumHeapFroms; j++)
{
pcFromObject = pcEmbedded->GetHeapFrom(j);
sz.Append(" ");
pcFromObject->PrintObject(&sz);
sz.AppendNewLine();
}
}
sz.Append(&szLine);
szLine.Kill();
sz.Dump();
sz.Kill();
}
示例5: AddPackFile
//////////////////////////////////////////////////////////////////////////
// //
// //
//////////////////////////////////////////////////////////////////////////
BOOL CFiles::AddPackFile(CFileNodeSystemFile* pcFileNodeSystemFile)
{
CPackFileOffset* pcPackFiles;
char* szFullName;
CChars szPackFileOffset;
CChars* pszFullDirectory;
int iLength;
BOOL bResult;
int iRank;
pszFullDirectory = mcFileSystem.GetFullDirectoryName();
iLength = mszPackFilesExtension.Length()+1;
pcPackFiles = mcPackFilesArray.Add();
new(pcPackFiles) CPackFileOffset();
szFullName = pcFileNodeSystemFile->GetFullName();
szPackFileOffset.Init(szFullName);
szPackFileOffset.RemoveFromStart(pszFullDirectory->Length()+1);
szPackFileOffset.RemoveFromEnd(iLength);
szPackFileOffset.Replace('\\', '/');
iRank = szPackFileOffset.Count('/');
bResult = pcPackFiles->Init(szPackFileOffset.Text(), szFullName, iRank);
szPackFileOffset.Kill();
return bResult;
}
示例6: Set
void CChars::Set(CChars sz)
{
int iLen;
iLen = sz.Length()+1;
mcText.Resize(iLen);
memcpy(mcText.GetData(), sz.Text(), iLen);
}
示例7: ConcaternateTokens
//////////////////////////////////////////////////////////////////////////
// //
// //
//////////////////////////////////////////////////////////////////////////
CPPToken* CPreprocessor::ConcaternateTokens(CPPTokenHolder* pcDest, CPPToken* pcLeft, CPPToken* pcRight)
{
CPPText* pcLeftText;
CPPText* pcRightText;
CChars szConcaternated;
char* szInStrings;
if (pcLeft->IsText() && pcRight->IsText())
{
pcLeftText = (CPPText*)pcLeft;
pcRightText = (CPPText*)pcRight;
if (((pcLeftText->meType == PPT_Identifier) && (pcRightText->meType == PPT_Identifier)) ||
((pcLeftText->meType == PPT_Number) && (pcRightText->meType == PPT_Number)))
{
szConcaternated.Init(100);
pcLeftText->Append(&szConcaternated);
pcRightText->Append(&szConcaternated);
szInStrings = (char*)gcTokenStrings.Add(szConcaternated.Length()+1);
memcpy(szInStrings, szConcaternated.Text(), szConcaternated.Length()+1);
pcLeftText->mcText.msz = szInStrings;
pcLeftText->mcText.miLen = szConcaternated.Length();
szConcaternated.Kill();
return pcLeft;
}
else
{
pcDest->Add(&pcRight);
return pcRight;
}
}
return pcLeft;
}
示例8: Paste
void CPlainTextEditor::Paste(char* szSource)
{
CChars szTemp;
if (!IsSelected())
{
szTemp.Init(szSource);
szTemp.PassifyNewlines();
mszText.Insert(miEditPos, &szTemp);
miEditPos += szTemp.Length();
szTemp.Kill();
ResetUpDown();
}
else
{
OverwriteSelection(szSource);
}
}
示例9: DataFileName
BOOL CTransientIndexedFile::DataFileName(char* szFile1, int iDataSize, int iFileNum)
{
CChars szFileName;
szFileName.Init(mszDirectory);
szFileName.Append(FILE_SEPARATOR);
szFileName.Append(iDataSize);
szFileName.Append("_");
szFileName.Append(iFileNum);
szFileName.Append(".DAT");
if (szFileName.Length() < 65536)
{
strcpy(szFile1, szFileName.Text());
szFileName.Kill();
return TRUE;
}
szFileName.Kill();
return FALSE;
}
示例10: InitList
void CChars::InitList(CChars* szFirst, ...)
{
mcText.Init();
Set("");
va_list vaMarker;
CChars* pc;
int iCount;
iCount = 0;
pc = szFirst;
va_start(vaMarker, szFirst);
while (pc->Length() != 0)
{
Append(pc->Text());
iCount++;
pc = va_arg(vaMarker, CChars*);
}
va_end(vaMarker);
}
示例11: GetSystemFile
CDiskFile* CFiles::GetSystemFile(char* szFullName)
{
CChars szRemain;
CFileNodeSystemFile* pcNode;
char* szName;
CDiskFile* pcDiskFile;
szRemain.Init();
pcNode = mcFileSystem.GetFileNode(szFullName, &szRemain);
if (pcNode)
{
if (szRemain.Length() == 0)
{
szName = pcNode->GetFullName();
pcDiskFile = DiskFile(szName);
szRemain.Kill();
return pcDiskFile;
}
szRemain.Kill();
}
return NULL;
}
示例12: DumpPointerTos
void CBaseObject::DumpPointerTos(void)
{
CChars sz;
int i;
int iNumEmbedded;
CEmbeddedObject* pcEmbedded;
int j;
int iNumTos;
CEmbeddedObject** ppcToObject;
int iLength;
CChars szLine;
CArrayTemplateEmbeddedObjectPtr acTos;
CBaseObject* pcToObject;
int iTotalTos;
sz.Init();
sz.Append("-- ");
PrintObject(&sz);
sz.Append(" --\n");
iLength = sz.Length()-1;
szLine.Init('-', iLength);
szLine.AppendNewLine();
iTotalTos = 0;
iNumEmbedded = GetNumEmbedded();
for (i = 0; i < iNumEmbedded; i++)
{
pcEmbedded = GetEmbeddedObject(i);
iTotalTos += pcEmbedded->NumPointerTos();
}
sz.Insert(0, &szLine);
sz.Append("Total Tos [");
sz.Append(iTotalTos);
sz.Append("]\n");
for (i = 0; i < iNumEmbedded; i++)
{
pcEmbedded = GetEmbeddedObject(i);
acTos.Init(1);
pcEmbedded->BaseGetPointerTos(&acTos);
iNumTos = acTos.NumElements();
sz.Append("Embedded ");
sz.Append(i);
sz.Append(" Tos [");
sz.Append(iNumTos);
sz.Append("]\n");
for (j = 0; j < iNumTos; j++)
{
ppcToObject = acTos.Get(j); //A pointed to never comes back NULL.
sz.Append(" ");
if ((*ppcToObject)->IsBaseObject())
{
pcToObject = (CBaseObject*)*ppcToObject;
pcToObject->PrintObject(&sz);
}
else
{
sz.Append("HollwEmbeddedObject");
}
sz.AppendNewLine();
}
acTos.Kill();
}
sz.Append(&szLine);
szLine.Kill();
sz.Dump();
sz.Kill();
}
示例13: 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;
}