您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ AddError函数代码示例

51自学网 2021-06-01 19:40:53
  C++
这篇教程C++ AddError函数代码示例写得很实用,希望能帮到您。

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

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

示例1: AddError

void THISCLASS::OnStep() {	// Check input image	IplImage *inputimage = mCore->mDataStructureInput.mImage;	if (! inputimage) {		return;	}	if (inputimage->nChannels != 1) {		AddError(wxT("This component requires a grayscale input image."));	}	// Prepare the output image	PrepareOutputImage(inputimage);	// Convert	try {		switch (mBayerType) {		case 0 :			cvCvtColor(inputimage, mOutputImage, CV_BayerBG2BGR);			break;		case 1 :			cvCvtColor(inputimage, mOutputImage, CV_BayerGB2BGR);			break;		case 2 :			cvCvtColor(inputimage, mOutputImage, CV_BayerRG2BGR);			break;		case 3 :			cvCvtColor(inputimage, mOutputImage, CV_BayerGR2BGR);			break;		default :			AddError(wxT("Invalid Bayer Pattern Type"));			return;		}	} catch (...) {		AddError(wxT("Conversion from Bayer to BGR failed."));	}	// Set the output image on the color data structure	mCore->mDataStructureImageColor.mImage = mOutputImage;	// Let the Display know about our image	DisplayEditor de(&mDisplayOutput);	if (de.IsActive()) {		de.SetMainImage(mCore->mDataStructureImageColor.mImage);	}}
开发者ID:gctronic,项目名称:swistrack,代码行数:45,


示例2: lua_gettop

int LuaParser::_EventEncounter(std::string package_name, QuestEventID evt, std::string encounter_name, uint32 extra_data,							   std::vector<void*> *extra_pointers) {	const char *sub_name = LuaEvents[evt];		int start = lua_gettop(L);	try {		lua_getfield(L, LUA_REGISTRYINDEX, package_name.c_str());		lua_getfield(L, -1, sub_name);			lua_createtable(L, 0, 0);		lua_pushstring(L, encounter_name.c_str());		lua_setfield(L, -2, "name");		quest_manager.StartQuest(nullptr, nullptr, nullptr);		if(lua_pcall(L, 1, 1, 0)) {			std::string error = lua_tostring(L, -1);			AddError(error);			quest_manager.EndQuest();			return 0;		}		quest_manager.EndQuest();				if(lua_isnumber(L, -1)) {			int ret = static_cast<int>(lua_tointeger(L, -1));			lua_pop(L, 2);			return ret;		}				lua_pop(L, 2);	} catch(std::exception &ex) {		std::string error = "Lua Exception: ";		error += std::string(ex.what());		AddError(error);		//Restore our stack to the best of our ability		int end = lua_gettop(L);		int n = end - start;		if(n > 0) {			lua_pop(L, n);		}	}	return 0;}
开发者ID:mkstarr,项目名称:Server,代码行数:45,


示例3: AddError

bool TParserBase::Consume(const char* text, const char* error){    if (TryConsume(text))        return true;    else {        AddError(error);        return false;    }}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:9,


示例4: AddError

void THISCLASS::OnStop() {	if (mCamera.StopImageAcquisition() != 0) {		AddError(wxT("Could not stop image acquisition."));		return;	}	if (mOutputImage) {		cvReleaseImage(&mOutputImage);	}}
开发者ID:dtbinh,项目名称:swistrackplus,代码行数:9,


示例5: _CheckEmptyEntities

//-----------------------------------------------------------------------------// Purpose: // Input  : pEntity - //			pList - // Output : //-----------------------------------------------------------------------------static BOOL _CheckEmptyEntities(CMapEntity *pEntity, CListBox *pList){	if(!pEntity->IsPlaceholder() && !pEntity->GetChildCount())	{		AddError(pList, ErrorEmptyEntity, (DWORD)pEntity->GetClassName(), pEntity);	}		return(TRUE);}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:15,


示例6: FindDuplicatePlanes

//-----------------------------------------------------------------------------// Purpose: // Input  : pSolid - //			pList - // Output : //-----------------------------------------------------------------------------static BOOL FindDuplicatePlanes(CMapSolid *pSolid, CListBox *pList){	if (DoesContainDuplicates(pSolid))	{		AddError(pList, ErrorDuplicatePlanes, 0, pSolid);	}	return(TRUE);}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:15,


示例7: TEXT

void FWindowsNativeFeedbackContext::Serialize( const TCHAR* V, ELogVerbosity::Type Verbosity, const class FName& Category ){	// if we set the color for warnings or errors, then reset at the end of the function	// note, we have to set the colors directly without using the standard SET_WARN_COLOR macro	if( Verbosity==ELogVerbosity::Error || Verbosity==ELogVerbosity::Warning )	{		if( TreatWarningsAsErrors && Verbosity==ELogVerbosity::Warning )		{			Verbosity = ELogVerbosity::Error;		}		FString Prefix;		if( Context )		{			Prefix = Context->GetContext() + TEXT(" : ");		}		FString Format = Prefix + FOutputDeviceHelper::FormatLogLine(Verbosity, Category, V);		if(Verbosity == ELogVerbosity::Error)		{			// Only store off the message if running a commandlet.			if ( IsRunningCommandlet() )			{				AddError(Format);			}		}		else		{			// Only store off the message if running a commandlet.			if ( IsRunningCommandlet() )			{				AddWarning(Format);			}		}	}	if( GLogConsole && IsRunningCommandlet() )	{		GLogConsole->Serialize( V, Verbosity, Category );	}	if( !GLog->IsRedirectingTo( this ) )	{		GLog->Serialize( V, Verbosity, Category );	}	// Buffer up the output during a slow task so that we can dump it all to the log console if the show log button is clicked	if(GIsSlowTask)	{		FScopeLock Lock(&CriticalSection);		if(hThread != NULL)		{			LogOutput += FString(V) + FString("/r/n");			SetEvent(hUpdateEvent);		}	}}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:56,


示例8: AddError

void CSrScriptErrorView::AddErrors (CSrScriptErrorArray& Errors) {	dword Index;	for (Index = 0; Index < Errors.GetSize(); ++Index) 	{		AddError(Errors.GetAt(Index));	}}
开发者ID:Vuher,项目名称:skyedit,代码行数:10,


示例9: CANAbortCMD

void CANAbortCMD(void){	if((can_Status==CAN_Send)||(can_Status==CAN_Pending)){		Timer0_Stop();		can_queue[can_queue_tail]->cmd=CMD_ABORT;		can_cmd(can_queue[can_queue_tail]);		AddError(ERROR_CAN_SEND);		can_Status=CAN_Ready;		can_queue_tail=(can_queue_tail+1)%CAN_QUEUE_SIZE;	}}
开发者ID:heroichornet,项目名称:dashboard,代码行数:10,


示例10: CANSend

void CANSend(void){	can_queue[can_queue_tail]->cmd=CMD_TX_DATA;	if(can_cmd(can_queue[can_queue_tail])!=CAN_CMD_ACCEPTED){		can_Status=CAN_Ready;		AddError(ERROR_CAN_ACCEPTED);	}else{		CANGIE|=(1<<ENERR);		Timer0_Start();	}}
开发者ID:heroichornet,项目名称:dashboard,代码行数:10,


示例11: StdTitle

    void SampleErrorListing::CreateListing()    {        StdTitle("Sampler Setup Errors");        SC_SetupErr sampErr;        SampVarArray currSamp;        if (currSamp.Size() < 1)        {            sampErr.SetConstantError("at least 1 variable must be sampled");            AddError(sampErr);        }        for (int i = 0; i < currSamp.Size(); i++)            if (!currSamp[i]->SampleSetupOK(sampErr))                AddError(sampErr);        //for FOSM or PEM - check to make sure all vars belong to same corr group        if (!IsMonteCarlo())        {            int uncertCorrGroup = currSamp[0]->GetCorrGroup();            if (!forceCorrelationsToZero)            {                //case where no correlations are set                if ((currSamp[0]->GetnCorrGroup(uncertCorrGroup) > 1) && (currSamp[0]->correlations.Size() == 0))                    AddError("correlations not set or forced to zero");            }            for (int i = 1; i < currSamp.Size(); i++)            {                int currCorrGroup = currSamp[i]->GetCorrGroup();                if (currCorrGroup != uncertCorrGroup)                    AddError("FOSM/PEM: all uncertain vars must belong to same correlation group");                if (!forceCorrelationsToZero)                {                    //case where individual correlations are not set                    for (int j = 0; j < currSamp[i]->correlations.Size(); j++)                    {                        if (RealIsNull(currSamp[i]->correlations[j].correlationValue))                            AddError("correlations not set or forced to zero");                    }                }            }        }    }
开发者ID:jjayne,项目名称:nSIGHTS,代码行数:43,


示例12: GetResultTypeOf

void SecondPass::outNode(StmtIfThenElse* n, bool last){	auto exprType = GetResultTypeOf(n->GetExpr());	if (exprType == nullptr)		return;	if (exprType->name != "bool"){		AddError(n->GetToken(), "Result type of if-else-condition must be 'bool' but is '%s'.", exprType->name.c_str());	}}
开发者ID:JuBan1,项目名称:ScriptSlave2,代码行数:10,


示例13: StdTitle

void DataCaptureErrorListing::CreateListing(){  StdTitle("Simulation Results Setup Errors");  SC_SetupErr dcErr;  if (dataCaptureData.IsEmpty())    AddError("no output data specified");  for (int i = 0; i < dataCaptureData.Size(); i++)    if (dataCaptureData.IsNotValid(i))    {      AddError("Null capture spec found");    }    else    {      if (!dataCaptureData.GetRef(i).SetupOK(dcErr))      {        AddError(dcErr);      }    }  if (productionRestartTimes.Size() > 0)  {    double prev = productionRestartTimes[0];    for (int i = 1; i < productionRestartTimes.Size(); i++)    {      double next = productionRestartTimes[i];      if (RealIsNull(prev) || RealIsNull(next))      {        AddError("Null production restart time found");        break;      }      if (prev >= next)      {        AddError("Production restart times must be ascending");        break;      }    }  }}
开发者ID:nsights,项目名称:nSIGHTS,代码行数:43,


示例14: AddError

bool LWOFile::LoadUVMap(unsigned int iChunkSize){  Layer *pLayer=GetLastLayer();  const char *pChunkEndPos=m_pData+iChunkSize-4;  unsigned short iDimension=0;  if(!ReadU2(iDimension))  {    return false;  }  // not 2 floats per vertex  if(iDimension!=2)  {    // just skip    m_pData+=iChunkSize-4-2;    AddError("Warning: UVMap has "+ConvertToString(iDimension)+" floats per vertex (2 expected)");    return true;  }  unsigned int iStrBytes=0;  std::string strName;  if(!ReadS0(strName,iStrBytes))  {    return false;  }  // VMAP { type[ID4], dimension[U2], name[S0],  //  ( vert[VX], value[F4] # dimension )* }  UVMap *pUVMap=new UVMap();  pUVMap->m_strName=strName;  pUVMap->m_Values.resize(2*pLayer->m_iPoints);  pLayer->m_UVMaps.push_back(pUVMap);  float *pValues=&(pUVMap->m_Values[0]);  memset(pValues,0,sizeof(float)*2*pLayer->m_iPoints);  while(m_pData<pChunkEndPos)  {    unsigned int iVertexID=0;    if(!ReadVX(iVertexID)) return false;    if(iVertexID>=pLayer->m_iPoints) return false;    if(!ReadF4(pValues[iVertexID*2+0])) return false;    if(!ReadF4(pValues[iVertexID*2+1])) return false;    // flip v coordinate    pValues[iVertexID*2+1]=1-pValues[iVertexID*2+1];  }  return true;}
开发者ID:DanielNeander,项目名称:my-3d-engine,代码行数:55,


示例15: check

bool FBlueprintReparentTest::RunTest(const FString& BlueprintAssetPath){	bool bTestFailed = false;	UBlueprint * const BlueprintTemplate = Cast<UBlueprint>(StaticLoadObject(UBlueprint::StaticClass(), NULL, *BlueprintAssetPath));	if (BlueprintTemplate != NULL)	{		// want to explicitly test switching from actors->objects, and vise versa (objects->actors), 		// also could cover the case of changing non-native parents to native ones		TArray<UClass*> TestParentClasses;		if (!BlueprintTemplate->ParentClass->IsChildOf(AActor::StaticClass()))		{			TestParentClasses.Add(AActor::StaticClass());		}		else		{			// not many engine level Blueprintable classes that aren't Actors			TestParentClasses.Add(USaveGame::StaticClass());		}		TArray<FAssetData> Assets;		FBlueprintAutomationTestUtilities::GetAssetListingFromConfig(TEXT("ReparentTest.ParentsPackagePaths"), Assets, UBlueprint::StaticClass());		// additionally gather up any blueprints that we explicitly specify though the config		for (FAssetData const& AssetData : Assets)		{			UClass* AssetClass = FindObject<UClass>(ANY_PACKAGE, *AssetData.AssetClass.ToString());			TestParentClasses.Add(AssetClass);		}		for (UClass* Class : TestParentClasses)		{		 			UBlueprint* BlueprintObj = FBlueprintAutomationTestUtilities::DuplicateBlueprint(BlueprintTemplate);			check(BlueprintObj != NULL);			BlueprintObj->ParentClass = Class;			if (!FBlueprintAutomationTestUtilities::TestSaveBlueprint(BlueprintObj))			{				AddError(FString::Printf(TEXT("Failed to save blueprint after reparenting with %s: '%s'"), *Class->GetName(), *BlueprintAssetPath));				bTestFailed = true;			}			FBlueprintAutomationTestUtilities::UnloadBlueprint(BlueprintObj);		}#if WITH_EDITOR		// clear undo history to ensure that the transaction buffer isn't 		// holding onto any references to the blueprints we want unloaded		GEditor->Trans->Reset(NSLOCTEXT("BpAutomation", "ReparentTest", "Reparent Blueprint Test"));#endif // #if WITH_EDITOR		// make sure the unloaded blueprints are properly flushed (for future tests)		CollectGarbage(RF_Native);	}	return !bTestFailed;}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:55,


示例16: while

Stack<Error>* Corrector::CheckExpression(Lexema *input) {	int i = 0;	int count_bracket = 0;	while (input[i].GetType() != Type_Lexems::terminal) {		if (IsDigit(input[i])) {			if(IsDigitRight(input[i]) == false){				AddError(input[i].GetPosition(), "Ошибка в числе. Позиция ошибки: ");			}		}		if (IsBinaryOperaion(input[i]))		{			if (input[i+1].GetType() == Type_Lexems::terminal)			{				AddError(input[i].GetPosition(), "Ошибка в бинарной операции. Позиция ошибки: ");			}			if (input[i + 1].GetType() != Type_Lexems::terminal && IsBinaryOperaion(input[i+1])) {				AddError(input[i].GetPosition(), "Ошибка в повторе бинарной операций. Позиция ошибки: ");			}			if (input[i + 1].GetType() != Type_Lexems::terminal && input[i + 1].GetType() == Type_Lexems::close_bracket) {				AddError(input[i].GetPosition(), "Ошибка в бинарной операции, пропущен аргумент. Позиция ошибки: ");			}		}		if (IsOperationUnary(input[i]))		{			if (input[i + 1].GetType() == Type_Lexems::terminal) {				AddError(input[i].GetPosition(), "Ошибка в унарной операции. Позиция ошибки: ");			}			if (input[i + 1].GetType() != Type_Lexems::terminal && input[i + 1].GetType() == Type_Lexems::close_bracket)			{				AddError(input[i].GetPosition(), "Ошибка в унарной операции, пропущен аргумент. Позиция ошибки: ");			}		}		if (IsOpenBracket(input[i]))		{			count_bracket++;		}		if (IsCloseBracket(input[i]))		{			count_bracket--;			if (count_bracket<0)			{				AddError(input[i].GetPosition(), "Ошибка в закрывающей скобке. Позиция ошибки: ");			}		}		i++;	}	if (count_bracket != 0)	{		AddError("Ошибка в скобках.");	}	return &errors;}
开发者ID:SemenBevzuk,项目名称:mp2-lab3-arithmetic,代码行数:52,


示例17: GetConfigurationInt

void THISCLASS::OnReloadConfiguration() {	mMinArea = GetConfigurationInt(wxT("MinArea"), 1);	mMaxArea = GetConfigurationInt(wxT("MaxArea"), 1000);	mMaxNumber = GetConfigurationInt(wxT("MaxNumber"), 10);	mAreaSelection = GetConfigurationBool(wxT("AreaBool"), false);	mMinCompactness = GetConfigurationDouble(wxT("MinCompactness"), 1);	mMaxCompactness = GetConfigurationDouble(wxT("MaxCompactness"), 1000);	mCompactnessSelection = GetConfigurationBool(wxT("CompactnessBool"), false);	mMinOrientation = GetConfigurationDouble(wxT("MinOrientation"), -90);	mMaxOrientation = GetConfigurationDouble(wxT("MaxOrientation"), 90);	mOrientationSelection = GetConfigurationBool(wxT("OrientationBool"), false);	// Check for stupid configurations	if (mMaxNumber < 1) {		AddError(wxT("Max number of particles must be greater or equal to 1"));	}	if (mMinArea > mMaxArea) {		AddError(wxT("The min area must be smaller than the max area."));	}}
开发者ID:dtbinh,项目名称:swistrackplus,代码行数:20,


示例18: ClearError

/////////////////////////////////////////////////////      GetValue///////////////////////////////////////////////////float CAnalogIO::GetValue(bool updateFirst ){    float retVal = ANALOG_ERRVAL;    if (!updateFirst)    {        return m_LastVal;    }        if (m_IsInput)    {        if (m_ReadCurrent)        {            int currentRegister;                        //Read current            currentRegister = ((CDS2438*)(m_InDevice))->ReadCurrentRegister();            //Con i ritaratori serie CLIMA vado fuori scala            if (currentRegister > 1023)            {                currentRegister = 1023;            }                        retVal = (float)(currentRegister/(4096.0*m_ResistorValue));                    }        else        {            //The maximum range of the NTH-AFO-AI is 0-5V so we have to scale the value            retVal = ((CDS2438*)(m_InDevice))->ReadVoltage( false )*2.0;        }    }    else    {        retVal = (float)( ((CDS2890*)(m_InDevice))->ReadPosition() );                //Transform the position in volts        retVal = (255.0 - retVal)/25.5;    }        if (retVal >= 0)    {        //Scalo il valore        retVal = retVal*m_ScaleFactor+m_OffsetValue;        m_LastVal = retVal;        ClearError();    }    else    {        AddError();    }        return retVal;}
开发者ID:embeddedspecialist,项目名称:RaspyMonitor,代码行数:57,


示例19: CANAddSendData

void CANAddSendData(st_cmd_t* Tx){	if((can_queue_head+1)%CAN_QUEUE_SIZE!=can_queue_tail){		can_queue[can_queue_head]=Tx;		can_queue_head=(can_queue_head+1)%CAN_QUEUE_SIZE;	}else{		AddError(ERROR_CANQUEUE_FULL);	}	if(can_Status==CAN_Ready){		CANSendData();	}}
开发者ID:heroichornet,项目名称:dashboard,代码行数:11,


示例20: GetConfigurationString

void THISCLASS::OnStart() {	wxString filename_string = GetConfigurationString(wxT("BackgroundImage"), wxT(""));	wxFileName filename = mCore->GetProjectFileName(filename_string);	if (filename.IsOk()) {		mBackgroundImage = cvLoadImage(filename.GetFullPath().mb_str(wxConvFile), CV_LOAD_IMAGE_ANYDEPTH | CV_LOAD_IMAGE_ANYCOLOR);	}	if (! mBackgroundImage) {		AddError(wxT("Cannot open background image."));		return;	}	if (mBackgroundImage->nChannels != 3)	{		AddError(wxT("Background Image has not 3 channels"));		return;	}	// load other parameters:	OnReloadConfiguration();}
开发者ID:dtbinh,项目名称:swistrackplus,代码行数:20,


示例21: NextToken

bool TParserBase::ConsumeString(Stroka* output, const char* error){    if (LookingAtType(Tokenizer::TYPE_STRING)) {        Tokenizer::ParseString(CurrentToken().text, output);        NextToken();        return true;    } else {        AddError(error);        return false;    }}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:11,


示例22: CheckRequirements

//-----------------------------------------------------------------------------// Purpose: // Input  : pList - //			pWorld - //-----------------------------------------------------------------------------static void CheckRequirements(CListBox *pList, CMapWorld *pWorld){	// ensure there's a player start .. 	if(pWorld->EnumChildren(ENUMMAPCHILDRENPROC(FindPlayer), 0, 		MAPCLASS_TYPE(CMapEntity)))	{		// if rvl is !0, it was not stopped prematurely.. which means there is 		// NO player start.		AddError(pList, ErrorNoPlayerStart, 0);	}}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:16,


示例23: YASSERT

bool TParserBase::ConsumeDoubleSymbol(const char* symbols, const char* error){    YASSERT(strlen(symbols) == 2);    // symbols should follow one another without whitespace between,    // so we are checking positions.    if (!TryConsume(symbols[0]) || !AdjacentToPrevious() || !TryConsume(symbols[1])) {        AddError(error);        return false;    }    return true;}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:12,


示例24: AddError

void THISCLASS::OnStep() {	// Get the input image	IplImage* inputimage = mCore->mDataStructureImageGray.mImage;	if (! inputimage) {		AddError(wxT("No image on selected input."));		return;	}	// Calculate non-zero elements	if (mCalculateNonZero) {		int non_zero= cvCountNonZero(inputimage);		CommunicationMessage m(wxT("STATS_NONZERO"));		m.AddInt(non_zero);		mCore->mCommunicationInterface->Send(&m);	}	// Calculate sum	if (mCalculateSum) {		CvScalar sum= cvSum(inputimage);		CommunicationMessage m(wxT("STATS_SUM"));		m.AddDouble(sum.val[0]);		mCore->mCommunicationInterface->Send(&m);	}	// Calculate mean and standard deviation	if (mCalculateMeanStdDev) {		CvScalar mean;		CvScalar std_dev;		cvAvgSdv(inputimage, &mean, &std_dev, NULL);		CommunicationMessage m(wxT("STATS_MEANSTDDEV"));		m.AddDouble(mean.val[0]);		m.AddDouble(std_dev.val[0]);		mCore->mCommunicationInterface->Send(&m);	}	// Calculate min and max	if (mCalculateMinMax) {		double min_val;		double max_val;		cvMinMaxLoc(inputimage, &min_val, &max_val, NULL, NULL, NULL);		CommunicationMessage m(wxT("STATS_MINMAX"));		m.AddDouble(min_val);		m.AddDouble(max_val);		mCore->mCommunicationInterface->Send(&m);	}	// Set the display	DisplayEditor de(&mDisplayOutput);	if (de.IsActive()) {		de.SetMainImage(inputimage);	}}
开发者ID:dtbinh,项目名称:swistrackplus,代码行数:52,


示例25: DO

bool TGztParser::ParseChainedFieldValues(TFieldValueDescriptorProto* value){    DO(ParseSingleFieldValue(value));    // try read several more values, interleaved with "+" or "|"    if (!LookingAtListDelimiter())        return true;    // What was previously read into @value was actually a first item of chained list,    // not a single value. So transform @value to a list and place its current content    // as first sub-value of this list.    // Re-use previuosly allocated items    THolder<TFieldValueDescriptorProto> sub_value;    if (value->mutable_list()->mutable_value()->ClearedCount() > 0) {        sub_value.Reset(value->mutable_list()->mutable_value()->ReleaseCleared());        sub_value->CopyFrom(*value);        //sub_value->Swap(value);    -- Swap is unsafe here because it creates cycles for some reason!    }    else        sub_value.Reset(new TFieldValueDescriptorProto(*value));    value->Clear();    value->set_type(TFieldValueDescriptorProto::TYPE_LIST);    value->mutable_list()->mutable_value()->AddAllocated(sub_value.Release());    // only single kind of separating token is allowed at single chained list.    // so next we only accept a delimiters of same level which are equal to the first one.    Stroka delimiter = CurrentToken().text;    if (delimiter == "|")        value->mutable_list()->set_type(TValuesListDescriptorProto::PIPE_DELIMITED);    else if (delimiter == "+")        value->mutable_list()->set_type(TValuesListDescriptorProto::PLUS_DELIMITED);    else        YASSERT(false);    const char* delim_text = delimiter.c_str();    while (TryConsume(delim_text))        DO(ParseSingleFieldValue(value->mutable_list()->add_value()));    // it is an error to meet any list delimiter here (as it will be mixed with previuos delimiters).    if (!LookingAtListDelimiter())        return true;    else {        AddError(Substitute("Distinct kinds of delimiters (/"$0/" and /"$1/") "                            "should not be mixed in a single chained list at same level.",                            delimiter, CurrentToken().text));        return false;    }}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:52,


示例26: GetConfigurationString

void THISCLASS::OnStart() {	// Load the background image	wxString filename_string = GetConfigurationString(wxT("BackgroundImage"), wxT(""));	wxFileName filename = mCore->GetProjectFileName(filename_string);	if (filename.IsOk()) {		mBackgroundImage = cvLoadImage(filename.GetFullPath().mb_str(wxConvFile), CV_LOAD_IMAGE_ANYDEPTH | CV_LOAD_IMAGE_ANYCOLOR);	}	if (! mBackgroundImage) {		AddError(wxT("Cannot open background image."));		return;	}	// Check the background image	// We explicitely do not convert image to grayscale automatically, as this is likely to be a configuration error of the user (e.g. wrong background selected). In addition, the user can easily convert a file to grayscale.	if (mBackgroundImage->nChannels != 1) {		AddError(wxT("Background image is not grayscale."));		return;	}	// Read the reloadable parameters	OnReloadConfiguration();}
开发者ID:dtbinh,项目名称:swistrackplus,代码行数:22,



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


C++ AddEscortState函数代码示例
C++ AddEnum函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。