本文整理汇总了C++中wt::WApplication::internalPathNextPart方法的典型用法代码示例。如果您正苦于以下问题:C++ WApplication::internalPathNextPart方法的具体用法?C++ WApplication::internalPathNextPart怎么用?C++ WApplication::internalPathNextPart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wt::WApplication
的用法示例。
在下文中一共展示了WApplication::internalPathNextPart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleURLChange
void Extension::handleURLChange() {
// Find the page
IGui* gui = IGui::instance();
Wt::WApplication* app = Wt::WApplication::instance();
std::string pageName = "/";
std::string action = "view";
if (app->internalPathMatches("/page/")) {
pageName = app->internalPathNextPart("/page/");
std::string pagePath = "/page/" + pageName + "/";
if (app->internalPathMatches(pagePath))
action = app->internalPathNextPart(pagePath);
}
dbo::Session& s = dbSession();
dbo::Transaction t(s);
dbo::ptr<Model> page = s.find<Model>().where("name=?").bind(pageName);
// Use it
if (page) {
ActionMap::const_iterator found = actionMap.find(action);
if (found != actionMap.end()) {
((this)->*(found->second))(*page); // Call the action .. view/edit etc..
} else {
Wt::WApplication::instance()->log("ERROR") <<
"No valid action for page " << page->getName() << " - " <<
"Action name " << action;
// Default to view maybe ?
gui->setBody("ERROR: No such action " + action );
}
} else {
gui->setBody("PAGE NOT FOUND: " + pageName);
}
t.commit();
}