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


C++ JString类代码示例

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


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

示例1: rect

void JAbout::paint(JGraphics g) {
  JCanvas::paint(g);
  int delta = 20;
  JRect rect(0, 0, width, height);
  g.draw3DJRect(rect.shrink(delta, delta), -depth);
  JString text = getText();
  if (text.length()) {
    JFontMetrics fm(g);
    int dx, dy;
    JColor c[14] = { 
      JColor::red, JColor::white, 
      JColor::magenta.darker(), JColor::yellow,
      JColor::orange, JColor::blue,
      JColor::pink, JColor::magenta,
      JColor::orange,
	  JColor::green.darker(),
	  JColor::blue,
	  JColor::magenta.darker(),
	  JColor::blue,
	  JColor::yellow };
    dy = (height-fm.getHeight())/2;
    dx = (width-fm.stringWidth(text))/2;
    g.setJColor(getBackground().brighter());
    g.drawJString(text, dx+1, dy+1);
    g.setJColor(getBackground().darker());
    g.drawJString(text, dx-1, dy-1);
    for (int i=0; i<14; i++) {
      JString ch = text(i, i+1);
      g.setJColor(c[i]);
      g.drawJString(ch, dx, dy);
      dx += fm.stringWidth(ch);
    }
  }
}
开发者ID:neattools,项目名称:neattools,代码行数:34,代码来源:JAbout.cpp

示例2: ExecuteJCCDiff

void
SVNTabBase::Compare
	(
	const JString&	rev,
	const JBoolean	isPrev
	)
{
	SVNPrefsManager::Integration type;
	JString cmd;
	const JBoolean hasCmd =
		(SVNGetPrefsManager())->GetCommand(SVNPrefsManager::kDiffCmd, &type, &cmd);

	if (type == SVNPrefsManager::kCodeCrusader)
		{
		ExecuteJCCDiff(rev, isPrev);
		}
	else if (hasCmd)
		{
		JString r = rev;
		if (!r.IsEmpty())
			{
			r.Prepend("-r ");
			}
		ExecuteDiff(cmd, r, isPrev);
		}
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例3:

void
XDLink::SendRaw
	(
	const JCharacter* text
	)
{
	if (itsLink != NULL)
		{
		JString s = text;
		s.TrimWhitespace();

		JIndex i;
		while (s.LocateSubstring("  ", &i))
			{
			s.ReplaceSubstring(i, i+1, " ");
			}

		itsLink->SendMessage(s);
		itsLink->StartTimer();

		if (!itsDebuggerBusyFlag)
			{
			itsDebuggerBusyFlag = kJTrue;
			Broadcast(DebuggerBusy());
			}

		Broadcast(DebugOutput(s, kCommandType));
		}
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:29,代码来源:XDLink.cpp

示例4:

inline JBoolean
JXFontManager::IsPostscript
	(
	const JString& name
	)
	const
{
#if ONLY_STD_PS_FONTS

	return JI2B(name == "Arial"                     ||	// Helvetica sucks on OS X
				name.BeginsWith("Courier")          ||
				name.BeginsWith("Helvetica")        ||
				name == "Symbol"                    ||
				name == "Times"                     ||
				name.Contains("Bookman")            ||
				name.Contains("Century Schoolbook") ||
				name.Contains("Chancery")           ||
				name.Contains("Palatino"));

#else

	return kJTrue;

#endif
}
开发者ID:,项目名称:,代码行数:25,代码来源:

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

示例6: assert

JXPSPrintSetupDialog*
CBPSPrinter::CreatePrintSetupDialog
	(
	const Destination	destination,
	const JCharacter*	printCmd,
	const JCharacter*	fileName,
	const JBoolean		collate,
	const JBoolean		bw
	)
{
	assert( itsCBPrintSetupDialog == NULL );

	if (itsFontSize == kUnsetFontSize)
		{
		JString fontName;
		CBGetPrefsManager()->GetDefaultFont(&fontName, &itsFontSize);

		JArray<JIndexRange> matchList;
		if (nxmRegex.Match(fontName, &matchList))
			{
			const JString hStr = fontName.GetSubstring(matchList.GetElement(2));
			const JBoolean ok  = hStr.ConvertToUInt(&itsFontSize);
			assert( ok );
			itsFontSize--;
			}
		}

	itsCBPrintSetupDialog =
		CBPSPrintSetupDialog::Create(destination, printCmd, fileName,
									 collate, bw, itsFontSize,
									 (CBGetPTTextPrinter())->WillPrintHeader());
	return itsCBPrintSetupDialog;
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:33,代码来源:CBPSPrinter.cpp

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

示例8: output

JBoolean
JConvertToStream
(
    const int		input,
    ifstream*		input2,
    JString*		tempFullName,
    const JBoolean	closeInput
)
{
    JString data;
    if (!JReadAll(input, &data, closeInput))
    {
        return kJFalse;
    }

    if (!(JCreateTempFile(tempFullName)).OK())
    {
        return kJFalse;
    }

    ofstream output(*tempFullName);
    data.Print(output);
    output.close();

    input2->open(*tempFullName);
    return JI2B(input2->good());
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:27,代码来源:jFStreamUtil.cpp

示例9: GetFileName

void
CBFileNode::OpenComplementFile()
	const
{
	JString fullName;
	if (GetFullName(&fullName))
		{
		const CBTextFileType type = (CBGetPrefsManager())->GetFileType(fullName);
		if (type == kCBHTMLFT || type == kCBXMLFT)
			{
			(JXGetWebBrowser())->ShowFileContent(fullName);
			}
		else
			{
			(CBGetDocumentManager())->OpenComplementFile(fullName, type);
			}
		}
	else
		{
		JString msg = "Unable to find complement of \"";
		msg += GetFileName();
		msg.AppendCharacter('"');
		(JGetUserNotification())->ReportError(msg);
		}
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例10: JStripTrailingDirSeparator

void
JWebBrowser::ShowFileLocation
	(
	const JCharacter* fileName
	)
{
	if (!JStringEmpty(itsShowFileLocationCmd))
		{
		JString fullName = fileName;
		JStripTrailingDirSeparator(&fullName);

		JString path, name;
		JSplitPathAndName(fullName, &path, &name);

		const JCharacter* map[] =
			{
			kFileVarName, fullName,
			kPathVarName, path
			};

		JString s = itsShowFileLocationCmd;
		if (!s.Contains("$"))
			{
			s += " '$";
			s += kFileVarName;
			s += "'";
			}
		(JGetStringManager())->Replace(&s, map, sizeof(map));
		JSimpleProcess::Create(s, kJTrue);
		}
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:31,代码来源:JWebBrowser.cpp

示例11: input

JBoolean
JSearchFile
	(
	const JCharacter*	fileName,
	const JCharacter*	searchStr,
	const JBoolean		caseSensitive,
	JIndex*				lineIndex
	)
{
	ifstream input(fileName);

	*lineIndex = 0;
	while (!input.eof())
		{
		(*lineIndex)++;
		const JString line = JReadLine(input);
		if (input.fail())
			{
			break;
			}
		if (line.Contains(searchStr, caseSensitive))
			{
			return kJTrue;
			}
		}

	return kJFalse;
}
开发者ID:mta1309,项目名称:mulberry-lib-jx,代码行数:28,代码来源:jFileUtil.cpp

示例12: ParseTextOptions

int
main
	(
	int		argc,
	char*	argv[]
	)
{
	ParseTextOptions(argc, argv);

	SymcirApp* app = new SymcirApp(&argc, argv);
	assert( app != NULL );

	JString inputFileName;
	ParseXOptions(argc, argv, &inputFileName);

	if (!inputFileName.IsEmpty() ||
		(JGetChooseSaveFile())->ChooseFile("Netlist to analyze:", NULL, &inputFileName))
		{
		SCCircuitDocument* mainDir = new SCCircuitDocument(app, inputFileName);
		assert( mainDir != NULL );

		mainDir->Activate();
		app->Run();
		}

	return 0;
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:27,代码来源:xsymcir.cpp

示例13: JSplitPathAndName

void
JUpdateCVSIgnore
	(
	const JCharacter* ignoreFullName
	)
{
	JString path, name;
	JSplitPathAndName(ignoreFullName, &path, &name);
	const JString cvsFile = JCombinePathAndName(path, ".cvsignore");

	if (!JFileExists(cvsFile) && JGetVCSType(path) != kJCVSType)
		{
		return;
		}

	JString cvsData;
	JReadFile(cvsFile, &cvsData);
	if (!cvsData.IsEmpty() && !cvsData.EndsWith("\n"))
		{
		cvsData += "\n";
		}

	name += "\n";
	if (!cvsData.Contains(name))
		{
		JEditVCS(cvsFile);
		cvsData += name;

		ofstream output(cvsFile);
		cvsData.Print(output);
		}
}
开发者ID:,项目名称:,代码行数:32,代码来源:

示例14: GetWindow

void
JXButton::SetShortcuts
	(
	const JCharacter* list
	)
{
	JXWindow* w = GetWindow();
	w->ClearShortcuts(this);
	w->InstallShortcuts(this, list);

	const JBoolean wasReturnButton = itsIsReturnButtonFlag;
	itsIsReturnButtonFlag = kJFalse;
	if (list != NULL)
		{
		JString shortcuts = list;
		if (shortcuts.Contains("^M") || shortcuts.Contains("^m"))
			{
			itsIsReturnButtonFlag = kJTrue;
			}
		}

	const JSize borderWidth = GetBorderWidth();
	if (!wasReturnButton && itsIsReturnButtonFlag)
		{
		SetBorderWidth(borderWidth+1);
		}
	else if (wasReturnButton && !itsIsReturnButtonFlag && borderWidth > 0)
		{
		SetBorderWidth(borderWidth-1);
		}

	Refresh();
}
开发者ID:mbert,项目名称:mulberry-lib-jx,代码行数:33,代码来源:JXButton.cpp

示例15: assert

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


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