本文整理汇总了C++中Method::getMethodName方法的典型用法代码示例。如果您正苦于以下问题:C++ Method::getMethodName方法的具体用法?C++ Method::getMethodName怎么用?C++ Method::getMethodName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Method
的用法示例。
在下文中一共展示了Method::getMethodName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle
bool FilterHandler::handle(HttpRequest* req, HttpResponse* res, const string& ext, Reflector& reflector)
{
string acurl = req->getActUrl();
RegexUtil::replace(acurl,"[/]+","/");
if(acurl.find("/"+req->getCntxt_name())!=0)
acurl = "/" + req->getCntxt_name() + "/" + acurl;
RegexUtil::replace(acurl,"[/]+","/");
bool continue_proc_request = true;
Logger logger = LoggerFactory::getLogger("FilterHandler");
vector<string> filters;
if(getFilterForPath(req->getCntxt_name(), acurl, filters, "handle"))
{
for (int var = 0; var < (int)filters.size(); ++var)
{
string claz = filters.at(var);
void *_temp = ConfigurationData::getInstance()->ffeadContext.getBean("filter_"+claz, req->getCntxt_name());
args argus;
argus.push_back("HttpRequest*");
argus.push_back("HttpResponse*");
vals valus;
const ClassInfo& srv = ConfigurationData::getInstance()->ffeadContext.classInfoMap[req->getCntxt_name()][claz];
Method meth = srv.getMethod("doHandle", argus);
if(meth.getMethodName()!="")
{
valus.push_back(req);
valus.push_back(res);
continue_proc_request = reflector.invokeMethod<bool>(_temp,meth,valus);
logger << "Handler Filter called" << endl;
}
ConfigurationData::getInstance()->ffeadContext.release("filter_"+claz, req->getCntxt_name());
}
}
return continue_proc_request;
}
示例2: handleWebsockClose
void ServiceTask::handleWebsockClose(WebSocketData* req) {
Reflector reflector(ConfigurationData::getInstance()->dlib);
std::string className;
std::map<std::string, std::map<std::string, std::string> >& websocketMappingMap = ConfigurationData::getInstance()->websocketMappingMap;
std::map<std::string, std::string> websockcntMap = websocketMappingMap[req->getCntxt_name()];
std::map<std::string, std::string>::iterator it;
for (it=websockcntMap.begin();it!=websockcntMap.end();++it) {
if(ConfigurationData::urlMatchesPath(req->getCntxt_name(), it->first, req->getUrl()))
{
className = it->second;
break;
}
}
if(className!="")
{
void *_temp = ConfigurationData::getInstance()->ffeadContext.getBean("websocketclass_"+className, req->getCntxt_name());
args argus;
vals valus;
const ClassInfo& srv = ConfigurationData::getClassInfo(className, req->getCntxt_name());
Method methc = srv.getMethod("onClose", argus);
if(methc.getMethodName()!="")
{
//logger << ("WebSocket Controller " + className + " called") << std::endl;
reflector.invokeMethodGVP(_temp,methc,valus);
logger << "WebSocket Controller onClose" << std::endl;
}
else
{
logger << "Invalid WebSocket Controller" << std::endl;
}
}
}
示例3: addMethod
void Class::addMethod(Method meth)
{
string key = meth.getMethodName();
for (int var = 0; var < (int)meth.getArgumentTypes().size(); ++var)
{
key += (meth.getArgumentTypes().at(var));
}
this->methods[key] = meth;
}
示例4: handle
//.........这里部分代码省略.........
/*if(prsiz==valss.size())
res.setContent_str("Invalid number of arguments");
else
res.setContent_str("Invalid HTTPMethod used");*/
logger << "Rest Controller Param/Method Error" << endl;
}
}
}
}
if(flag)
{
//logger << "inside restcontroller logic ..." << endl;
string libName = Constants::INTER_LIB_FILE;
if(dlib == NULL)
{
cerr << dlerror() << endl;
exit(-1);
}
string clasnam("getReflectionCIFor"+rft.clas);
void *mkr = dlsym(dlib, clasnam.c_str());
logger << mkr << endl;
if(mkr!=NULL)
{
FunPtr f = (FunPtr)mkr;
ClassInfo srv = f();
args argus;
Constructor ctor = srv.getConstructor(argus);
Reflector ref;
void *_temp = ref.newInstanceGVP(ctor);
RestController* rstcnt = (RestController*)_temp;
rstcnt->request = req;
rstcnt->response = &res;
vals valus;
bool invValue = false;
for (int var = 0; var < prsiz; var++)
{
try
{
argus.push_back(rft.params.at(var).type);
if(rft.params.at(var).type=="int")
{
int* ival = new int(CastUtil::lexical_cast<int>(valss.at(var)));
valus.push_back(ival);
}
else if(rft.params.at(var).type=="long")
{
long* ival = new long(CastUtil::lexical_cast<long>(valss.at(var)));
valus.push_back(ival);
}
else if(rft.params.at(var).type=="double")
{
double* ival = new double(CastUtil::lexical_cast<double>(valss.at(var)));
valus.push_back(ival);
}
else if(rft.params.at(var).type=="float")
{
float* ival = new float(CastUtil::lexical_cast<float>(valss.at(var)));
valus.push_back(ival);
}
else if(rft.params.at(var).type=="bool")
{
bool* ival = new bool(CastUtil::lexical_cast<bool>(valss.at(var)));
valus.push_back(ival);
}
else if(rft.params.at(var).type=="string")
{
string* sval = new string(valss.at(var));
valus.push_back(sval);
}
} catch (...) {
invValue= true;
break;
}
}
Method meth = srv.getMethod(rft.name, argus);
if(meth.getMethodName()!="" && !invValue)
{
ref.invokeMethodUnknownReturn(_temp,meth,valus);
logger << "successfully called restcontroller" << endl;
//return;
}
else
{
res.setStatusCode("404");
res.setStatusMsg("Not Found");
//res.setContent_type("text/plain");
/*if(invValue)
res.setContent_str("Invalid value passed as URL param");
else
res.setContent_str("Rest Controller Method Not Found");*/
logger << "Rest Controller Method Not Found" << endl;
//return;
}
}
}
}
return isContrl;
}
示例5: service
void* ComponentHandler::service(void* arg)
{
int fd = *(int*)arg;
init();
string methInfo,retValue;
_cmp_instance->getServer()->Receive(fd,methInfo,1024);
methInfo =methInfo.substr(0,methInfo.find_last_of(">")+1);
_cmp_instance->logger << methInfo << flush;
try
{
XmlParser parser("Parser");
_cmp_instance->logger << "\nBean call parsed successfully\n" << flush;
if(methInfo.find("lang=\"c++\"")!=string::npos || methInfo.find("lang='c++'")!=string::npos)
{
Document doc = parser.getDocument(methInfo);
Element message = doc.getRootElement();
if(message.getTagName()!="service")
{
throw new ComponentHandlerException("No service Tag\n",retValue);
}
if(message.getAttributes().size()<4)
{
throw new ComponentHandlerException("name,beanName,returnType and lang are mandatory attributes\n",retValue);
}
else if(message.getAttribute("name")=="")
{
throw new ComponentHandlerException("name attribute missing\n",retValue);
}
else if(message.getAttribute("returnType")=="")
{
throw new ComponentHandlerException("returnType attribute missing\n",retValue);
}
else if(message.getAttribute("beanName")=="")
{
throw new ComponentHandlerException("beanName attribute missing\n",retValue);
}
else if(message.getAttribute("lang")=="")
{
throw new ComponentHandlerException("lang attribute missing\n",retValue);
}
if(message.getChildElements().size()!=1)
{
throw new ComponentHandlerException("message tag should have only one child tag\n",retValue);
}
else if(message.getChildElements().at(0).getTagName()!="args")
{
throw new ComponentHandlerException("message tag should have an args child tag\n",retValue);
}
Serialize ser;
Reflector reflector;
args argus;
vals valus;
ElementList argts = message.getChildElements().at(0).getChildElements();
for (unsigned var = 0; var < argts.size(); var++)
{
void *value = NULL;
Element arg = argts.at(var);
if(arg.getTagName()!="argument")
throw new ComponentHandlerException("Invalid Tag, only argument tag allowed\n",retValue);
else if(arg.getAttribute("type")=="")
throw new ComponentHandlerException("every argument tag should have a type attribute\n",retValue);
if(arg.getText()=="" && arg.getChildElements().size()==0)
throw new ComponentHandlerException("argument value missing\n",retValue);
if(arg.getAttribute("type")!="")
{
Element obj = arg.getChildElements().at(0);
string objxml = obj.render();
string objClassName = obj.getTagName();
value = ser.unSerializeUnknown(objxml,arg.getAttribute("type"));
}
argus.push_back(arg.getAttribute("type"));
valus.push_back(value);
}
string className = "Component_"+message.getAttribute("beanName");
_cmp_instance->logger << "\nBean class = " << className << "\n" << flush;
string returnType = message.getAttribute("returnType");
string lang = message.getAttribute("lang");
ClassInfo clas = reflector.getClassInfo(className);
string methodName = message.getAttribute("name");
_cmp_instance->logger << "\nBean service = " << methodName << "\n" << flush;
if(clas.getClassName()=="")
{
throw new ComponentHandlerException("bean does not exist or is not regsitered\n",retValue);
}
Method meth = clas.getMethod(methodName,argus);
if(meth.getMethodName()=="")
{
throw new ComponentHandlerException("service does not exist for the bean or the bean does not exist or is not regsitered\n\n",retValue);
}
else
{
_cmp_instance->logger << "\nGot Bean service " << methodName << "\n" << flush;
args argus;
Constructor ctor = clas.getConstructor(argus);
void *_temp = reflector.newInstanceGVP(ctor);
_cmp_instance->logger << "\nGot Bean " << _temp << "\n" << flush;
if(returnType=="void" || returnType=="")
{
_cmp_instance->logger << "\nVoid return " << "\n" << flush;
reflector.invokeMethod<void*>(_temp,meth,valus);
//.........这里部分代码省略.........
示例6: handle
//.........这里部分代码省略.........
StringUtil::replaceFirst(stlcnt,"multiset-of-","");
stltype = "std::multiset";
typp = "multiset<" + stlcnt + ">";
}
else if(rft.params.at(var).type.find("queue-of-")==0)
{
StringUtil::replaceFirst(stlcnt,"queue-of-","");
stltype = "std::queue";
typp = "queue<" + stlcnt + ">";
}
StringUtil::replaceFirst(stlcnt," ","");
logger << ("Restcontroller param body holds "+stltype+" of type " + stlcnt) << endl;
argus.push_back(typp);
void* voidPvect = NULL;
if(icont==ContentTypes::CONTENT_TYPE_APPLICATION_JSON)
{
voidPvect = JSONSerialize::unSerializeUnknown(pmvalue, stltype+"<"+stlcnt+">",req->getCntxt_name());
}
#ifdef INC_XMLSER
else
{
voidPvect = XMLSerialize::unSerializeUnknown(pmvalue, stltype+"<"+stlcnt+",",req->getCntxt_name());
}
#endif
if(voidPvect==NULL)
{
res.setHTTPResponseStatus(HTTPResponseStatus::BadRequest);
return true;
}
valus.push_back(voidPvect);
}
else
{
argus.push_back(rft.params.at(var).type);
void* voidPvect = NULL;
if(icont==ContentTypes::CONTENT_TYPE_APPLICATION_JSON)
{
voidPvect = JSONSerialize::unSerializeUnknown(pmvalue, rft.params.at(var).type,req->getCntxt_name());
}
#ifdef INC_XMLSER
else
{
voidPvect = XMLSerialize::unSerializeUnknown(pmvalue, rft.params.at(var).type,req->getCntxt_name());
}
#endif
if(voidPvect==NULL)
{
res.setHTTPResponseStatus(HTTPResponseStatus::BadRequest);
return true;
}
valus.push_back(voidPvect);
}
} catch (const char* ex) {
logger << "Restcontroller exception occurred" << endl;
logger << ex << endl;
invValue= true;
res.setHTTPResponseStatus(HTTPResponseStatus::BadRequest);
return true;
} catch (...) {
logger << "Restcontroller exception occurred" << endl;
invValue= true;
res.setHTTPResponseStatus(HTTPResponseStatus::BadRequest);
return true;
}
}
Method meth = srv.getMethod(rft.name, argus);
if(meth.getMethodName()!="" && !invValue)
{
ref.invokeMethodUnknownReturn(_temp,meth,valus);
logger << "Successfully called restcontroller" << endl;
//return;
for(int i=0;i<(int)allStreams.size();++i) {
if(allStreams.at(i)!=NULL) {
if(allStreams.at(i)->is_open()) {
allStreams.at(i)->close();
allStreams.at(i)->clear();
}
delete allStreams.at(i);
}
}
map<string, vector<ifstream*>* >::iterator it;
for(it=mpvecstreams.begin();it!=mpvecstreams.end();++it) {
delete it->second;
}
}
else
{
res.setHTTPResponseStatus(HTTPResponseStatus::NotFound);
//res.addHeaderValue(HttpResponse::ContentType, ContentTypes::CONTENT_TYPE_TEXT_PLAIN);
logger << "Rest Controller Method Not Found" << endl;
//return;
}
}
}
return isContrl;
}
示例7: service
void* MethodInvoc::service(void* arg)
{
int fd = *(int*)arg;
init();
string methInfo,retValue;
_methinv_instance->server.Receive(fd,methInfo,1024);
methInfo =methInfo.substr(0,methInfo.find_last_of(">")+1);
try
{
XmlParser parser("Parser");
if(methInfo.find("lang=\"c++\"")!=string::npos || methInfo.find("lang='c++'")!=string::npos)
{
Document doc = parser.getDocument(methInfo);
Element message = doc.getRootElement();
if(message.getTagName()!="method")
{
throw MethodInvokerException("No method Tag\n",retValue);
}
if(message.getAttributes().size()<3)
{
throw MethodInvokerException("name,class and lang are mandatory attributes\n",retValue);
}
else if(message.getAttribute("name")=="")
{
throw MethodInvokerException("name attribute missing\n",retValue);
}
else if(message.getAttribute("className")=="")
{
throw MethodInvokerException("class attribute missing\n",retValue);
}
else if(message.getAttribute("lang")=="")
{
throw MethodInvokerException("lang attribute missing\n",retValue);
}
if(message.getChildElements().size()!=1)
{
throw MethodInvokerException("message tag should have only one child tag\n",retValue);
}
else if(message.getChildElements().at(0).getTagName()!="args")
{
throw MethodInvokerException("message tag should have an args child tag\n",retValue);
}
XMLSerialize ser;
Reflector reflector;
args argus;
vals valus;
ElementList argts = message.getChildElements().at(0).getChildElements();
for (unsigned var = 0; var < argts.size(); var++)
{
void *value = NULL;
Element arg = argts.at(var);
if(arg.getTagName()!="argument" || arg.getAttribute("type")=="")
throw MethodInvokerException("every argument tag should have a name and type attribute\n",retValue);
if(arg.getText()=="" && arg.getChildElements().size()==0)
throw MethodInvokerException("argument value missing\n",retValue);
if(arg.getAttribute("type")=="int")
{
int *vt = new int;
*vt = CastUtil::lexical_cast<int>(arg.getText());
value = vt;
}
else if(arg.getAttribute("type")=="float")
{
float *vt = new float;
*vt = CastUtil::lexical_cast<float>(arg.getText());
value = vt;
}
else if(arg.getAttribute("type")=="double")
{
double *vt = new double;
*vt = CastUtil::lexical_cast<double>(arg.getText());
value = vt;
}
else if(arg.getAttribute("type")=="string")
{
string *vt = new string;
*vt = CastUtil::lexical_cast<string>(arg.getText());
value = vt;
}
else if(arg.getAttribute("type")!="")
{
Element obj = arg.getChildElements().at(0);
string objxml = obj.render();
string objClassName = obj.getTagName();
value = ser.unSerializeUnknown(objxml,arg.getAttribute("type"));
}
argus.push_back(arg.getAttribute("type"));
valus.push_back(value);
}
string className = message.getAttribute("className");
string returnType = message.getAttribute("returnType");
string lang = message.getAttribute("lang");
ClassInfo clas = reflector.getClassInfo(className);
string methodName = message.getAttribute("name");;
if(clas.getClassName()=="")
{
throw MethodInvokerException("class does not exist or is not in the library path\n",retValue);
}
Method meth = clas.getMethod(methodName,argus);
if(meth.getMethodName()=="")
//.........这里部分代码省略.........