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


C++ CString::GetPointer方法代码示例

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


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

示例1: EvalBool

bool IDockScreenDisplay::EvalBool (const CString &sCode, bool *retbResult, CString *retsError)

//	EvalBool
//
//	Evaluates the given string

	{
	CCodeChainCtx Ctx;
	Ctx.SetScreen(m_pDockScreen);
	Ctx.SaveAndDefineSourceVar(m_pLocation);
	Ctx.SaveAndDefineDataVar(m_pData);

	char *pPos = sCode.GetPointer();
	ICCItem *pExp = Ctx.Link(sCode, 1, NULL);

	ICCItem *pResult = Ctx.Run(pExp);	//	LATER:Event
	Ctx.Discard(pExp);

	if (pResult->IsError())
		{
		*retsError = pResult->GetStringValue();
		Ctx.Discard(pResult);
		return false;
		}

	*retbResult = !pResult->IsNil();
	Ctx.Discard(pResult);

	return true;
	}
开发者ID:AvanWolf,项目名称:Transcendence,代码行数:30,代码来源:IDockScreenDisplay.cpp

示例2: Save

ALERROR CHighScoreList::Save (const CString &sFilename)

//	Save
//
//	Save the high score list

	{
	ALERROR error;

	if (m_bModified)
		{
		CFileWriteStream DataFile(sFilename, FALSE);

		if (error = DataFile.Create())
			return error;

		//	Write the XML header

		CString sData = strPatternSubst(CONSTLIT("<?xml version=\"1.0\"?>\r\n\r\n<TranscendenceHighScores lastPlayerName=\"%s\" lastPlayerGenome=\"%d\">\r\n\r\n"),
				m_sMostRecentPlayerName,
				m_iMostRecentPlayerGenome);
		if (error = DataFile.Write(sData.GetPointer(), sData.GetLength(), NULL))
			return error;

		//	Loop over scores

		for (int i = 0; i < m_iCount; i++)
			{
			if (error = m_List[i].WriteToXML(DataFile))
				return error;
			}

		//	Done

		sData = CONSTLIT("\r\n</TranscendenceHighScores>\r\n");
		if (error = DataFile.Write(sData.GetPointer(), sData.GetLength(), NULL))
			return error;

		if (error = DataFile.Close())
			return error;
		}

	return NOERROR;
	}
开发者ID:Sdw195,项目名称:Transcendence,代码行数:44,代码来源:CHighScoreList.cpp

示例3:

ParserCtx::ParserCtx (ParserCtx *pParentCtx, const CString &sString) : 
		m_pController(pParentCtx->m_pController)
	{
	pPos = sString.GetPointer();
	pEndPos = pPos + sString.GetLength();
	pElement = NULL;
	iToken = tkEOF;
	iLine = 1;
	m_bParseRootElement = false;
	m_bParseRootTag = false;

	m_pParentCtx = pParentCtx;
	}
开发者ID:gmoromisato,项目名称:Hexarc,代码行数:13,代码来源:XMLParser.cpp

示例4: WriteAsXML

ALERROR CMarkovWordGenerator::WriteAsXML (IWriteStream *pOutput)

//	WriteAsXML
//
//	Writes out the Markov chain data to an XML element

	{
	ALERROR error;
	int i;

	//	Open tag

	CString sData;
	sData = CONSTLIT("\t<WordGenerator>\r\n");
	if (error = pOutput->Write(sData.GetPointer(), sData.GetLength(), NULL))
		return error;

	//	Fragments

	for (i = 0; i < m_Table.GetCount(); i++)
		{
		sData = CONSTLIT("\t\t<Syl>");
		if (error = pOutput->Write(sData.GetPointer(), sData.GetLength(), NULL))
			return error;

		sData = strPatternSubst(CONSTLIT("%s;%d;%d;"), strToXMLText(CString(m_Table[i]->sFrag)), m_Table[i]->dwCount, m_Table[i]->dwFlags);
		if (error = pOutput->Write(sData.GetPointer(), sData.GetLength(), NULL))
			return error;

		SChainChar *pChain = GetChain(m_Table[i]);
		while ((*(DWORD *)pChain) != 0)
			{
			char chChar[2];
			chChar[0] = pChain->chChar;
			chChar[1] = '\0';
			CString sChar = strToXMLText(CString(chChar, 1, true));
			sData = strPatternSubst(CONSTLIT("%s;%d;"), sChar, pChain->dwCount);

			if (error = pOutput->Write(sData.GetPointer(), sData.GetLength(), NULL))
				return error;

			pChain++;
			}

		sData = CONSTLIT("</Syl>\r\n");
		if (error = pOutput->Write(sData.GetPointer(), sData.GetLength(), NULL))
			return error;
		}

	//	Done

	//	Close tag

	sData = CONSTLIT("\t</WordGenerator>\r\n");
	if (error = pOutput->Write(sData.GetPointer(), sData.GetLength(), NULL))
		return error;

	return NOERROR;
	}
开发者ID:Sdw195,项目名称:Transcendence,代码行数:59,代码来源:CMarkovWordGenerator.cpp

示例5: RunEvalString

bool CCodeChainCtx::RunEvalString (const CString &sString, bool bPlain, CString *retsResult)

//	RunString
//
//	If sString starts with '=' or if bPlain is TRUE, then we evaluate sString as an
//	expression. If success (no error) we return TRUE. Otherwise, we return FALSE and
//	the error is in retsResult.

	{
	char *pPos = sString.GetPointer();

	if (bPlain || *pPos == '=')
		{
		ICCItem *pExp = Link(sString, (bPlain ? 0 : 1), NULL);

		ICCItem *pResult = Run(pExp);	//	LATER:Event
		Discard(pExp);

		if (pResult->IsError())
			{
			*retsResult = pResult->GetStringValue();
			Discard(pResult);
			return false;
			}

		//	Note: We use GetStringValue instead of Unlink because we don't
		//	want to preserve CC semantics (e.g., we don't need strings to
		//	be quoted).

		*retsResult = pResult->GetStringValue();
		Discard(pResult);
		return true;
		}
	else
		{
		*retsResult = strCEscapeCodes(sString);
		return true;
		}
	}
开发者ID:bmer,项目名称:Mammoth,代码行数:39,代码来源:CCodeChainCtx.cpp

示例6: WriteEntry

ALERROR CDataFile::WriteEntry (int iEntry, const CString &sData)

//	WriteEntry
//
//	Does some stuff

	{
	ALERROR error;

	ASSERT(IsOpen());
	ASSERT(!m_fReadOnly);

	//	Make sure we're in bounds

	if (iEntry < 0 || iEntry >= m_iEntryTableCount)
		return ERR_FAIL;

	if (m_pEntryTable[iEntry].dwBlock == FREE_ENTRY)
		return ERR_FAIL;

	//	Resize the entry

	if ((error = ResizeEntry(iEntry, sData.GetLength(), NULL)))
		return error;

	//	Write out the data.

	if ((error = WriteBlockChain(m_pEntryTable[iEntry].dwBlock, sData.GetPointer(), sData.GetLength())))
		return error;

	//	Flush

	if ((error = Flush()))
		return error;

	return NOERROR;
	}
开发者ID:alanhorizon,项目名称:Transport,代码行数:37,代码来源:CDataFile.cpp

示例7: AddEntry

ALERROR CDataFile::AddEntry (const CString &sData, int *retiEntry)

//	AddEntry
//
//	Does some stuff

	{
	ALERROR error;
	int i, iEntry;
	DWORD dwStartingBlock;
	DWORD dwBlockCount;

	ASSERT(IsOpen());
	ASSERT(!m_fReadOnly);

	//	Look for a free entry

	for (i = 0; i < m_iEntryTableCount; i++)
		if (m_pEntryTable[i].dwBlock == FREE_ENTRY)
			break;

	//	If we could not find a free entry, grow the entry table

	if (i == m_iEntryTableCount)
		{
		if ((error = GrowEntryTable(&iEntry)))
			goto Fail;
		}
	else
		iEntry = i;

	//	Figure out how many blocks we need

	dwBlockCount = (sData.GetLength() / m_iBlockSize) + 1;

	//	Allocate a block chain large enough to contain the entry

	if ((error = AllocBlockChain(dwBlockCount, &dwStartingBlock)))
		goto Fail;

	//	Write the block chain

	if ((error = WriteBlockChain(dwStartingBlock, sData.GetPointer(), sData.GetLength())))
		{
		FreeBlockChain(dwStartingBlock, dwBlockCount);
		goto Fail;
		}

	//	Set the entry

	m_pEntryTable[iEntry].dwBlock = dwStartingBlock;
	m_pEntryTable[iEntry].dwBlockCount = dwBlockCount;
	m_pEntryTable[iEntry].dwSize = (DWORD)sData.GetLength();
	m_pEntryTable[iEntry].dwFlags = 0;
	m_fEntryTableModified = TRUE;

	//	Flush

	if ((error = Flush()))
		goto Fail;

	//	Done

	*retiEntry = iEntry;

	return NOERROR;

Fail:

	return error;
	}
开发者ID:alanhorizon,项目名称:Transport,代码行数:71,代码来源:CDataFile.cpp

示例8: ParseCriteria

bool CMission::ParseCriteria (const CString &sCriteria, SCriteria *retCriteria)

//	ParseCriteria
//
//	Parses criteria. Returns TRUE if successful.

{
    //	Initialize

    *retCriteria = SCriteria();

    //	Parse

    char *pPos = sCriteria.GetPointer();
    while (*pPos != '\0')
    {
        switch (*pPos)
        {
        case '*':
            retCriteria->bIncludeOpen = true;
            retCriteria->bIncludeUnavailable = true;
            retCriteria->bIncludeActive = true;
            retCriteria->bIncludeRecorded = true;
            break;

        case 'a':
            retCriteria->bIncludeActive = true;
            break;

        case 'o':
            retCriteria->bIncludeOpen = true;
            break;

        case 'r':
            retCriteria->bIncludeRecorded = true;
            break;

        case 'u':
            retCriteria->bIncludeUnavailable = true;
            break;

        case 'S':
            retCriteria->bOnlySourceOwner = true;
            break;

        case '+':
        case '-':
        {
            bool bRequired = (*pPos == '+');
            bool bBinaryParam;
            CString sParam = ParseCriteriaParam(&pPos, false, &bBinaryParam);

            if (bRequired)
            {
                if (bBinaryParam)
                    retCriteria->SpecialRequired.Insert(sParam);
                else
                    retCriteria->AttribsRequired.Insert(sParam);
            }
            else
            {
                if (bBinaryParam)
                    retCriteria->SpecialNotAllowed.Insert(sParam);
                else
                    retCriteria->AttribsNotAllowed.Insert(sParam);
            }
            break;
        }
        }

        pPos++;
    }

    //	Make sure we include some missions

    if (!retCriteria->bIncludeUnavailable
            && !retCriteria->bIncludeActive
            && !retCriteria->bIncludeRecorded
            && !retCriteria->bIncludeOpen)
    {
        retCriteria->bIncludeUnavailable = true;
        retCriteria->bIncludeActive = true;
        retCriteria->bIncludeRecorded = true;
        retCriteria->bIncludeOpen = true;
    }

    return true;
}
开发者ID:alanhorizon,项目名称:Transcendence,代码行数:88,代码来源:CMission.cpp

示例9: Save

ALERROR CGameSettings::Save (const CString &sFilespec)

//	Save
//
//	Save game settings to a file (if necessary)

	{
	ALERROR error;

	if (!m_bModified)
		return NOERROR;

	//	Create the file

	CFileWriteStream DataFile(sFilespec, FALSE);
	if (error = DataFile.Create())
		return error;

	//	Write the XML header

	CString sData = CONSTLIT("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n\r\n<TranscendenceSettings>\r\n\r\n");
	if (error = DataFile.Write(sData.GetPointer(), sData.GetLength(), NULL))
		return error;

	//	Loop over options

	for (int i = 0; i < OPTIONS_COUNT; i++)
		{
		//	Don't bother saving if our current value is the same 
		//	as the default value

		if (strEquals(m_Options[i].sSettingsValue, CString(g_OptionData[i].pszDefaultValue, -1, true)))
			continue;

		//	Compose option element and write

		sData = strPatternSubst(CONSTLIT("\t<Option name=\"%s\"\tvalue=\"%s\"/>\r\n"),
				CString(g_OptionData[i].pszName, -1, true),
				m_Options[i].sSettingsValue);

		if (error = DataFile.Write(sData.GetPointer(), sData.GetLength(), NULL))
			return error;
		}

	//	Write the key map

	if (error = DataFile.Write("\r\n", 2, NULL))
		return error;

	if (error = m_KeyMap.WriteAsXML(&DataFile))
		return error;

	//	Write additional settings

	if (m_pExtra)
		{
		if (error = DataFile.Write("\r\n", 2, NULL))
			return error;

		if (error = m_pExtra->OnSaveSettings(&DataFile))
			return error;
		}

	//	Done

	sData = CONSTLIT("\r\n</TranscendenceSettings>\r\n");
	if (error = DataFile.Write(sData.GetPointer(), sData.GetLength(), NULL))
		return error;

	if (error = DataFile.Close())
		return error;

	return NOERROR;
	}
开发者ID:Sdw195,项目名称:Transcendence,代码行数:74,代码来源:CGameSettings.cpp

示例10: AutoCompleteSearch

void CCommandLineDisplay::AutoCompleteSearch (void)

//	AutocompleteSearch
//
//	Searches the global symbol table for matches to the current command.

	{
	const CString sCurCmd = GetCurrentCmd();
	CString sCommon;
	CString sHelp;

	ClearHint();
	if (sCurCmd.IsBlank())
		return;

	//	Get the list of global symbols

	ICCItem *pGlobals = g_pUniverse->GetCC().GetGlobals();

	int iMatches = 0;

	for (int i = 0; i < pGlobals->GetCount(); i++)
		{
		CString sGlobal = pGlobals->GetKey(i);

		//	Partial match
		if (strStartsWith(sGlobal, sCurCmd))
			{
			if (iMatches == 0)
				sCommon = sGlobal;
			//	If we have multiple matching commands then find the longest common stem
			else
				{
				int iLen = min(sCommon.GetLength(), sGlobal.GetLength());
				char *pPos1 = sCommon.GetPointer();
				char *pPos2 = sGlobal.GetPointer();
				int i;
				for (i = 0; i < iLen; i++)
					{
					if (CharLower((LPTSTR)(BYTE)(*pPos1)) != CharLower((LPTSTR)(BYTE)(*pPos2)))
						break;
					pPos1++;
					pPos2++;
					}
				sCommon.Truncate(i);
				m_sHint.Append(CONSTLIT(" "));
				}
			//	Append the command to the auto complete hint
			m_sHint.Append(sGlobal);
			iMatches++;
			}

		if (strEquals(sGlobal, sCurCmd))
			{
			//	Exact match - get help text
			ICCItem *pItem = pGlobals->GetElement(i);
			if (pItem->IsPrimitive())
				sHelp = pItem->GetHelp();
			}
		}

	//	If the common stem is longer than the current command, then auto complete
	if (sCommon.GetLength() > sCurCmd.GetLength())
		Input(strSubString(sCommon, sCurCmd.GetLength(), -1));

	//	If we only have one match then no need to show hint as we have either
	//	auto completed or will show help text insead
	if (iMatches == 1)
		m_sHint = NULL_STR;

	if (!sHelp.IsBlank())
		{
		if (!m_sHint.IsBlank())
			m_sHint.Append(CONSTLIT("\n"));
		m_sHint.Append(sHelp);
		}
	}
开发者ID:Arkheias,项目名称:Transcendence,代码行数:77,代码来源:CCommandLineDisplay.cpp


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