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


C++ ArgumentList::size方法代码示例

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


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

示例1: onReadyRead

void UDPEchoClient::onReadyRead () {
	{
		LockGuard guard (mMutex);
		if (mState != WAIT) return; // ignoring; timeout.
		// Check protocol
		String from;
		int fromPort;
		ByteArrayPtr data = mSocket.recvFrom(&from,&fromPort);
		if (!data) {
			Log (LogWarning) << LOGID << "Could not read any data tough readyRead() signal" << std::endl;
			return; // ?
		}
		String toParse (data->const_c_array(), data->size());
		ArgumentList list;
		sf::argSplit (toParse, &list);
		// Format: TOKEN IP-Address Port
		if (list.size() != 4 || list[0] != "condataReply") {
			Log (LogInfo) << LOGID << "Invalid protocol in answer " << *data << ", token=" << list.size() <<  std::endl;
			return;   // invalid protocol
		}
		if (list[1] != mToken){
			Log (LogInfo) << LOGID << "Token mismatch in answer " << *data << std::endl;
			return; // invalid token
		}
		mState = READY;
		mAddress = list[2];
		mPort = atoi (list[3].c_str());
		Log (LogInfo) << LOGID << "Successfully decoded echo answer: " << mAddress << ":" << mPort << " coming from " << from << ":" << fromPort << std::endl;
		sf::cancelTimer(mTimeoutHandle);
	}
	mResultDelegate (NoError);
}
开发者ID:nob13,项目名称:schneeflocke,代码行数:32,代码来源:UDPEchoClient.cpp

示例2: InsertMacro

void InsertMacro(CMacro* Macro, std::wstring& Args)
{
	tTextData Text;
	ArgumentList Arguments;

	splitArguments(Arguments,Args);

	if ((int)Arguments.size() != Macro->getArgumentCount())
	{
		Logger::printError(Logger::Error,L"%s macro arguments (%d vs %d)",
			(int)Arguments.size() > Macro->getArgumentCount() ? L"Too many" : L"Not enough",
			Arguments.size(),Macro->getArgumentCount());
		return;
	}

	Global.MacroNestingLevel++;
	if (Global.MacroNestingLevel == ASSEMBLER_MACRO_NESTING_LEVEL)
	{
		Logger::printError(Logger::Error,L"Maximum macro nesting level reached");
		return;
	}

	int MacroCounter = Macro->getIncreaseCounter();

	for (int i = 0; i < Macro->getLineCount(); i++)
	{
		Text.buffer = Macro->getLine(i,Arguments,MacroCounter);
		Text.buffer = Global.symbolTable.insertEquations(Text.buffer,Global.FileInfo.FileNum,Global.Section);

		if (CheckEquLabel(Text.buffer) == false)
		{
			Text.buffer = checkLabel(Text.buffer,false);
			splitLine(Text.buffer,Text.name,Text.params);
			if (Text.name.size() == 0) continue;

			bool macro = false;
			for (size_t i = 0; i < Global.Macros.size(); i++)
			{
				if (Text.name.compare(Global.Macros[i]->getName()) == 0)
				{
					InsertMacro(Global.Macros[i],Text.params);
					macro = true;
				}
			}
			if (macro == true) continue;

			if (Arch->AssembleDirective(Text.name,Text.params) == false)
			{
				Arch->AssembleOpcode(Text.name,Text.params);
			}
		}
	}
	Global.MacroNestingLevel--;
}
开发者ID:kabochi,项目名称:armips,代码行数:54,代码来源:Assembler.cpp

示例3: Invoke

            Variant Invoke(Variant &obj, const ArgumentList &arguments) override
            {
                UAssert( arguments.size( ) == THIS_ARG_COUNT,
                    "Invalid method arguments.\nExpected %i args but got %i.",
                    THIS_ARG_COUNT,
                    arguments.size( )
                );

                invoke<void, ArgTypes...>( obj, arguments );

                return { };
            }
开发者ID:AustinBrunkhorst,项目名称:CPP-Reflection,代码行数:12,代码来源:VoidMethodInvoker.hpp

示例4: getFullPathName

CDirectiveIncbin::CDirectiveIncbin(ArgumentList& args)
{
	fileName = getFullPathName(args[0].text);

	if (fileExists(fileName) == false)
	{
		Logger::printError(Logger::FatalError,L"File %s not found",fileName);
		return;
	}

	int inputFileSize = fileSize(fileName);
	if (args.size() >= 2)
	{
		// load start address
		if (ConvertExpression(args[1].text,startAddress) == false)
		{
			Logger::printError(Logger::FatalError,L"Invalid start address %s",args[1].text);
			return;
		}

		if (startAddress >= inputFileSize)
		{
			Logger::printError(Logger::Error,L"Start address 0x%08X after end of file",startAddress);
			return;
		}

		if (args.size() >= 3)
		{
			// load size too
			if (ConvertExpression(args[2].text,loadSize) == false)
			{
				Logger::printError(Logger::FatalError,L"Invalid size %s",args[1].text);
				return;
			}

			if (startAddress+loadSize > inputFileSize)
			{
				Logger::printError(Logger::Warning,L"Loading beyond file end, truncating");
				loadSize =  inputFileSize-startAddress;
			}
		} else {
			loadSize =  inputFileSize-startAddress;
		}
	} else {
		startAddress = 0;
		loadSize = inputFileSize;
	}

	g_fileManager->advanceMemory(loadSize);
}
开发者ID:kabochi,项目名称:armips,代码行数:50,代码来源:CDirectiveFile.cpp

示例5: measured_response_time

bool measured_response_time(
  const char* name,
  ArgumentList const& arguments,
  EvalState &state,
  Value& result)
{

  result.SetErrorValue();
  std::string queue_id;
  int mode = 0, seconds = 0;
  // we check to make sure that we are passed at least one argument
  if (arguments.size() <= 1) {
    return false;
  } else {
    Value arg[3];
    if (!(arguments[0]->Evaluate(state, arg[0]) && arg[0].IsStringValue(queue_id))) {
      return false;
    }
    if (!(arguments[1]->Evaluate(state, arg[1]) && arg[1].IsIntegerValue(mode))) {
      return false;
    }
    if (!(arguments[2]->Evaluate(state, arg[2]) && arg[2].IsIntegerValue(seconds))) {
      return false;
    }
  }

  if (mode) {
    result.SetRealValue(lb_statistics(queue_id, avg, seconds));
  } else {
    result.SetRealValue(lb_statistics(queue_id, std_dev, seconds));
  }

  return true;
}
开发者ID:italiangrid,项目名称:wms,代码行数:34,代码来源:measured_response_time.cpp

示例6: DirectiveData

bool DirectiveData(ArgumentList& List, int flags)
{
	bool ascii = false;

	if (flags & DIRECTIVE_DATA_ASCII)
	{
		ascii = true;
		flags &= ~DIRECTIVE_DATA_ASCII;
	}

	bool hasNonAscii = false;
	for (size_t i = 0; i < List.size(); i++)
	{
		if (List[i].isString)
		{
			for (size_t k = 0; k < List[i].text.size(); k++)
			{
				if (List[i].text[k] >= 0x80)
					hasNonAscii = true;
			}
		}
	}

	if (hasNonAscii)
		Logger::printError(Logger::Warning,L"Non-ASCII character in data directive. Use .string instead");

	CDirectiveData* Data = new CDirectiveData(List,flags,ascii);
	AddAssemblerCommand(Data);
	return true;
}
开发者ID:Blade2187,项目名称:armips,代码行数:30,代码来源:Directives.cpp

示例7: clearOutputAgumentValues

void Action::clearOutputAgumentValues() {
  ArgumentList *outArgList = getOutputArgumentList();
  int nArgs = outArgList->size();
  for (int n = 0; n < nArgs; n++) {
    Argument *arg = outArgList->getArgument(n);
    arg->setValue("");
  }
}
开发者ID:SrihariLibre,项目名称:CyberLink4CC,代码行数:8,代码来源:Action.cpp

示例8: call

double Calculator::call(Lexer& lexer, string name)
{
    SymEntry* sym = symbols.Get(name);
    if(!sym)
    {
        throw Error::SyntaxError("undefined function "+name);
    }

    ArgumentList args = arguments(lexer);

    switch(sym->type)
    {
    case SymEntry::SYS_FUNC:
    {
        SymSysFunc* sFunc = static_cast<SymSysFunc*>(sym);
        if(args.size() != 1)
            throw Error::SyntaxError("incorrect number of arguments");
        return sFunc->func(args[0]);
    }
    case SymEntry::USR_FUNC:
    {
        SymUsrFunc* uFunc = static_cast<SymUsrFunc*>(sym);
        if(args.size() != uFunc->params.size())
            throw Error::SyntaxError("incorrect number of arguments");
        map<string,double> argMap;
        for(unsigned int i = 0; i < uFunc->params.size(); i++)
        {
            argMap[uFunc->params[i]] = args[i];
        }
        for(TokenList::const_iterator i = uFunc->func.begin(); i != uFunc->func.end(); i++)
        {
            Token tok = *i;
            if(tok.Type == Token::NAME && argMap.count(tok.StringValue) > 0)
            {
                Token val(Token::NUMBER, argMap[tok.StringValue]);
                lexer.push(val);
            }
            else
                lexer.push(*i);
        }
        return expr(lexer);
    }
    default:
        throw Error::SyntaxError("not a function: "+name);
    }
}
开发者ID:Nobody-7,项目名称:tcpppl_answers,代码行数:46,代码来源:parser.cpp

示例9: loadArguments

void CMacro::loadArguments(ArgumentList& argumentList)
{
	name = argumentList[0].text;

	for (size_t i = 1; i < argumentList.size(); i++)
	{
		arguments.push_back(argumentList[i].text);
	}
}
开发者ID:JSE324,项目名称:armips,代码行数:9,代码来源:CMacro.cpp

示例10:

DirectiveObjImport::DirectiveObjImport(ArgumentList& args)
{
	if (rel.init(args[0].text))
	{
		rel.exportSymbols();

		if (args.size() == 2)
			rel.writeCtor(args[1].text);
	}
}
开发者ID:kabochi,项目名称:armips,代码行数:10,代码来源:CDirectiveFile.cpp

示例11: malloc

CDirectiveData::CDirectiveData(ArgumentList& Args, int SizePerUnit, bool asc)
{
	TotalAmount = Args.size();
	StrAmount = 0;
	ExpAmount = 0;
	for (int i = 0; i < TotalAmount; i++)
	{
		if (Args[i].isString == true)
		{
			StrAmount++;
		} else {
			ExpAmount++;
		}
	}

	Entries = (tDirectiveDataEntry*) malloc(TotalAmount*sizeof(tDirectiveDataEntry));
	ExpData = new CExpressionCommandList[ExpAmount];
	
	switch (SizePerUnit)
	{
	case 1: case 2: case 4:
		UnitSize = SizePerUnit;
		ascii = asc;
		break;
	default:
		Logger::printError(Logger::Error,L"Invalid data unit size %d",SizePerUnit);
		return;
	}

	int ExpNum = 0;
	SpaceNeeded = 0;
	for (int i = 0; i < TotalAmount; i++)
	{
		if (Args[i].isString == true)
		{
			std::string tt = convertWStringToUtf8(Args[i].text);
			char* t = (char*) tt.c_str();

			int len = strlen(t);
			Entries[i].String = true;
			Entries[i].num = StrData.GetCount();
			StrData.AddEntry((unsigned char*)t,len);
			SpaceNeeded += len*UnitSize;
		} else {
			Entries[i].String = false;
			Entries[i].num = ExpNum;

			if (initExpression(ExpData[ExpNum++],Args[i].text) == false)
				return;

			SpaceNeeded += UnitSize;
		}
	}
	g_fileManager->advanceMemory(SpaceNeeded);
}
开发者ID:Blade2187,项目名称:armips,代码行数:55,代码来源:CDirectiveData.cpp

示例12: triple

static bool triple(
	const char         *,
	const ArgumentList &arguments,
	EvalState          &state,
	Value              &result)
{
	Value	arg;
	
	// takes exactly one argument
	if( arguments.size() > 1 ) {
		result.SetErrorValue( );
		return true;
	}
	if( !arguments[0]->Evaluate( state, arg ) ) {
		result.SetErrorValue( );
		return false;
	}

	switch( arg.GetType( ) ) {
		case Value::UNDEFINED_VALUE:
			result.SetUndefinedValue( );
			return true;

		case Value::ERROR_VALUE:
		case Value::CLASSAD_VALUE:
		case Value::LIST_VALUE:
		case Value::SLIST_VALUE:
		case Value::STRING_VALUE:
		case Value::ABSOLUTE_TIME_VALUE:
		case Value::RELATIVE_TIME_VALUE:
		case Value::BOOLEAN_VALUE:
			result.SetErrorValue( );
			return true;

		case Value::INTEGER_VALUE:
			int int_value;

			arg.IsIntegerValue(int_value);
			result.SetIntegerValue(3 * int_value);
			return true;

		case Value::REAL_VALUE:
			{
				double real_value;
				arg.IsRealValue( real_value );
				result.SetRealValue(3 * real_value);
				return true;
			}
		
		default:
			return false;
	}

	return false;
}
开发者ID:AlainRoy,项目名称:htcondor,代码行数:55,代码来源:extra_tests.cpp

示例13: getArgumentList

Argument *Action::getArgument(const std::string &name) {
  ArgumentList *argList = getArgumentList();
  int nArgs = argList->size();
  for (int n = 0; n < nArgs; n++) {
    Argument *arg = argList->getArgument(n);
    const char *argName = arg->getName();
    if (argName == NULL)
      continue;
    string argNameStr = argName;
    if (argNameStr.compare(name) == 0)
      return arg;
  }
  return NULL;
}
开发者ID:SrihariLibre,项目名称:CyberLink4CC,代码行数:14,代码来源:Action.cpp

示例14: DirectiveOpen

bool DirectiveOpen(ArgumentList& list, int flags)
{
	if (list.size() == 2)
	{
		// open
		CDirectiveFile* command = new CDirectiveFile(CDirectiveFile::Open,list);
		AddAssemblerCommand(command);
	} else {
		// copy
		CDirectiveFile* command = new CDirectiveFile(CDirectiveFile::Copy,list);
		AddAssemblerCommand(command);
	}
	return true;
}
开发者ID:Blade2187,项目名称:armips,代码行数:14,代码来源:Directives.cpp

示例15: listAttrRegEx

bool listAttrRegEx(const char         *name,
			  const ArgumentList &arguments,
			  EvalState          &state,
			  Value              &result)
{
  bool  eval_successful = false;
  result.SetErrorValue();
  // We check to make sure that we passed exactly two arguments...
  if (arguments.size() == 2) {
    
    Value       arg1;
    std::string pattern;
    // ...the first argument should evaluate to a string value...
    if (arguments[0] -> Evaluate(state, arg1) &&
	arg1.IsStringValue(pattern)) {
      // ...the second argument should be an attribute reference
      if (arguments[1] -> GetKind() == ExprTree::ATTRREF_NODE) {
	
	// Now we compile the pattern...
	regex_t re;
	if( !regcomp( &re, pattern.c_str(), REG_EXTENDED|REG_NOSUB ) ) {
	  std::vector<std::string> attrs;
	  deep_find_attribute_if(&attrs, arguments[1], match_pattern(&re));
	  // if there is no matching attribute then the undefined
	  // value should be returned as result. Otherwise we have 
	  // to create an exprlist containing the quoted names of
	  // the attributes matching the regex...
	  eval_successful = !attrs.empty();
	  
	  if (!eval_successful) result.SetUndefinedValue();
	  else {
	    std::vector<ExprTree*> attrsList;
	    for(std::vector<std::string>::const_iterator a=attrs.begin();
		a != attrs.end(); a++) {
	      Value value;
	      value.SetStringValue(*a);
	      attrsList.push_back( Literal::MakeLiteral(value) );
	    }
	    ExprList* e = ExprList::MakeExprList(attrsList);
	    e->SetParentScope(state.curAd);
	    result.SetListValue(e);
	  }
	  // dispose memory created by regcomp()
	  regfree( &re );
	}
      }
    }
  }
  return eval_successful;
}
开发者ID:italiangrid,项目名称:org.glite.wms,代码行数:50,代码来源:listAttrRegEx.cpp


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