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


C++ JError::ReportIfError方法代码示例

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


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

示例1: input

GMMIMEParser::GMMIMEParser
	(
	JString*			data,
	const JCharacter*	rootDir
	)
	:
	itsTextSegments(NULL),
	itsTextInfo(NULL),
	itsAttachInfo(NULL),
	itsIsSuccessful(kJTrue),
	itsTextFileIndex(100),
	itsData(data)
{
	std::istrstream input(data->GetCString(), data->GetLength());

	JError err = JCreateTempDirectory(rootDir, kAttachDirPrefix, &itsAttachDir);
	if (!err.OK())
		{
		itsIsSuccessful	= kJFalse;
		err.ReportIfError();
		}

	err = JCreateTempDirectory(rootDir, kTextDirPrefix, &itsTextDir);
	if (!err.OK())
		{
		itsIsSuccessful	= kJFalse;
		err.ReportIfError();
		}

	if (itsIsSuccessful)
		{
		if (!JDirInfo::Create(itsTextDir, &itsTextInfo))
			{
			itsIsSuccessful	= kJFalse;
			err.ReportIfError();
			}
		if (!JDirInfo::Create(itsAttachDir, &itsAttachInfo))
			{
			itsIsSuccessful	= kJFalse;
			err.ReportIfError();
			}
		}

	if (itsIsSuccessful)
		{
		itsTextInfo->ShowHidden(kJTrue);
		itsAttachInfo->ShowHidden(kJTrue);
		Parse(input, itsData->GetLength());
		}
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:50,代码来源:GMMIMEParser.cpp

示例2: fileList

void
CBSearchTextDialog::SearchFiles()
	const
{
	JString searchStr, replaceStr;
	JBoolean searchIsRegex, caseSensitive, entireWord, wrapSearch;
	JBoolean replaceIsRegex, preserveCase;
	JRegex* regex;

	JPtrArray<JString> fileList(JPtrArrayT::kDeleteAll),
					   nameList(JPtrArrayT::kDeleteAll);

	if (GetSearchParameters(
			&searchStr, &searchIsRegex, &caseSensitive, &entireWord, &wrapSearch,
			&replaceStr, &replaceIsRegex, &preserveCase,
			&regex) &&
		BuildSearchFileList(&fileList, &nameList))
		{
		const JError err =
			CBSearchDocument::Create(fileList, nameList,
									 searchStr, itsOnlyListFilesFlag,
									 itsListFilesWithoutMatchFlag);
		err.ReportIfError();
		}
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:25,代码来源:CBSearchTextDialog.cpp

示例3:

JBoolean
SVNPropertiesList::RemoveNextProperty()
{
	if (!itsRemovePropertyCmdList->IsEmpty())
		{
		const JString cmd = *(itsRemovePropertyCmdList->FirstElement());
		itsRemovePropertyCmdList->DeleteElement(1);

		JSimpleProcess* p;
		const JError err = JSimpleProcess::Create(&p, cmd, kJTrue);
		if (err.OK())
			{
			itsProcessList->Append(p);
			ListenTo(p);
			return kJTrue;
			}
		else
			{
			err.ReportIfError();
			return kJFalse;
			}
		}
	else
		{
		if ((GetDirector())->OKToStartActionProcess())
			{
			RefreshContent();
			}

		(GetDirector())->ScheduleStatusRefresh();
		return kJTrue;
		}
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:33,代码来源:SVNPropertiesList.cpp

示例4: JPrepArgForExec

JBoolean
SVNPropertiesList::CreateProperty1()
{
	assert( itsCreatePropertyDialog != NULL );

	const JString prop = JPrepArgForExec(itsCreatePropertyDialog->GetString());
	const JString file = JPrepArgForExec(itsFullName);

	JSubstitute subst;
	subst.DefineVariable("prop_name", prop);
	subst.DefineVariable("file_name", file);

	JString cmd = kPropEditCmd;
	subst.Substitute(&cmd);

	JSimpleProcess* p;
	const JError err = JSimpleProcess::Create(&p, cmd, kJTrue);
	if (err.OK())
		{
		itsProcessList->Append(p);
		ListenTo(p);
		return kJTrue;
		}
	else
		{
		err.ReportIfError();
		return kJFalse;
		}
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:29,代码来源:SVNPropertiesList.cpp

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

示例6: red

void
SVNInfoLog::Execute
	(
	const JCharacter* cmd
	)
{
	(JXGetApplication())->DisplayBusyCursor();

	pid_t pid;
	int outFD, errFD;
	JError err = JExecute(cmd, &pid,
						  kJIgnoreConnection, NULL,
						  kJCreatePipe, &outFD,
						  kJCreatePipe, &errFD);
	if (!err.OK())
		{
		err.ReportIfError();
		return;
		}

	const JFontStyle red(kJTrue, kJFalse, 0, kJFalse, (GetColormap())->GetRedColor());

	JString text;
	JReadAll(errFD, &text);
	SetCurrentFontStyle(red);
	Paste(text);

	JReadAll(outFD, &text);
	SetCurrentFontStyle(JFontStyle());
	Paste(text);
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:31,代码来源:SVNInfoLog.cpp

示例7: iter

void
SVNListBase::RefreshContent()
{
	if (itsProcess != NULL)
		{
		JProcess* p = itsProcess;
		itsProcess  = NULL;

		p->Kill();
		delete p;

		DeleteLinks();
		}
	else
		{
		itsSavedSelection->CleanOut();
		JTableSelection& s = GetTableSelection();
		JTableSelectionIterator iter(&s);
		JPoint cell;
		while (iter.Next(&cell))
			{
			const JString* line = itsLineList->NthElement(cell.y);
			itsSavedSelection->InsertSorted(new JString(ExtractRelativePath(*line)));
			}
		}

	itsDisplayState = SaveDisplayState();
	itsLineList->CleanOut();

	int outFD, errFD;
	JError err = JNoError();
	if ((GetDirector())->HasPath())
		{
		err = JProcess::Create(&itsProcess, GetPath(), itsCmd,
							   kJIgnoreConnection, NULL,
							   kJCreatePipe, &outFD,
							   kJCreatePipe, &errFD);
		}
	else	// working with URL
		{
		err = JProcess::Create(&itsProcess, itsCmd,
							   kJIgnoreConnection, NULL,
							   kJCreatePipe, &outFD,
							   kJCreatePipe, &errFD);
		}

	if (err.OK())
		{
		itsProcess->ShouldDeleteWhenFinished();
		ListenTo(itsProcess);
		(GetDirector())->RegisterActionProcess(this, itsProcess, itsRefreshRepoFlag,
											   itsRefreshStatusFlag, itsReloadOpenFilesFlag);

		SetConnection(outFD, errFD);
		}
	else
		{
		err.ReportIfError();
		}
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:60,代码来源:SVNListBase.cpp

示例8: GetText

JBoolean
JXRegexReplaceInput::InputValid()
{
	if (!JXInputField::InputValid())
		{
		return kJFalse;
		}
	else
		{
		const JString& text = GetText();

		if (!IsRequired() && text.IsEmpty())
			{
			return kJTrue;
			}

		const JError err = itsTestRegex->SetReplacePattern(text);
		if (err.OK())
			{
			return kJTrue;
			}
		else
			{
			err.ReportIfError();
			return kJFalse;
			}
		}
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:28,代码来源:JXRegexReplaceInput.cpp

示例9: GetText

void
JXFLInputBase::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if (sender == itsHistoryMenu && message.Is(JXMenu::kItemSelected))
		{
		const JString origStr = GetText();
		const JString newStr  = itsHistoryMenu->GetItemText(message);
		SetText(newStr);

		const JError err = Apply();
		if (err.OK())
			{
			itsHistoryMenu->AddString(newStr);
			}
		else
			{
			SetText(origStr);
			err.ReportIfError();
			}
		}

	else
		{
		JXInputField::Receive(sender, message);
		}
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:30,代码来源:JXFLInputBase.cpp

示例10: if

JBoolean
JXFSBindingTable::ExtractInputData
	(
	const JPoint& cell
	)
{
	assert( itsTextInput != NULL );

	const JString& s = itsTextInput->GetText();
	JBoolean ok      = itsTextInput->InputValid();

	if (ok && cell.x == kPatternColumn)
		{
		const JFSBinding* b    = itsBindingList->GetBinding(cell.y);
		const JBoolean changed = JI2B(b->GetPattern() != s);

		if (JFSBinding::WillBeRegex(s))
			{
			const JError err = itsTestRegex->SetPattern(s);
			err.ReportIfError();
			ok = err.OK();
			}

		JIndex newIndex;
		if (ok && changed && itsBindingList->SetPattern(cell.y, s, &newIndex))
			{
			JTableSelection& s = GetTableSelection();
			s.ClearSelection();
			s.SelectCell(newIndex, kPatternColumn);
			Broadcast(DataChanged());
			}
		else if (ok && changed)
			{
			ok = kJFalse;

			const JCharacter* map[] =
				{
				"pattern", s.GetCString()
				};
			const JString msg = JGetString(kPatternUsedID, map, sizeof(map));
			(JGetUserNotification())->ReportError(msg);
			}
		}

	else if (ok && cell.x == kCommandColumn &&
			 itsBindingList->SetCommand(cell.y, s))
		{
		Broadcast(DataChanged());
		}

	return ok;
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:52,代码来源:JXFSBindingTable.cpp

示例11: GetDirInfo

void
JXSaveFileDialog::Save
	(
	const JCharacter* path
	)
{
	JDirInfo* dirInfo = GetDirInfo();
	const JError err  = dirInfo->GoTo(path);
	err.ReportIfError();
	if (err.OK() && itsFileNameInput->Focus())
		{
		EndDialog(kJTrue);
		}
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:14,代码来源:JXSaveFileDialog.cpp

示例12: Create

JError
JSimpleProcess::Create
(
    const JCharacter*	cmdStr,
    const JBoolean		detach
)
{
    JSimpleProcess* p;
    const JError err = Create(&p, cmdStr, kJTrue);
    err.ReportIfError();
    if (err.OK() && detach)
    {
        JThisProcess::Ignore(p);
    }
    return err;
}
开发者ID:mta1309,项目名称:mulberry-lib-jx,代码行数:16,代码来源:JSimpleProcess.cpp

示例13: JGetUniqueDirEntryName

void
SyGDuplicateProcess::ProcessNextFile()
{
	if (itsFullNameList.IsEmpty())
		{
		JXDeleteObjectTask<JBroadcaster>::Delete(this);
		return;
		}

	const JString* origName = itsFullNameList.FirstElement();
	JString path, name, root, suffix;
	JSplitPathAndName(*origName, &path, &name);
	if (JSplitRootAndSuffix(name, &root, &suffix))
		{
		suffix.PrependCharacter('.');
		}

	root += "_copy";
	name  = JGetUniqueDirEntryName(path, root, suffix);

	JSplitPathAndName(name, &path, &itsCurrentName);

	const JCharacter* argv[] = { "cp", "-Rdf", *origName, name, NULL };

	JVCSType type;
	if (JIsManagedByVCS(*origName, &type) && type == kJSVNType)
		{
		argv[0] = "svn";
		argv[1] = "cp";
		}

	const JError err = JSimpleProcess::Create(&itsProcess, argv, sizeof(argv));
	err.ReportIfError();
	itsFullNameList.DeleteElement(1);		// before ProcessNextFile()

	if (err.OK())
		{
		ListenTo(itsProcess);
		JThisProcess::Ignore(itsProcess);	// detach so it always finishes
		}
	else
		{
		itsProcess = NULL;
		itsNodeList.RemoveElement(1);
		ProcessNextFile();
		}
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:47,代码来源:SyGDuplicateProcess.cpp

示例14: Apply

JBoolean
JXFLInputBase::OKToUnfocus()
{
	if (!JXInputField::OKToUnfocus())
		{
		return kJFalse;
		}

	const JError err = Apply();
	if (err.OK())
		{
		itsHistoryMenu->AddString(GetText());
		return kJTrue;
		}
	else
		{
		err.ReportIfError();
		return kJFalse;
		}
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:20,代码来源:JXFLInputBase.cpp

示例15: input

int
main
	(
	int		argc,
	char*	argv[]
	)
{
	// find the configuration files

	if (!FindConfigFile(&classMapFile) ||
		!FindConfigFile(&optionMapFile) ||
		!FindConfigFile(&needFontListFile) ||
		!FindConfigFile(&needStringListFile) ||
		!FindConfigFile(&needCreateListFile))
		{
		return 1;
		}

	// parse the command line options

	JString inputName, codePath, stringPath, codeSuffix, headerSuffix;
	JString postCmd;
	JPtrArray<JString> userFormList(JPtrArrayT::kDeleteAll);	// empty => generate all forms
	JPtrArray<JString> backupList(JPtrArrayT::kDeleteAll);		// forms that have been backed up
	GetOptions(argc, argv, &inputName, &codePath, &stringPath,
			   &codeSuffix, &headerSuffix, &postCmd, &userFormList);

	// generate each requested form

	JBoolean changed = kJFalse;

	ifstream input(inputName);
	while (!input.eof() && !input.fail())
		{
		const JString line = JReadLine(input);
		if (line == kBeginFormLine)
			{
			// get form name

			JString formName = JReadLine(input);
			RemoveIdentifier(kFormNameMarker, &formName);

			// look for custom tag

			const JSize formNameLength = formName.GetLength();
			JString tagName            = kDefaultDelimTag;
			JString enclName;
			JIndex tagMarkerIndex;
			if (formName.LocateSubstring(kCustomTagMarker, &tagMarkerIndex) &&
				tagMarkerIndex <= formNameLength - kCustomTagMarkerLength)
				{
				tagName = formName.GetSubstring(
					tagMarkerIndex + kCustomTagMarkerLength, formNameLength);
				formName.RemoveSubstring(tagMarkerIndex, formNameLength);

				// get enclosure name

				const JSize tagNameLength = tagName.GetLength();
				JIndex enclMarkerIndex;
				if (tagName.LocateSubstring(kCustomTagMarker, &enclMarkerIndex) &&
					enclMarkerIndex <= tagNameLength - kCustomTagMarkerLength)
					{
					enclName = tagName.GetSubstring(
						enclMarkerIndex + kCustomTagMarkerLength, tagNameLength);
					tagName.RemoveSubstring(enclMarkerIndex, tagNameLength);
					}

				// report errors

				if (tagName != kDefaultDelimTag)
					{
					if (enclName.IsEmpty())
						{
						cerr << formName << ", " << tagName;
						cerr << ": no enclosure specified" << endl;
						}
					}
				else if (!enclName.IsEmpty() && enclName != kDefTopEnclVarName)
					{
					cerr << formName << ", " << tagName;
					cerr << ": not allowed to specify enclosure other than ";
					cerr << kDefTopEnclVarName << endl;
					}
				}

			if (ShouldGenerateForm(formName, userFormList))
				{
				GenerateForm(input, formName, tagName, enclName,
							 codePath, stringPath, codeSuffix, headerSuffix, &backupList);
				changed = kJTrue;
				}
			}
		}

	if (changed && !postCmd.IsEmpty())
		{
		const JError err = JExecute(postCmd, NULL);
		err.ReportIfError();
		}

//.........这里部分代码省略.........
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:101,代码来源:jxlayout.cpp


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