本文整理汇总了C++中WApplication::session方法的典型用法代码示例。如果您正苦于以下问题:C++ WApplication::session方法的具体用法?C++ WApplication::session怎么用?C++ WApplication::session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WApplication
的用法示例。
在下文中一共展示了WApplication::session方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: encode
std::string WTemplate::encode(const std::string& text) const
{
WApplication *app = WApplication::instance();
if (app && (encodeInternalPaths_ || app->session()->hasSessionIdInUrl())) {
WFlags<RefEncoderOption> options;
if (encodeInternalPaths_)
options |= EncodeInternalPaths;
if (app->session()->hasSessionIdInUrl())
options |= EncodeRedirectTrampoline;
return EncodeRefs(WString::fromUTF8(text), options).toUTF8();
} else
return text;
}
示例2: exec
WDialog::DialogCode WDialog::exec(const WAnimation& animation)
{
if (recursiveEventLoop_)
throw WException("WDialog::exec(): already being executed.");
animateShow(animation);
#ifdef WT_TARGET_JAVA
if (!WebController::isAsyncSupported())
throw WException("WDialog#exec() requires a Servlet 3.0 enabled servlet "
"container and an application with async-supported "
"enabled.");
#endif
WApplication *app = WApplication::instance();
recursiveEventLoop_ = true;
if (app->environment().isTest()) {
app->environment().dialogExecuted().emit(this);
if (recursiveEventLoop_)
throw WException("Test case must close dialog");
} else {
do {
app->session()->doRecursiveEventLoop();
} while (recursiveEventLoop_);
}
hide();
return result_;
}
示例3: renderOk
void WWidget::renderOk()
{
if (flags_.test(BIT_NEED_RERENDER)) {
flags_.reset(BIT_NEED_RERENDER);
WApplication *app = WApplication::instance();
if (app)
app->session()->renderer().doneUpdate(this);
}
}
示例4: formattedText
std::string WText::formattedText() const
{
if (text_.format == PlainText)
return escapeText(text_.text, true).toUTF8();
else {
WApplication *app = WApplication::instance();
if (flags_.test(BIT_ENCODE_INTERNAL_PATHS)
|| app->session()->hasSessionIdInUrl()) {
WFlags<RefEncoderOption> options;
if (flags_.test(BIT_ENCODE_INTERNAL_PATHS))
options |= EncodeInternalPaths;
if (app->session()->hasSessionIdInUrl())
options |= EncodeRedirectTrampoline;
return EncodeRefs(text_.text, options).toUTF8();
} else
return text_.text.toUTF8();
}
}
示例5: WException
WPopupMenuItem *WPopupMenu::exec(const WPoint& p)
{
if (recursiveEventLoop_)
throw WException("WPopupMenu::exec(): already being executed.");
WApplication *app = WApplication::instance();
recursiveEventLoop_ = true;
popup(p);
if (app->environment().isTest()) {
app->environment().popupExecuted().emit(this);
if (recursiveEventLoop_)
throw WException("Test case must close popup menu.");
} else {
do {
app->session()->doRecursiveEventLoop();
} while (recursiveEventLoop_);
}
return result_;
}
示例6: renderTemplateText
void WTemplate::renderTemplateText(std::ostream& result, const WString& templateText)
{
std::string text;
WApplication *app = WApplication::instance();
if (app && (encodeInternalPaths_ || app->session()->hasSessionIdInUrl())) {
WFlags<RefEncoderOption> options;
if (encodeInternalPaths_)
options |= EncodeInternalPaths;
if (app->session()->hasSessionIdInUrl())
options |= EncodeRedirectTrampoline;
WString t = templateText;
EncodeRefs(t, options);
text = t.toUTF8();
} else
text = templateText.toUTF8();
std::size_t lastPos = 0;
std::vector<WString> args;
std::vector<std::string> conditions;
int suppressing = 0;
for (std::size_t pos = text.find('$'); pos != std::string::npos;
pos = text.find('$', pos)) {
if (!suppressing)
result << text.substr(lastPos, pos - lastPos);
lastPos = pos;
if (pos + 1 < text.length()) {
if (text[pos + 1] == '$') { // $$ -> $
if (!suppressing)
result << '$';
lastPos += 2;
} else if (text[pos + 1] == '{') {
std::size_t startName = pos + 2;
std::size_t endName = text.find_first_of(" \r\n\t}", startName);
args.clear();
std::size_t endVar = parseArgs(text, endName, args);
if (endVar == std::string::npos) {
LOG_ERROR("variable syntax error near \"" << text.substr(pos)
<< "\"");
return;
}
std::string name = text.substr(startName, endName - startName);
std::size_t nl = name.length();
if (nl > 2 && name[0] == '<' && name[nl - 1] == '>') {
if (name[1] != '/') {
std::string cond = name.substr(1, nl - 2);
conditions.push_back(cond);
if (suppressing || !conditionValue(cond))
++suppressing;
} else {
std::string cond = name.substr(2, nl - 3);
if (conditions.back() != cond) {
LOG_ERROR("mismatching condition block end: " << cond);
return;
}
conditions.pop_back();
if (suppressing)
--suppressing;
}
} else {
if (!suppressing) {
std::size_t colonPos = name.find(':');
bool handled = false;
if (colonPos != std::string::npos) {
std::string fname = name.substr(0, colonPos);
std::string arg0 = name.substr(colonPos + 1);
args.insert(args.begin(), WString::fromUTF8(arg0));
if (resolveFunction(fname, args, result))
handled = true;
else
args.erase(args.begin());
}
if (!handled)
resolveString(name, args, result);
}
}
lastPos = endVar + 1;
} else {
if (!suppressing)
result << '$'; // $. -> $.
lastPos += 1;
}
} else {
if (!suppressing)
result << '$'; // $ at end of template -> $
lastPos += 1;
//.........这里部分代码省略.........