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


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

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


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

示例1:

void
SyGViewManPageDialog::SetFunction
	(
	const JCharacter* historyStr
	)
{
	JString fnName = historyStr;

	JCharacter manIndex[] = { '\0', '\0' };
	if (fnName.GetLastCharacter() == ')')
		{
		manIndex[0] = fnName.GetCharacter(fnName.GetLength()-1);
		fnName.RemoveSubstring(fnName.GetLength()-3, fnName.GetLength());
		}

	if (manIndex[0] == '*')
		{
		manIndex[0] = '\0';
		itsAproposCheckbox->SetState(kJTrue);
		}
	else
		{
		itsAproposCheckbox->SetState(kJFalse);
		}

	itsFnName->SetText(fnName);
	itsManIndex->SetText(manIndex);
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:28,代码来源:SyGViewManPageDialog.cpp

示例2: BeginsWith

inline JBoolean
jTranslateRemoteToLocal1
	(
	const JCharacter*	host,
	const JString&		remotePath,
	const JCharacter*	mountDev,
	const JCharacter*	mountDir,
	JString*			localPath
	)
{
	const JString dev = mountDev;
	JIndex hostEndIndex;
	if (dev.LocateSubstring(":/", &hostEndIndex) && hostEndIndex > 1)
		{
		JString h = dev.GetSubstring(1, hostEndIndex-1);
		jGetFullHostName(&h);

		JString p = dev.GetSubstring(hostEndIndex+1, dev.GetLength());
		JAppendDirSeparator(&p);		// force complete name when check BeginsWith()

		if (host == h && remotePath.BeginsWith(p))
			{
			*localPath = remotePath;
			localPath->ReplaceSubstring(1, p.GetLength()-1, mountDir);
			JCleanPath(localPath);
			return kJTrue;
			}
		}

	return kJFalse;
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:31,代码来源:jMountUtil_UNIX.cpp

示例3:

	JString JString::operator+(const JString& rhs)
	{
		JString ret;
		unsigned _lenTotal = nLength + rhs.GetLength();
		ret.Init(_lenTotal);

		strncat_s(ret, ret.GetLength() + 1, pBuffer, nLength);
		strncat_s(ret, ret.GetLength() + 1, rhs, rhs.GetLength());

		return ret;
	}
开发者ID:jsj776655,项目名称:sunju_public,代码行数:11,代码来源:JString.cpp

示例4: if

JBoolean
CBStringCompleter::Complete
	(
	JTextEditor*			te,
	const JBoolean			includeNS,
	JXStringCompletionMenu*	menu
	)
{
	assert( menu != NULL );

	JIndex caretIndex;
	if (!te->GetCaretLocation(&caretIndex))
		{
		return kJFalse;
		}

	const JString& text = te->GetText();
	JIndex i            = caretIndex;
	while (i > 1 && IsWordCharacter(text, i-1, includeNS))
		{
		i--;
		}

	if (i == caretIndex)
		{
		return kJFalse;
		}

	JString s;
	const JString prefix   = text.GetSubstring(i, caretIndex-1);
	const JSize matchCount = Complete(prefix, &s, menu);
	if (matchCount > 0 &&
		s.GetLength() > prefix.GetLength())
		{
		s.RemoveSubstring(1, prefix.GetLength());
		te->Paste(s);
		menu->ClearRequestCount();
		return kJTrue;
		}
	else if (matchCount > 1)
		{
		menu->CompletionRequested(prefix.GetLength());
		return kJTrue;
		}
	else if (matchCount == 0 && includeNS)
		{
		// try once more without namespace
		return Complete(te, kJFalse, menu);
		}

	return kJFalse;
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:52,代码来源:CBStringCompleter.cpp

示例5: r

inline JBoolean
jTranslateLocalToRemote1
	(
	const JString&		localPath,
	const JCharacter*	mountDev,
	const JCharacter*	mountDir,
	JBoolean*			found,
	JString*			host,
	JString*			remotePath
	)
{
	if (!JIsSamePartition(localPath, mountDir))
		{
		return kJFalse;
		}

	const JString dev = mountDev;
	JIndex hostEndIndex;
	if (dev.LocateSubstring(":/", &hostEndIndex) && hostEndIndex > 1)
		{
		*host = dev.GetSubstring(1, hostEndIndex-1);

		#ifdef _J_CYGWIN
		if (host->GetLength() == 1 &&
			'A' <= host->GetFirstCharacter() && host->GetFirstCharacter() <= 'Z')
			{
			*host       = JGetHostName();
			*remotePath = localPath;
			JCleanPath(remotePath);
			*found = kJTrue;
			return kJTrue;
			}
		#endif

		jGetFullHostName(host);

		*remotePath = dev.GetSubstring(hostEndIndex+1, dev.GetLength());
		JAppendDirSeparator(remotePath);

		// use JIndexRange to allow empty

		JIndexRange r(strlen(mountDir)+1, localPath.GetLength());
		*remotePath += localPath.GetSubstring(r);
		JCleanPath(remotePath);

		*found = kJTrue;
		}

	return kJTrue;
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:50,代码来源:jMountUtil_UNIX.cpp

示例6: 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

示例7: 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

示例8: if

JString
JPrepArgForExec
	(
	const JCharacter* arg
	)
{
	JString str    = arg;
	JBoolean quote = kJFalse;

	const JSize length = str.GetLength();
	for (JIndex i=length; i>=1; i--)
		{
		const JCharacter c = str.GetCharacter(i);
		if (c == '"' || c == '\'' || c == '\\' || c == ';')
			{
			str.InsertSubstring("\\", i);
			}
		else if (isspace(c))
			{
			quote = kJTrue;
			}
		}

	if (quote)
		{
		str.PrependCharacter('"');
		str.AppendCharacter('"');
		}
	return str;
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:30,代码来源:jProcessUtil.cpp

示例9:

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

示例10: pageStr

void
CBPTPrinter::PrintHeader
	(
	ostream&		output,
	const JIndex	pageIndex
	)
{
	if (itsPrintHeaderFlag)
		{
		const JString dateStr = JGetTimeStamp();

		JString pageStr(pageIndex, 0);
		pageStr.Prepend("Page ");

		itsHeaderName.Print(output);
		output << '\n';

		dateStr.Print(output);
		const JInteger spaceCount =
			GetPageWidth() - dateStr.GetLength() - pageStr.GetLength();
		for (JInteger i=1; i<=spaceCount; i++)
			{
			output << ' ';
			}
		pageStr.Print(output);
		output << "\n\n\n";
		}
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:28,代码来源:CBPTPrinter.cpp

示例11:

JBoolean
JSplitPathAndName
	(
	const JCharacter*	fullName,
	JString*			path,
	JString*			name
	)
{
	assert( !JStringEmpty(fullName) );

	JString pathAndName = fullName;
	assert( pathAndName.GetLastCharacter() != ACE_DIRECTORY_SEPARATOR_CHAR );

	JIndex i;
	if (pathAndName.LocateLastSubstring(ACE_DIRECTORY_SEPARATOR_STR, &i))
		{
		*path = pathAndName.GetSubstring(1,i);
		*name = pathAndName.GetSubstring(i+1, pathAndName.GetLength());

		JCleanPath(path);
		return kJTrue;
		}
	else
		{
		*path = JGetCurrentDirectory();
		*name = pathAndName;
		return kJFalse;
		}
}
开发者ID:mta1309,项目名称:mulberry-lib-jx,代码行数:29,代码来源:jFileUtil.cpp

示例12: s

void
JMemoryManager::HandleDebugRequest()
	const
{
	assert( itsLink != NULL );

	JString text;
	const JBoolean ok = itsLink->GetNextMessage(&text);
	assert( ok );

	std::string s(text, text.GetLength());
	std::istringstream input(s);

	JFileVersion vers;
	input >> vers;
	if (vers != kJMemoryManagerDebugVersion)
		{
		cerr << "JMemoryManager::HandleDebugRequest received version (" << vers;
		cerr << ") different than expected (" << kJMemoryManagerDebugVersion << ")" << endl;
		return;
		}

	long type;
	input >> type;

	if (type == kRunningStatsMessage)
		{
		SendRunningStats();
		}
	else if (type == kRecordsMessage)
		{
		SendRecords(input);
		}
}
开发者ID:Lori-Pantera,项目名称:jx_application_framework,代码行数:34,代码来源:JMemoryManager.cpp

示例13: 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

示例14: AdjustStylesBeforeRecalc

void
CBCommandPathInput::AdjustStylesBeforeRecalc
	(
	const JString&		buffer,
	JRunArray<JFont>*	styles,
	JIndexRange*		recalcRange,
	JIndexRange*		redrawRange,
	const JBoolean		deletion
	)
{
	if (!buffer.IsEmpty() && buffer.GetFirstCharacter() == '@')
		{
		const JColormap* colormap = GetColormap();
		const JSize totalLength   = buffer.GetLength();
		JFont f                   = styles->GetFirstElement();
		styles->RemoveAll();
		f.SetColor(colormap->GetBlackColor());
		styles->AppendElements(f, totalLength);
		*redrawRange += JIndexRange(1, totalLength);
		}
	else
		{
		return JXPathInput::AdjustStylesBeforeRecalc(buffer, styles, recalcRange,
													 redrawRange, deletion);
		}
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:26,代码来源:CBCommandPathInput.cpp

示例15: base

void
JAbsoluteToRelativePath
	(
	const JCharacter* relativeTo,
	JString* path
	)
{
	JString base(relativeTo);
	JString test(*path);
	JAppendDirSeparator(&base);
	JAppendDirSeparator(&test);
	JIndex charindex = 2;
	JBoolean success = kJTrue;
	JString compare;
	JString store;
	success = test.LocateNextSubstring("/", &charindex);
	if (success)
		{
		compare = test.GetSubstring(1, charindex);
		}
	while (success && base.BeginsWith(compare))
		{
		store = compare;
		success = test.LocateNextSubstring("/", &charindex);
		if (success)
			{
			compare = test.GetSubstring(1, charindex);
			charindex ++;
			}
		}
	if (test.GetLength() >= store.GetLength())
		{
		test.RemoveSubstring(1, store.GetLength());
		}
	if (base.GetLength() >= store.GetLength())
		{
		base.RemoveSubstring(1, store.GetLength());
		}
	success = base.LocateSubstring("/", &charindex);
	while (success)
		{
		base.RemoveSubstring(1, charindex);
		test.Prepend("../");
		success = base.LocateSubstring("/", &charindex);
		}
	*path = test;
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:47,代码来源:GMailboxUtils.cpp


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