本文整理汇总了C++中WApplication::internalPathMatches方法的典型用法代码示例。如果您正苦于以下问题:C++ WApplication::internalPathMatches方法的具体用法?C++ WApplication::internalPathMatches怎么用?C++ WApplication::internalPathMatches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WApplication
的用法示例。
在下文中一共展示了WApplication::internalPathMatches方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: internalPathChanged
void WMenu::internalPathChanged(const std::string& path)
{
WApplication *app = wApp;
if (app->internalPathMatches(basePath_)) {
std::string subPath = app->internalSubPath(basePath_);
int bestI = -1, bestMatchLength = -1;
for (int i = 0; i < count(); ++i) {
if (!itemAt(i)->isEnabled() || itemAt(i)->isHidden())
continue;
int matchLength = match(subPath, itemAt(i)->pathComponent());
if (matchLength > bestMatchLength) {
bestMatchLength = matchLength;
bestI = i;
}
}
if (bestI != -1)
itemAt(bestI)->setFromInternalPath(path);
else {
if (!subPath.empty())
LOG_WARN("unknown path: '"<< subPath << "'");
else
select(-1, false);
}
}
}
示例2: itemPathChanged
void WMenu::itemPathChanged(WMenuItem *item)
{
if (internalPathEnabled_ && item->internalPathEnabled()) {
WApplication *app = wApp;
if (app->internalPathMatches(basePath_ + item->pathComponent()))
item->setFromInternalPath(app->internalPath());
}
}
示例3: handleRegistrationPath
bool AuthWidget::handleRegistrationPath(const std::string& path)
{
if (!basePath_.empty()) {
WApplication *app = WApplication::instance();
if (app->internalPathMatches(basePath_)) {
std::string ap = app->internalSubPath(basePath_);
if (ap == "register") {
registerNewUser();
return true;
}
}
}
return false;
}
示例4: handlePathChange
void handlePathChange(const std::string& path) {
WApplication *app = wApp;
if (app->internalPathMatches(basePath_)) {
dbo::Transaction t(session_);
std::string path = app->internalPathNextPart(basePath_);
items_->clear();
if (users_) {
delete users_;
users_ = 0;
}
if (path.empty())
showPosts(session_.find<Post>
("where state = ? "
"order by date desc "
"limit 10").bind(Post::Published), items_);
else if (path == "author") {
std::string author = app->internalPathNextPart(basePath_ + path + '/');
dbo::ptr<User> user = findUser(author);
if (user)
showPosts(user);
else
showError(tr("blog-no-author").arg(author));
} else if (path == "edituser") {
editUser(app->internalPathNextPart(basePath_ + path + '/'));
} else if (path == "all") {
showArchive(items_);
} else {
std::string remainder = app->internalPath().substr(basePath_.length());
showPostsByDateTopic(remainder, items_);
}
t.commit();
}
}
示例5: closeDialog
void AuthWidget::closeDialog()
{
if (dialog_) {
delete dialog_;
dialog_ = 0;
} else {
delete messageBox_;
messageBox_ = 0;
}
/* Reset internal path */
if(!basePath_.empty()) {
WApplication *app = WApplication::instance();
if (app->internalPathMatches(basePath_)) {
std::string ap = app->internalSubPath(basePath_);
if (ap == "register/") {
app->setInternalPath(basePath_, false);
}
}
}
}