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


C++ JString::GetCString方法代码示例

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


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

示例1:

void
JPTPrinter::InvertPageOrder
	(
	const JString&	text,
	ostream&		output
	)
	const
{
	JIndex endIndex   = text.GetLength() + 1;
	JIndex startIndex = endIndex - 1;
	while (text.LocatePrevSubstring(kPageSeparatorStr, kPageSeparatorStrLength, &startIndex))
		{
		const JIndex i = startIndex + kPageSeparatorStrLength;
		if (endIndex > i)
			{
			output.write(text.GetCString() + i-1, endIndex - i);
			}
		output << kPageSeparatorStr;

		endIndex = startIndex;
		startIndex--;
		}

	if (endIndex > 1)
		{
		output.write(text.GetCString(), endIndex-1);
		}
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:28,代码来源:JPTPrinter.cpp

示例2: iStr

JString
CMLink::Build2DArrayExpressionForCFamilyLanguage
	(
	const JCharacter*	origExpr,
	const JInteger		rowIndex,
	const JInteger		colIndex
	)
{
	JString expr = origExpr;

	const JBoolean usesI = expr.Contains("$i");		// row
	const JBoolean usesJ = expr.Contains("$j");		// col

	const JString iStr(rowIndex, 0);	// must use floating point conversion
	const JString jStr(colIndex, 0);	// must use floating point conversion

	// We have to do both at the same time because otherwise we lose a $.

	if (usesI || usesJ)
		{
		const JCharacter* map[] =
			{
			"i", iStr.GetCString(),
			"j", jStr.GetCString()
			};
		(JGetStringManager())->Replace(&expr, map, sizeof(map));
		}

	if (!usesI || !usesJ)
		{
		if (expr.GetFirstCharacter() != '(' ||
			expr.GetLastCharacter()  != ')')
			{
			expr.PrependCharacter('(');
			expr.AppendCharacter(')');
			}

		if (!usesI)
			{
			expr.AppendCharacter('[');
			expr += iStr;
			expr.AppendCharacter(']');
			}
		if (!usesJ)
			{
			expr.AppendCharacter('[');
			expr += jStr;
			expr.AppendCharacter(']');
			}
		}

	return expr;
}
开发者ID:,项目名称:,代码行数:53,代码来源:

示例3: indexStr

JString
CMLink::Build1DArrayExpressionForCFamilyLanguage
	(
	const JCharacter*	origExpr,
	const JInteger		index
	)
{
	JString expr = origExpr;

	const JString indexStr(index, 0);	// must use floating point conversion
	if (expr.Contains("$i"))
		{
		const JCharacter* map[] =
			{
			"i", indexStr.GetCString()
			};
		(JGetStringManager())->Replace(&expr, map, sizeof(map));
		}
	else
		{
		if (expr.GetFirstCharacter() != '(' ||
			expr.GetLastCharacter()  != ')')
			{
			expr.PrependCharacter('(');
			expr.AppendCharacter(')');
			}

		expr.AppendCharacter('[');
		expr += indexStr;
		expr.AppendCharacter(']');
		}

	return expr;
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例4: JGetString

void
CBCommand::ReportInfiniteLoop
	(
	const CBFunctionStack&	fnStack,
	const JIndex			startIndex
	)
{
	const JSize cmdCount = fnStack.GetElementCount();
	JString loop;
	for (JIndex i=startIndex; i>=1; i--)
		{
		if (!loop.IsEmpty())
			{
			loop += " -> ";
			}
		loop += fnStack.Peek(i);
		}
	loop += " -> ";
	loop += fnStack.Peek(startIndex);

	const JCharacter* map[] =
		{
		"loop", loop.GetCString()
		};
	const JString msg = JGetString("InfiniteLoop::CBCommand", map, sizeof(map));
	(JGetUserNotification())->ReportError(msg);
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:27,代码来源:CBCommand.cpp

示例5: JGetString

void
JCheckSiteName
	(
	const JCharacter*	encSiteSuffix,
	const JCharacter	siteCode,
	const JCharacter*	map[],
	const JSize			size
	)
{
	JString siteSuffix = encSiteSuffix;
	const JSize len    = siteSuffix.GetLength();
	for (JIndex i=1; i<=len; i++)
		{
		siteSuffix.SetCharacter(i, siteSuffix.GetCharacter(i) ^ siteCode);
		}

	map[1] = siteSuffix.GetCString();

	if (!(JGetHostName()).EndsWith(siteSuffix, kJFalse))
		{
		const JString msg = JGetString(kWrongSiteID, map, size);
		(JGetUserNotification())->DisplayMessage(msg);
		exit(0);
		}
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:25,代码来源:jSysUtil_UNIX.cpp

示例6: os

void
GMMIMEParser::WriteAttachment
	(
	const JString&		data,
	const GMIMEHeader&	header
	)
{
	JString filename = header.GetFileName();
	if (filename.IsEmpty())
		{
		const JError err = JCreateTempFile(itsAttachDir, NULL, &filename);
		if (!err.OK())
			{
			err.ReportIfError();
			return;
			}
		}
	else
		{
		filename = JCombinePathAndName(itsAttachDir, filename);
		}

	AdjustAttachmentName(header, &filename);
	std::ofstream os(filename);
	if (header.GetEncoding() == kBase64Encoding)
		{
		std::istrstream is(data.GetCString(), data.GetLength());
		JDecodeBase64(is, os);
		}
	else
		{
		data.Print(os);
		}
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:34,代码来源:GMMIMEParser.cpp

示例7: JGetString

void
CBFunctionMenu::SetEmptyMenuItems()
{
	JString name = CBCtagsUser::GetFunctionMenuTitle(itsFileType);
	name.ToLower();

	const JCharacter* map[] =
		{
		"name", name.GetCString()
		};
	const JString menuItems = JGetString(kEmptyMenuID, map, sizeof(map));
	SetMenuItems(menuItems);
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:13,代码来源:CBFunctionMenu.cpp

示例8: input

void
CBSearchDocument::AppendText
	(
	const JString& text
	)
{
	if (text.GetFirstCharacter() == CBSearchTE::kIncrementProgress)
		{
		itsIndicator->IncrementValue();
		return;
		}

	CBTextEditor* te = GetTextEditor();

	itsFoundFlag = kJTrue;
	const std::string s(text.GetCString(), text.GetLength());
	std::istringstream input(s);

	if (text.GetFirstCharacter() == CBSearchTE::kError)
		{
		input.ignore();
		JString msg;
		JReadAll(input, &msg);

		const JIndex startIndex = te->GetTextLength() + 1;
		te->SetCaretLocation(startIndex);
		te->Paste(msg);
		te->Paste("\n");
		if (!itsOnlyListFilesFlag)
			{
			te->Paste("\n");
			}

		te->SetFontStyle(startIndex, startIndex + msg.GetLength()-1,
						 GetErrorStyle(), kJTrue);
		}
	else if (itsOnlyListFilesFlag)
		{
		JString fileName;
		input >> fileName;
		CBExecOutputDocument::AppendText(fileName);

		if (itsIsReplaceFlag)
			{
			ReplaceAll(fileName);
			}
		}
	else
		{
开发者ID:jafl,项目名称:jx_application_framework,代码行数:49,代码来源:CBSearchDocument.cpp

示例9: input

void
CBSymbolList::ParseFile
	(
	const JCharacter*		fileName,
	const CBTextFileType	fileType,
	const JFAID_t			id
	)
{
	JString data;
	CBLanguage lang;
	if (ProcessFile(fileName, fileType, &data, &lang))
		{
		std::istrstream input(data.GetCString(), data.GetLength());
		ReadSymbolList(input, lang, fileName, id);
		itsChangedDuringParseFlag = kJTrue;
		}
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:17,代码来源:CBSymbolList.cpp

示例10:

const JCharacter*
SyGApplication::GetNMShortcut
	(
	JIndex* i
	)
	const
{
	if (*i <= kShortcutKeyCount)
		{
		kShortcutStr.SetCharacter(6, kShortcutKey[*i-1]);
		(*i)++;
		return kShortcutStr.GetCString();
		}
	else
		{
		return NULL;
		}
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:18,代码来源:SyGApplication.cpp

示例11: input

void
GDBGetSourceFileList::HandleSuccess
	(
	const JString& origData
	)
{
	if (origData.BeginsWith("Source files for which symbols have been read in:"))
		{
		(JXGetApplication())->DisplayBusyCursor();

		JXFileListTable* table = (GetFileList())->GetTable();
		table->RemoveAllFiles();

		JString data = origData;
		JIndex i,j;
		while (data.LocateSubstring("Source files for which symbols", &i))
			{
			j = i;
			if (!data.LocateNextSubstring(":", &j))
				{
				j = data.GetLength();
				}
			data.ReplaceSubstring(i, j, ",");
			}
		data.TrimWhitespace();		// no comma after last file

		std::istrstream input(data.GetCString(), data.GetLength());
		JString fullName, path, name, s;
		JBoolean foundDelimiter;
		do
			{
			input >> ws;
			fullName = JReadUntil(input, ',', &foundDelimiter);
			fullName.TrimWhitespace();
			if (!fullName.IsEmpty())
				{
				JSplitPathAndName(fullName, &path, &name);
				table->AddFile(name);
				}
			}
			while (foundDelimiter);
		}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:42,代码来源:GDBGetSourceFileList.cpp

示例12: indexStr

JString
XDLink::Build1DArrayExpression
	(
	const JCharacter*	origExpr,
	const JInteger		index
	)
{
	JString expr = origExpr;

	const JString indexStr(index, 0);	// must use floating point conversion
	if (expr.Contains("$i"))
		{
		// double literal $'s

		for (JIndex i=expr.GetLength()-1; i>=1; i--)
			{
			if (expr.GetCharacter(i)   == '$' &&
				expr.GetCharacter(i+1) != 'i')
				{
				expr.InsertCharacter('$', i);
				}
			}

		const JCharacter* map[] =
			{
			"i", indexStr.GetCString()
			};
		(JGetStringManager())->Replace(&expr, map, sizeof(map));
		}
	else
		{
		expr.AppendCharacter('[');
		expr += indexStr;
		expr.AppendCharacter(']');
		}

	return expr;
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:38,代码来源:XDLink.cpp

示例13: if

void
War2Wiz::ReceiveMessage
	(
	const JIndex	senderIndex,
	WarSocket&		socket
	)
{
	WarPlayer* sender = itsPlayerList->NthElement(senderIndex);

	JString s;
	const JBoolean ok = socket.GetNextMessage(&s);
	assert( ok );

	jistrstream(input, s.GetCString(), s.GetLength());
	WWMessageType type;
	input >> type;

	if (type == kWWClientIdentity)
		{
		ReceiveClientIdentity(senderIndex, sender, input);
		}

	else if (type == kWWClientAlive)
		{
		socket.ResetTimer();
		}

	else if (type == kWWChatMessage)
		{
		JIndex receiverIndex;
		JString msg;
		input >> receiverIndex >> msg;
		if (receiverIndex == kWWAllPlayersIndex || PlayerIndexValid(receiverIndex))
			{
			SendChatMessage(senderIndex, receiverIndex, msg);
			}
		}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:37,代码来源:War2Wiz.cpp

示例14: input

CBLanguage
CBFnMenuUpdater::UpdateMenu
	(
	const JCharacter*		fileName,
	const CBTextFileType	fileType,
	const JBoolean			sort,
	const JBoolean			includeNS,
	const JBoolean			pack,
	JXTextMenu*				menu,
	JArray<JIndex>*			lineIndexList
	)
{
	menu->RemoveAllItems();
	lineIndexList->RemoveAll();

	if (pack)
		{
		menu->SetDefaultFontSize(JGetDefaultFontSize()-2, kJFalse);
		menu->CompressHeight(kJTrue);
		}
	else
		{
		menu->SetDefaultFontSize(JGetDefaultFontSize(), kJFalse);
		menu->CompressHeight(kJFalse);
		}

	JString data;
	CBLanguage lang;
	if (ProcessFile(fileName, fileType, &data, &lang))
		{
		std::istrstream input(data.GetCString(), data.GetLength());
		ReadFunctionList(input, CBGetLanguage(fileType),
						 sort, includeNS, menu, lineIndexList);
		}
	return lang;
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:36,代码来源:CBFnMenuUpdater.cpp

示例15: if

JBoolean
JXImageSelection::ConvertData
	(
	const Atom		requestType,
	Atom*			returnType,
	unsigned char**	data,
	JSize*			dataLength,
	JSize*			bitsPerBlock
	)
	const
{
	*data         = NULL;
	*dataLength   = 0;
	*returnType   = None;
	*bitsPerBlock = 8;

	if (itsImage == NULL)
		{
		return kJFalse;
		}

	JString fileName;
	if (!(JCreateTempFile(&fileName)).OK())
		{
		return kJFalse;
		}

	JError err = JUnknownError(1);
	if (requestType == itsXPMXAtom)
		{
		err = itsImage->WriteXPM(fileName);
		}
	else if (requestType == itsGIFXAtom)
		{
		err = itsImage->WriteGIF(fileName, kJFalse);	// if too many colors, use PNG
		}
	else if (requestType == itsPNGXAtom)
		{
		err = itsImage->WritePNG(fileName);
		}
	else if (requestType == itsJPEGXAtom)
		{
		err = itsImage->WriteJPEG(fileName);
		}

	if (err.OK())
		{
		JString imageData;
		JReadFile(fileName, &imageData);
		JRemoveFile(fileName);

		*returnType = requestType;
		*dataLength = imageData.GetLength();
		*data       = new unsigned char[ *dataLength ];
		if (*data != NULL)
			{
			memcpy(*data, imageData.GetCString(), *dataLength);
			return kJTrue;
			}
		}

	JRemoveFile(fileName);
	return kJFalse;
}
开发者ID:mbert,项目名称:mulberry-lib-jx,代码行数:64,代码来源:JXImageSelection.cpp


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