本文整理汇总了C++中wt::WString类的典型用法代码示例。如果您正苦于以下问题:C++ WString类的具体用法?C++ WString怎么用?C++ WString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WString类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: render
void Popup::render(Wt::WFlags<Wt::RenderFlag> flags) {
Wt::WApplication * app = Wt::WApplication::instance();
Wt::WString initFunction = app->javaScriptClass() + ".init_popup_" + id();
Wt::WStringStream stream;
stream
<< "{" << initFunction.toUTF8() << " = function() {"
<< " var self = " << jsRef() << ";"
<< " if (!self) {"
<< " setTimeout(" << initFunction.toUTF8() << ", 0);"
<< " }";
stream
<< " self.popup = new mapboxgl.Popup( {"
<< " closeButton: " << ToScript(closeButton_).toUTF8() << ", "
<< " closeOnClick: " << ToScript(closeOnClick_).toUTF8() << ", "
<< " anchor: " << ToScript(anchor_).toUTF8()
<< " });";
for (unsigned int i = 0; i < additions_.size(); i++) {
stream << additions_[i].toUTF8();
}
additions_.clear();
stream
<< " setTimeout(function(){ delete " << initFunction.toUTF8() << ";}, 0)};\n"
<< "}\n"
<< initFunction.toUTF8() << "();\n";
app->doJavaScript(stream.str());
}
开发者ID:yvanvds,项目名称:wtMapbox,代码行数:31,代码来源:Popup.cpp
示例2: sayHi
void MainWindow::sayHi() {
Wt::WString name = _nameInput->valueText();
if (name.empty())
_nameOutput->setText("");
else
_nameOutput->setText("Hi there " + name);
}
开发者ID:GD-Krone,项目名称:witty-tutorial,代码行数:7,代码来源:MainWindow.cpp
示例3:
Wt::WContainerWidget * ThermometerPlugin::getSummary() {
Wt::WContainerWidget *summaryContainer_ = new Wt::WContainerWidget();
Wt::WString str = "Found {1} Probes";
str.arg((int) addresses_.size());
summaryContainer_->addWidget(new Wt::WText(str));
return summaryContainer_;
}
开发者ID:PeteStewardson,项目名称:Aquarius,代码行数:7,代码来源:ThermometerPlugin.cpp
示例4: submitMessage
void CreatePostWidget::submitMessage()
{
Wt::WString text = _messageTextArea->text();
if(text == ""){
// can use setEmptyText instead of this
enterDefaultText();
}else{
PostMsg msg;
uint32_t token;
RsGxsId author = _idChooser->getSelectedId();
if(author.isNull()){
return;
}
msg.mMeta.mAuthorId = author;
RsGxsGroupId targetWall = _wallChooser->getSelectedWallId();
if(targetWall.isNull()){
return;
}
// this is a trick:
// use the group id to signal the wall the post should appear on
msg.mMeta.mGroupId = targetWall;
// todo: circle
msg.mPostText = text.toUTF8();
rsWall->createPost(token, msg);
}
}
开发者ID:RetroShare,项目名称:rssocialnet,代码行数:29,代码来源:CreatePostWidget.cpp
示例5: consoleAddData
void AbstractRPM::consoleAddData(const Wt::WString &computerName, const Wt::WString &data)
{
Wt::WString date = Wt::WDate::currentServerDate().toString("yyyy/MM/dd");
Wt::WString time = Wt::WTime::currentServerTime().toString("hh:mm:ss");
std::string user = currentUser();
Wt::WString header = date + "-" + time;
if (!user.empty())
header += ": " + user;
Wt::WString entry = header + ": " + data + "\n";
computerStateLock.lock();
Wt::WString logs = entry + _computerLogs[computerName];
logs = logs.toUTF8().substr(0, 1000); /* limit to 1k */
_computerLogs[computerName] = logs;
computerStateLock.unlock();
viewsLock.lock();
std::map< std::string, View* >::iterator it;
for (it = views.begin(); it != views.end(); ++it) {
server->post((*it).first, boost::bind(&View::consoleDataAdded,
(*it).second, computerName,
entry));
}
viewsLock.unlock();
}
开发者ID:forumi0721,项目名称:wt-rpm,代码行数:25,代码来源:abstractrpm.cpp
示例6: consoleDataAdded
void ComputerView::consoleDataAdded(const Wt::WString &data)
{
Wt::WString logs = data + _logs_edit->valueText();
logs = logs.toUTF8().substr(0, 1000); /* limit to 1k */
_logs_edit->setValueText(logs);
app->triggerUpdate();
}
开发者ID:forumi0721,项目名称:wt-rpm,代码行数:8,代码来源:computerview.cpp
示例7:
Wt::Auth::User RDAUserDatabase::findWithIdentity (const std::string &provider,
const Wt::WString &identity)
const
{
std::string i;
/*
* David: find the 'id' for a user with name _identity_, leave it
* empty if no user with this name exists
*/
if(SEC_USERS_FILENO==(-1))
{
return Wt::Auth::User();
}
ZERNRD(SEC_USERS_FILENO);
i=identity.toUTF8();
USERLOGIN=stralloc(i.c_str());
FINDFLDSETSTRING(SEC_USERS_FILENO,"USER IDENTIFICATION",USERLOGIN);
if(EQLNRD(SEC_USERS_FILENO,1))
{
KEYNRD(SEC_USERS_FILENO,1);
return Wt::Auth::User();
} else {
return Wt::Auth::User(i, *this);
}
}
开发者ID:DTidd,项目名称:OpenRDAAPI,代码行数:26,代码来源:RDAUserDatabase.cpp
示例8: reindent
Wt::WString TopicWidget::reindent(const Wt::WString& text)
{
std::vector<std::string> lines;
std::string s = text.toUTF8();
boost::split(lines, s, boost::is_any_of("\n"));
std::string result;
int indent = -1;
int newlines = 0;
for (unsigned i = 0; i < lines.size(); ++i) {
const std::string& line = lines[i];
if (line.empty()) {
++newlines;
} else {
if (indent == -1) {
indent = countSpaces(line);
} else {
for (int j = 0; j < newlines; ++j)
result += '\n';
}
newlines = 0;
if (!result.empty())
result += '\n';
result += skipSpaces(line, indent);
}
}
return Wt::WString::fromUTF8(result);
}
开发者ID:913862627,项目名称:wt,代码行数:32,代码来源:TopicWidget.C
示例9: setValid
void FormBaseModel::setValid(Field field, const Wt::WString& message)
{
setValidation(field,
WValidator::Result(WValidator::Valid,
message.empty() ?
WString::tr("Wt.Auth.valid") : message));
}
开发者ID:Brasil,项目名称:wt,代码行数:7,代码来源:FormBaseModel.C
示例10: doDelayedJavaScript
void Popup::doDelayedJavaScript(const Wt::WString & jscode) {
if (isRendered()) {
doJavaScript(jscode.toUTF8());
}
else {
additions_.push_back(jscode);
}
}
开发者ID:yvanvds,项目名称:wtMapbox,代码行数:8,代码来源:Popup.cpp
示例11: asciidoc
/* ****************************************************************************
* asciidoc
*/
WString asciidoc(const Wt::WString& src)
{
std::string srcFileName = tempFileName();
std::string htmlFileName = tempFileName();
{
std::ofstream srcFile(srcFileName.c_str(), std::ios::out);
std::string ssrc = src.toUTF8();
srcFile.write(ssrc.c_str(), (std::streamsize)ssrc.length());
srcFile.close();
}
#if defined(ASCIIDOC_EXECUTABLE)
#define xstr(s) str(s)
#define str(s) #s
std::string cmd = xstr(ASCIIDOC_EXECUTABLE);
#else
std::string cmd = "asciidoc";
#endif
std::string command = cmd + " -o " + htmlFileName + " -s " + srcFileName;
#ifndef WIN32
/*
* So, asciidoc apparently sends a SIGINT which is caught by its parent process..
* So we have to temporarily ignore it.
*/
struct sigaction newAction, oldAction;
newAction.sa_handler = SIG_IGN;
newAction.sa_flags = 0;
sigemptyset(&newAction.sa_mask);
sigaction(SIGINT, &newAction, &oldAction);
#endif
bool ok = system(command.c_str()) == 0;
#ifndef WIN32
sigaction(SIGINT, &oldAction, 0);
#endif
WString result;
if (ok)
{
result = WString::fromUTF8(readFileToString(htmlFileName));
}
else
{
result = WString::fromUTF8("<i>Could not execute asciidoc</i>");
}
unlink(srcFileName.c_str());
unlink(htmlFileName.c_str());
return result;
}
开发者ID:lyase,项目名称:install,代码行数:55,代码来源:asciidoc.cpp
示例12: validate
Result validate(const Wt::WString& input) const
{
auto res = Wt::WValidator::validate(input);
if (res.state() != Wt::ValidationState::Valid)
return res;
auto password = Config::instance().getString("upload-password", "");
if (input.toUTF8() == password)
return Result(Wt::ValidationState::Valid);
return Result(Wt::ValidationState::Invalid, Wt::WString::tr("msg-bad-password"));
}
开发者ID:epoupon,项目名称:fileshelter,代码行数:13,代码来源:ShareCreatePassword.cpp
示例13: saveFragments
Wt::Json::Value saveFragments(MyTreeTableNode *root)
{
Wt::Json::Value retVal = Wt::Json::Value(Wt::Json::ArrayType);
Wt::Json::Array& ret = retVal;
Wt::WString name;
name = root->text;
std::string str = name.toUTF8();
str.erase(std::remove(str.begin(), str.end(), ' '), str.end()); //This removes whitespace
if(str.length()<1)
{
name = Wt::WString("New Node");
}
if(root->childNodes().size()>0)
{
ret.push_back(Wt::Json::Value(Wt::WString("group")));
ret.push_back(Wt::Json::Value(name));
Wt::Json::Value out_children_value = Wt::Json::Value(Wt::Json::ArrayType);
Wt::Json::Array& out_children = out_children_value;
for(auto mynode:root->childNodes()) //I wonder, what order do we get these in?
{
out_children.push_back(saveFragments(dynamic_cast<MyTreeTableNode*>(mynode)));
}
ret.push_back(out_children_value);
}
else //TODO add room for annotations
{
ret.push_back(Wt::Json::Value(Wt::WString("fragment")));
ret.push_back(Wt::Json::Value(name));
long long start = root->startWidget->time();
long long stop = root->stopWidget->time();
//this->log("info")<< "Saving fragment "<<std::to_string(start) << " "<<std::to_string(stop);
ret.push_back(Wt::Json::Value(start));
ret.push_back(Wt::Json::Value(stop));
}
return retVal;
}
开发者ID:wijnen,项目名称:ear,代码行数:38,代码来源:fragmentTree.C
示例14: goOnline
void PopupChatWidget::goOnline()
{
if (!online_) {
online_ = true;
int tries = 1;
Wt::WString name = name_;
if (name.empty())
name = server().suggestGuest();
while (!startChat(name)) {
if (name_.empty())
name = server().suggestGuest();
else
name = name_ + boost::lexical_cast<std::string>(++tries);
}
name_ = name;
}
missedMessages_ = 0;
bar_->removeStyleClass("alert");
}
开发者ID:ReWeb3D,项目名称:wt,代码行数:23,代码来源:PopupChatWidget.C
示例15: setName
void PopupChatWidget::setName(const Wt::WString& name)
{
if (name.empty())
return;
if (online_) {
int tries = 1;
Wt::WString n = name;
while (!server().changeName(name_, n))
n = name + boost::lexical_cast<std::string>(++tries);
name_ = n;
} else
name_ = name;
}
开发者ID:ReWeb3D,项目名称:wt,代码行数:15,代码来源:PopupChatWidget.C
示例16: switch
Wt::WContainerWidget*
Application::instantiateMainTabs() {
Wt::WContainerWidget *mainTabContainer = new Wt::WContainerWidget;
Wt::WVBoxLayout *vbox = new Wt::WVBoxLayout;
mainTabContainer->setLayout(vbox);
wMainTabs_ = new Wt::WTabWidget;
wMainTabs_->currentChanged().connect(boost::bind(&Application::changeTab2, this, _1));
vbox->addWidget(wMainTabs_, 1 /*stretch*/);
for (size_t i=0; i<NMainTabs; ++i) {
Wt::WString tabName;
Wt::WContainerWidget *tabContent = NULL;
switch ((MainTab)i) {
case PartitionerTab: {
tabName = "Partitioner";
tabContent = wPartitioner_ = new WPartitioner(ctx_);
wPartitioner_->specimenParsed().connect(boost::bind(&Application::handleSpecimenParsed, this, _1));
wPartitioner_->specimenLoaded().connect(boost::bind(&Application::handleSpecimenLoaded, this, _1));
wPartitioner_->specimenPartitioned().connect(boost::bind(&Application::handleSpecimenPartitioned, this, _1));
break;
}
case MemoryMapTab: {
tabName = "Memory Map";
tabContent = wMemoryMap_ = new WMemoryMap;
wMemoryMap_->mapChanged().connect(boost::bind(&Application::memoryMapChanged, this));
wMemoryMap_->allowDownloads(ctx_.settings.allowDownloads);
break;
}
case FunctionListTab: {
tabName = "Functions";
tabContent = wFunctionList_ = new WFunctionList(ctx_);
wFunctionList_->functionChanged().connect(boost::bind(&Application::changeFunction, this, _1));
wFunctionList_->functionRowDoubleClicked()
.connect(boost::bind(&Application::changeFunctionDoubleClick, this, _1));
break;
}
case FunctionSummaryTab: {
tabName = "Summary";
tabContent = wFunctionSummary_ = new WFunctionSummary(ctx_);
break;
}
case FunctionCfgTab: {
tabName = "CFG";
tabContent = wFunctionCfg_ = new WFunctionCfg(ctx_);
wFunctionCfg_->functionChanged().connect(boost::bind(&Application::changeFunction, this, _1));
wFunctionCfg_->functionClicked().connect(boost::bind(&Application::changeFunction, this, _1));
wFunctionCfg_->addressClicked().connect(boost::bind(&Application::showHexDumpAtAddress, this, _1));
wFunctionCfg_->basicBlockClicked().connect(boost::bind(&Application::changeBasicBlock, this, _1));
break;
}
case AssemblyTab: {
tabName = "Assembly";
tabContent = wAssembly_ = new WAssemblyListing(ctx_);
break;
}
case HexDumpTab: {
tabName = "Hexdump";
tabContent = wHexDump_ = new WHexDump;
wHexDump_->byteClicked().connect(boost::bind(&Application::updateAddressCrossReferences, this, _1));
break;
}
case MagicTab: {
tabName = "Magic";
tabContent = wMagic_ = new WMagic;
break;
}
case StringsTab: {
tabName = "Strings";
tabContent = wStrings_ = new WStrings;
wStrings_->stringClicked().connect(boost::bind(&Application::updateStringCrossReferences, this, _1));
break;
}
case StatusTab: {
tabName = "Status";
tabContent = wStatus_ = new WStatus(ctx_);
break;
}
default:
ASSERT_not_reachable("invalid main tab");
}
ASSERT_not_null(tabContent);
ASSERT_forbid(tabName.empty());
wMainTabs_->addTab(tabContent, tabName);
}
return mainTabContainer;
}
开发者ID:cathieO,项目名称:rose-develop,代码行数:87,代码来源:Application.C
示例17:
sb2->addItem("Green peppers");
sb2->addItem("Ham");
sb2->addItem("Pepperoni");
sb2->addItem("Red peppers");
sb2->addItem("Turkey");
sb2->setSelectionMode(Wt::ExtendedSelection);
std::set<int> selection; // By default select the items with index 1 and 4.
selection.insert(1); // Index 1 corresponds to the 2nd item.
selection.insert(4); // Index 4 corresponds to the 5th item.
sb2->setSelectedIndexes(selection);
sb2->setMargin(10, Wt::Right);
Wt::WText *out = new Wt::WText(container);
sb2->activated().connect(std::bind([=] () {
Wt::WString selected;
std::set<int> selection = sb2->selectedIndexes();
for (std::set<int>::iterator it = selection.begin();
it != selection.end(); ++it) {
if (!selected.empty())
selected += ", ";
selected += sb2->itemText(*it);
}
out->setText(Wt::WString::fromUTF8("You choose {1}.").arg(selected));
}));
SAMPLE_END(return container)
开发者ID:ScienziatoBestia,项目名称:wt,代码行数:30,代码来源:SelectionBoxExtended.cpp
示例18:
void
WHexValueEdit::setError(const Wt::WString &mesg) {
wError_->setText(mesg);
wError_->setHidden(mesg.empty());
wSave_->setEnabled(mesg.empty());
}
开发者ID:8l,项目名称:rose,代码行数:6,代码来源:WHexValueEdit.C
示例19: set_query
void set_query() {
dbo::Transaction t(tApp->session());
ULP::Q q;
if (only_blocked_) {
q = tApp->session().query<UserPtr>(
"select U from thechess_message_filter F "
"left join thechess_user U on F.bad_id = U.id");
q.where("F.good_id = ?").bind(tApp->user());
} else {
q = tApp->session().find<User>();
}
if (not_removed_) {
q.where("rights != ?").bind(NONE);
q.where("vacation_until is null");
q.where("last_online > ?").bind(now() - 10 * WEEK);
}
if (only_online_) {
q.where("last_online >= ?");
q.bind(now() - Options::instance()->away_timeout());
}
if (!name_like_.empty()) {
q.where("(username like ? or id = ?)");
q.bind("%" + name_like_ + "%");
q.bind(Wt::Wc::str2int(name_like_.toUTF8()));
}
q.orderBy("games_stat_elo desc");
setQuery(q, /* keep_columns */ true);
}
开发者ID:starius,项目名称:thechess,代码行数:28,代码来源:UserListWidget.cpp
注:本文中的wt::WString类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论