本文整理汇总了C++中ParamList::size方法的典型用法代码示例。如果您正苦于以下问题:C++ ParamList::size方法的具体用法?C++ ParamList::size怎么用?C++ ParamList::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParamList
的用法示例。
在下文中一共展示了ParamList::size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParamsFindP
//==================================================================
bool ParamsFindP( ParamList ¶ms,
const SymbolList &globalSymbols,
DVec<Float3> &out_vectorP,
int fromIdx )
{
bool gotP = false;
for (size_t i=fromIdx; i < params.size(); i += 2)
{
DASSERT( params[i].type == Param::STR );
const Symbol* pSymbol = globalSymbols.FindSymbol( params[i] );
if ( pSymbol && pSymbol->IsName( "P" ) )
{
DASSTHROW( (i+1) < params.size(), "Invalid number of arguments" );
const FltVec &fltVec = params[ i+1 ].NumVec();
DASSTHROW( (fltVec.size() % 3) == 0, "Invalid number of arguments" );
out_vectorP.resize( fltVec.size() / 3 );
for (size_t iv=0, id=0; iv < fltVec.size(); iv += 3)
out_vectorP[id++] = Float3( &fltVec[ iv ] );
return true;
}
}
return false;
}
示例2: write_params
void c_cg::write_params(const ParamList& params) {
if (params.size()) {
get_pipe()('(');
for (uint i = 0; i < params.size() - 1; ++i) {
write_type(params[i].type);
get_pipe()(',');
}
write_type(params.back().type);
get_pipe()(')');
} else {
get_pipe()("(void)");
}
}
示例3: Option
//------------------------------------------------------------------------------
// Test for parameter list handling, using RiOption as a proxy.
//
RtVoid MockRenderer::Option(RtConstToken name, const ParamList& pList)
{
CheckParams() << Req("Option") << name << pList;
// Check that the parameter list token count is correct. Note that the
// formula used below assumes there's only one Req in the token stream.
BOOST_CHECK_EQUAL(2*pList.size(), g_fixture->tokens.size() - 2);
}
示例4: matchParameters
void RecursiveDescentParser::matchParameters(FunctionEntry* fEntry, ParamList* &callerParams, Token tk) {
if(fEntry->getEntryType()!=TableEntry::FUNCTION) return;
int paramCount = 1;
ParamList* declParams = fEntry->getParamaterList();
ParamList::iterator j=callerParams->begin();
for(ParamList::iterator i=declParams->begin();
i!=declParams->end();
++i)
{
if(j==callerParams->end()) {
std::stringstream errorMsg;
errorMsg << "Function '" << fEntry->getName() << "' does not take "
<< paramCount-1 << " parameter(s)";
errorHandler(errorMsg.str(), tk);
return;
}
if((*i)->getType() != (*j)->getType()) {
std::stringstream errorMsg;
errorMsg << "Parameter " << paramCount << " should be of type "
<< (((*i)->getType()==T_INT)? "'int'" : "'char'");
errorHandler(errorMsg.str(), tk);
}
if((*i)->getAttribute() != (*j)->getAttribute()) {
std::stringstream errorMsg;
errorMsg << "Parameter " << paramCount << " should "
<< (((*i)->getAttribute()==VA_SIMPLE)? "not " : "")
<< "be an array";
errorHandler(errorMsg.str(), tk);
}
++paramCount;
++j;
}
if(j!=callerParams->end()) {
std::stringstream errorMsg;
errorMsg << "Function '" << fEntry->getName() << "' only takes "
<< declParams->size() << " parameter(s)";
errorHandler(errorMsg.str(), tk);
}
}
示例5: FindParam
//==================================================================
int FindParam( const char *pFindName,
u_int expectedType,
u_int altExpectedType,
int fromIdx,
ParamList ¶ms )
{
int n = (int)params.size() - 1;
for (int i=fromIdx; i < n; i += 2)
{
DASSERT( params[i].type == Param::STR );
if ( 0 == strcasecmp( pFindName, params[i] ) )
{
if ( params[i+1].type == expectedType ||
params[i+1].type == altExpectedType )
return i+1;
else
return -1;
}
}
return -1;
}