T FunctionHandlerDDL<T>::operator () (std::vector<std::string> const & args) const { obj_t funcObj = LevelObject::create(); obj_t returnType = LevelObject::create(type_t::type_type(), type_t::type_auto<T>()); funcObj->addObject(name_t::name_return_type, returnType); obj_t argcObj = LevelObject::create(type_t::type_shortint(), int_s_t(args.size())); funcObj->addObject(name_t(key_name_argc()), argcObj); for (size_t index = 0; index < args.size(); ++index) { // TODO: Should make an arg_t for undefined types. obj_t argObj; if (index < _argt.size()) obj_t argObj = LevelObject::create(_argt[index], args[index]); else obj_t argObj = LevelObject::create(type_t::type_string(), string_t(args[index])); name_t argName(parse_name(key_name_arg() + make_string(index))); funcObj->addObject(argName, argObj); } funcObj->addData(_data); obj_t returnValue = funcObj->getObject(name_t::name_return_value); return convert<T, obj_t>(returnValue); }
void fillArgMap( std::string args ) { const std::string &const_args = args; boost::match_results<std::string::const_iterator> results; while( regex_search( const_args, results, RegexCommon::getIdentifierRegex() ) ) { std::string argName( results[0].first, results[0].second ); _argMap.insert( std::make_pair( argName, _argNo++ ) ); args = std::string( results.suffix().first, results.suffix().second ); } }
PlugInArg* getPlugInArgByName(PlugInArgList* pPial, const char* pArgName) { if (pPial == NULL || pArgName == NULL) { setLastError(SIMPLE_BAD_PARAMS); return NULL; } std::string argName(pArgName == NULL ? "" : pArgName); PlugInArg* pArg(NULL); if (!pPial->getArg(argName, pArg)) { setLastError(SIMPLE_NOT_FOUND); return NULL; } setLastError(SIMPLE_NO_ERROR); return pArg; }