本文整理汇总了C++中Arg::GetType方法的典型用法代码示例。如果您正苦于以下问题:C++ Arg::GetType方法的具体用法?C++ Arg::GetType怎么用?C++ Arg::GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Arg
的用法示例。
在下文中一共展示了Arg::GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processMethodDecl
int processMethodDecl(Method *m, string& buf)
{
cout << "------Begin processMethodDecl------"<< endl;
readTemplateFile("/home/shankar/Dropbox/ASU_Courses/SmartHome/home_automation/smartgateway/codegen/template/smartobject_method_decl.template",
buf);
/* buf has the file data */
std::string::const_iterator start, end;
boost::regex exp("\\?<(\\w+)>");
boost::match_results<std::string::const_iterator> what;
boost::match_flag_type flags = boost::match_default;
start = buf.begin();
end = buf.end();
while (regex_search(start, end, what, exp, flags))
{
string res = string(what[0].first, what[0].second);
string command = string(what[1].first, what[1].second);
cout << "res = ";
cout << res << endl;
cout << "command = ";
cout << command << endl;
//start = what[0].second;
/*
* Now we have to replace the res with what the command specifies
* For eg:
* if res = "?<nocapital>" and command = "nocapital", then
* replace "?<nocapital>" with "lighting".
* if res = "?<allcapital>" and command = "allcapital", then
* replace "?<allcapital>" with "LIGHTING".
*/
if (command == "methodname")
{
//buf.replace((what[0].first - start), res.size(), m->GetName());
buf.replace((what[0].first - buf.begin()), res.size(), m->GetName());
//start = what[0].first + m->GetName().size();
start = buf.begin();
//start = what[0].first;
}
else if (command == "arglist")
{
string arglist_str;
map<string, Arg*>::iterator it;
for (it = m->GetArgMap().begin(); it != m->GetArgMap().end(); it++)
{
Arg *arg = it->second;
if (arg->GetDir() == "in")
{
arglist_str = arglist_str + arg->GetType() + " " + arg->GetName() + ",";
}
else
{
arglist_str = arglist_str + arg->GetType() + " *" + arg->GetName() + ",";
}
}
cout << what[0].first - buf.begin() << endl;
buf.replace((what[0].first - buf.begin()), res.size(), arglist_str);
cout << buf << endl;
start = buf.begin();
}
else
{
start = what[0].second;
}
end = buf.end();
}
cout << buf << endl;
cout << "------End processMethodDecl------"<< endl;
return 0;
}