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


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

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


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

示例1: OutputImage

bool OutputImage (CG16bitImage &Image, const CString &sFilespec)
	{
	if (!sFilespec.IsBlank())
		{
		if (Image.SaveAsWindowsBMP(sFilespec) != NOERROR)
			{
			printf("Unable to save to '%s'\n", sFilespec.GetASCIIZPointer());
			return false;
			}

		printf("%s\n", sFilespec.GetASCIIZPointer());
		}

	//	Otherwise, clipboard

	else
		{
		if (Image.CopyToClipboard() != NOERROR)
			{
			printf("Unable to copy to clipboard.\n");
			return false;
			}

		printf("Image copied to clipboard.\n");
		}

	//	Done

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

示例2: CONSTLIT

ICCItem *fnSubst (CEvalContext *pCtx, ICCItem *pArguments, DWORD dwData)

//	fnSubst
//
//	Substitutes string parameters
//
//	(subst string arg1 arg2 ... argn)

	{
	CCodeChain *pCC = pCtx->pCC;
	ICCItem *pArgs;

	//	Evaluate the arguments and validate them

	pArgs = pCC->EvaluateArgs(pCtx, pArguments, CONSTLIT("s*"));
	if (pArgs->IsError())
		return pArgs;

	CString sPattern = pArgs->GetElement(0)->GetStringValue();

	//	Do the substitution

	char szResult[4096];
	char *pPos = sPattern.GetASCIIZPointer();
	char *pDest = szResult;
	char *pEndDest = szResult + sizeof(szResult) - 1;

	while (*pPos != '\0' && pDest < pEndDest)
		{
		if (*pPos == '%')
			{
			pPos++;

			int iArg = strParseInt(pPos, 0, &pPos, NULL);
			if (iArg > 0)
				{
				CString sParam = pArgs->GetElement(iArg)->GetStringValue();
				char *pParam = sParam.GetASCIIZPointer();

				while (*pParam != '\0' && pDest < pEndDest)
					*pDest++ = *pParam++;

				pPos++;
				}
			else
				{
				if (*pPos == '%')
					*pDest++ = *pPos++;
				}
			}
		else
			*pDest++ = *pPos++;
		}

	//	Done

	*pDest = '\0';
	pArgs->Discard(pCC);
	return pCC->CreateString(CString(szResult));
	}
开发者ID:alanhorizon,项目名称:Transport,代码行数:60,代码来源:Functions.cpp

示例3: WriteResource

ALERROR WriteResource (const CString &sFilename, const CString &sFolder, CSymbolTable &Resources, CDataFile &Out)
	{
	ALERROR error;
	CString sFilespec = pathAddComponent(sFolder, sFilename);

	CFileReadBlock theFile(sFilespec);
	if (error = theFile.Open())
		{
		printf("Unable to open '%s'\n", sFilespec.GetASCIIZPointer());
		return error;
		}

	CString sData(theFile.GetPointer(0, -1), theFile.GetLength(), TRUE);
	int iEntry;
	if (error = Out.AddEntry(sData, &iEntry))
		{
		printf("Unable to store '%s'\n", sFilespec.GetASCIIZPointer());
		return error;
		}

	Resources.AddEntry(sFilespec, (CObject *)iEntry);
	printf("   %s\n", sFilespec.GetASCIIZPointer());

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

示例4: arcDecompressFile

bool arcDecompressFile (const CString &sArchive, const CString &sFilename, IWriteStream &Output, CString *retsError)

//	arcDecompressFile
//
//	Unzips to a stream.

	{
	unzFile theZipFile = unzOpen(sArchive.GetASCIIZPointer());
	if (theZipFile == NULL)
		{
		*retsError = strPatternSubst(CONSTLIT("Unable to open file: %s."), sArchive);
		return false;
		}

	if (unzLocateFile(theZipFile, sFilename.GetASCIIZPointer(), 0) != UNZ_OK)
		{
		unzClose(theZipFile);
		*retsError = strPatternSubst(CONSTLIT("Unable to find file in archive: %s."), sFilename);
		return false;
		}

	if (unzOpenCurrentFile(theZipFile) != UNZ_OK)
		{
		unzClose(theZipFile);
		*retsError = strPatternSubst(CONSTLIT("Unable to open file in archive: %s."), sFilename);
		return false;
		}

	while (true)
		{
		char szBuffer[BUFFER_SIZE];

		int iRead = unzReadCurrentFile(theZipFile, szBuffer, BUFFER_SIZE);
		if (iRead == 0)
			break;
		else if (iRead < 0)
			{
			unzCloseCurrentFile(theZipFile);
			unzClose(theZipFile);
			*retsError = CONSTLIT("Error reading archive.");
			return false;
			}

		Output.Write(szBuffer, iRead);
		}

	//	Returns UNZ_CRCERROR if the file failed its CRC check.

	if (unzCloseCurrentFile(theZipFile) != UNZ_OK)
		{
		unzClose(theZipFile);
		*retsError = strPatternSubst(CONSTLIT("File in archive corrupted: %s."), sArchive);
		return false;
		}

	unzClose(theZipFile);

	return true;
	}
开发者ID:gmoromisato,项目名称:Dev,代码行数:59,代码来源:ZipArchive.cpp

示例5:

CJSONValue::CJSONValue (const CString &sValue, bool bToUTF8)

//	CJSONValue constructor

	{
	m_iType = typeString;

	if (bToUTF8)
		{
		//	See if there are any characters that we need to encode.

		char *pPos = sValue.GetASCIIZPointer();
		char *pPosEnd = pPos + sValue.GetLength();
		while (pPos < pPosEnd && (BYTE)*pPos < 0x80)
			pPos++;

		//	If we don't have to encode anything, just copy

		if (pPos == pPosEnd)
			m_pValue = CString::INTGetStorage(sValue);
		else
			{
			//	Otherwise, we encode

			CMemoryWriteStream Output;
			if (Output.Create() != NOERROR)
				m_pValue = CString::INTGetStorage(CONSTLIT("Out of memory"));
			else
				{
				pPos = sValue.GetASCIIZPointer();
				pPosEnd = pPos + sValue.GetLength();
				while (pPos < pPosEnd)
					{
					if ((BYTE)*pPos < 0x80)
						Output.Write(pPos, 1);
					else
						{
						CString sUTF8 = strEncodeW1252ToUTF8Char(*pPos);
						Output.Write(sUTF8.GetASCIIZPointer(), sUTF8.GetLength());
						}

					pPos++;
					}

				m_pValue = CString::INTGetStorage(CString(Output.GetPointer(), Output.GetLength()));
				}
			}
		}
	else
		m_pValue = CString::INTGetStorage(sValue);
	}
开发者ID:bmer,项目名称:Alchemy,代码行数:51,代码来源:CJSONValue.cpp

示例6: Print

	inline void Print (const CString &sStat, int iCount, int iTotal)
		{
		int iAverage = m_iTotal / iCount;
		int iPercent = (int)((100.0 * (float)iAverage / (float)iTotal) + 0.5f);

		if (m_iMin == m_iMax)
			printf("%s:\t%d\t%d%%\n", sStat.GetASCIIZPointer(), m_iMin, iPercent);
		else
			printf("%s:\t%d-%d (%d)\t%d%%\n",
					sStat.GetASCIIZPointer(),
					m_iMin, 
					m_iMax, 
					iAverage,
					iPercent);
		}
开发者ID:Sdw195,项目名称:Transcendence,代码行数:15,代码来源:Topology.cpp

示例7: GetEncodedTextLength

DWORD CHTMLForm::GetEncodedTextLength (const CString &sText) const

//	GetEncodedTextLength
//
//	Returns the length that the given text would be encoded (in bytes)

	{
	char *pPos = sText.GetASCIIZPointer();
	char *pEndPos = pPos + sText.GetLength();

	DWORD dwCount = 0;
	while (pPos < pEndPos)
		{
		if ((*pPos >= 'A' && *pPos <= 'Z')
				|| (*pPos >= 'a' && *pPos <= 'z')
				|| (*pPos >= '0' && *pPos <= '9')
				|| *pPos == ' ')
			dwCount++;
		else
			dwCount += 3;

		pPos++;
		}

	return dwCount;
	}
开发者ID:Sdw195,项目名称:Transcendence,代码行数:26,代码来源:CHTMLForm.cpp

示例8: FireOnGlobalPaneInit

void CDesignCollection::FireOnGlobalPaneInit (void *pScreen, CDesignType *pRoot, const CString &sScreen, const CString &sPane)

//	FireOnGlobalPaneInit
//
//	Give other design types a way to override screens

	{
	int i;
	CString sError;

	//	Generate a screen UNID that contains both the screen UNID and a local screen

	CString sScreenUNID = CDockScreenType::GetStringUNID(pRoot, sScreen);
	DWORD dwRootUNID = (pRoot ? pRoot->GetUNID() : 0);

	//	Fire all events

	for (i = 0; i < m_EventsCache[evtOnGlobalDockPaneInit]->GetCount(); i++)
		{
		SEventHandlerDesc Event;
		CDesignType *pType = m_EventsCache[evtOnGlobalDockPaneInit]->GetEntry(i, &Event);

		if (pType->FireOnGlobalDockPaneInit(Event,
				pScreen,
				dwRootUNID,
				sScreenUNID,
				sPane,
				&sError) != NOERROR)
			kernelDebugLogMessage("%s", sError.GetASCIIZPointer());
		}
	}
开发者ID:Sdw195,项目名称:Transcendence,代码行数:31,代码来源:CDesignCollection.cpp

示例9: HardCrash

void CHumanInterface::HardCrash (const CString &sProgramState)

//	HardCrash
//
//	Report an error

	{
	CString sSessionMessage;
	try
		{
		if (m_pCurSession)
			m_pCurSession->HIReportHardCrash(&sSessionMessage);
		}
	catch (...)
		{
		sSessionMessage = CONSTLIT("Unable to obtain crash report from session.");
		}

	CString sMessage = strPatternSubst(CONSTLIT(
			"Unable to continue due to program error.\r\n\r\n"
			"program state: %s\r\n"
			"%s"
			"\r\n\r\nPlease contact [email protected] with a copy of Debug.log and your save file. "
			"We are sorry for the inconvenience.\r\n"),
			sProgramState,
			sSessionMessage
			);

	kernelDebugLogMessage(sMessage.GetASCIIZPointer());
	ShowHardCrashSession(CONSTLIT("Transcendence System Crash"), sMessage);
	}
开发者ID:Ttech,项目名称:Transcendence,代码行数:31,代码来源:CHumanInterface.cpp

示例10: ParseEncounterCriteria

void ParseEncounterCriteria (const CString &sCriteria, SEncounterCriteria *retCriteria)
	{
	retCriteria->MustHave.RemoveAll();
	retCriteria->MustNotHave.RemoveAll();

	char *pPos = sCriteria.GetASCIIZPointer();
	while (*pPos != '\0')
		{
		if (*pPos == '+' || *pPos == '-')
			{
			char chOp = *pPos;
			pPos++;

			char *pStart = pPos;
			while (*pPos != '\0' && *pPos != ';')
				pPos++;

			CString sAttrib(pStart, pPos - pStart);
			if (!sAttrib.IsBlank())
				{
				if (chOp == '+')
					retCriteria->MustHave.AppendString(sAttrib);
				else
					retCriteria->MustNotHave.AppendString(sAttrib);
				}
			}
		else
			pPos++;
		}
	}
开发者ID:alanhorizon,项目名称:Transport,代码行数:30,代码来源:EncounterTable.cpp

示例11: LoadWaveFile

ALERROR CSoundMgr::LoadWaveFile (const CString &sFilename, int *retiChannel)

//	LoadWaveFile
//
//	Creates a sound buffer from a WAV file

	{
	ALERROR error;
	HMMIO hFile;

	if (m_pDS == NULL)
		{
		*retiChannel = 0;
		return NOERROR;
		}

	hFile = mmioOpen(sFilename.GetASCIIZPointer(), NULL, MMIO_READ | MMIO_ALLOCBUF);
	if (hFile == NULL)
		return ERR_FAIL;

	if (error = LoadWaveFile(hFile, retiChannel))
		return error;

	SChannel *pChannel = GetChannel(*retiChannel);
	pChannel->sFilename = sFilename;
	return NOERROR;
	}
开发者ID:dogguts,项目名称:Transcendence,代码行数:27,代码来源:Sound.cpp

示例12: CreateDataFieldFromItemList

CString CreateDataFieldFromItemList (const TArray<CItem> &List)

//	CreateDataFieldFromItemList
//
//	Creates a data field string from a list of items

	{
	int i;
	CCodeChain &CC = g_pUniverse->GetCC();

	CMemoryWriteStream Output(10000);
	if (Output.Create() != NOERROR)
		return NULL_STR;

	Output.Write("='(", 3);
	for (i = 0; i < List.GetCount(); i++)
		{
		ICCItem *pItem = List[i].WriteToCCItem(CC);
		if (pItem->IsError())
			{
			pItem->Discard(&CC);
			return NULL_STR;
			}

		CString sItem = pItem->Print(&CC);
		Output.Write(sItem.GetASCIIZPointer(), sItem.GetLength());
		Output.Write(" ", 1);

		pItem->Discard(&CC);
		}
	Output.Write(")", 1);
	Output.Close();

	return CString(Output.GetPointer(), Output.GetLength());
	}
开发者ID:alanhorizon,项目名称:Transcendence,代码行数:35,代码来源:CCUtil.cpp

示例13: LoadSound

ALERROR CUniverse::LoadSound (SDesignLoadCtx &Ctx, CXMLElement *pElement)

//	LoadSound
//
//	Load a sound element

	{
	ALERROR error;

	if (Ctx.bNoResources)
		return NOERROR;

	DWORD dwUNID = LoadUNID(Ctx, pElement->GetAttribute(UNID_ATTRIB));
	CString sFilename = pElement->GetAttribute(FILENAME_ATTRIB);

	//	Load the image
	int iChannel;
	if (error = Ctx.pResDb->LoadSound(*m_pSoundMgr, NULL_STR, sFilename, &iChannel))
		{
		Ctx.sError = strPatternSubst(CONSTLIT("Unable to load sound: %s"), sFilename.GetASCIIZPointer());
		return error;
		}

	if (error = m_Sounds.AddEntry((int)dwUNID, (CObject *)iChannel))
		{
		Ctx.sError = CONSTLIT("Unable to add sound");
		return error;
		}

#ifdef DEBUG_SOURCE_LOAD_TRACE
	kernelDebugLogMessage("Loaded sound: %x", dwUNID);
#endif

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

示例14: CONSTLIT

ICCItem *CCPrimitive::Execute (CEvalContext *pCtx, ICCItem *pArgs)

//	Execute
//
//	Executes the function and returns a result

	{
	bool bCustomArgEval = ((m_dwFlags & PPFLAG_CUSTOM_ARG_EVAL) ? true : false);

	//	Evaluate args, if necessary

	ICCItem *pEvalArgs;
	if (!bCustomArgEval)
		{
		pEvalArgs = pCtx->pCC->EvaluateArgs(pCtx, pArgs, m_sArgPattern);
		if (pEvalArgs->IsError())
			return pEvalArgs;
		}
	else
		pEvalArgs = pArgs;

	//	Invoke the function

	ICCItem *pResult;
	bool bReportError = false;
	try
		{
		pResult = m_pfFunction(pCtx, pEvalArgs, m_dwData);
		}
	catch (...)
		{
		bReportError = true;
		}

	//	Report error

	if (bReportError)
		{
		CString sArgs;
		try
			{
			sArgs = pEvalArgs->Print(pCtx->pCC);
			}
		catch (...)
			{
			sArgs = CONSTLIT("[invalid arg item]");
			}

		CString sError = strPatternSubst(CONSTLIT("Exception in %s; arg = %s"), m_sName, sArgs);
		pResult = pCtx->pCC->CreateError(sError, pEvalArgs);
		kernelDebugLogMessage(sError.GetASCIIZPointer());
		}

	//	Done

	if (!bCustomArgEval)
		pEvalArgs->Discard(pCtx->pCC);

	return pResult;
	}
开发者ID:Sdw195,项目名称:Transcendence,代码行数:60,代码来源:CCPrimitive.cpp

示例15: ParseCriteriaInt

ALERROR CTopologyNode::ParseCriteriaInt (const CString &sCriteria, SCriteria *retCrit)

//	ParseCriteriaInt
//
//	Parses a string criteria

	{
	char *pPos = sCriteria.GetASCIIZPointer();
	while (*pPos != '\0')
		{
		switch (*pPos)
			{
			case '+':
			case '-':
				{
				bool bRequired = (*pPos == '+');
				CString sParam = ::ParseCriteriaParam(&pPos, false);
				if (bRequired)
					retCrit->AttribsRequired.Insert(sParam);
				else
					retCrit->AttribsNotAllowed.Insert(sParam);
				break;
				}
			}

		pPos++;
		}

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


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