当前位置: 首页>>代码示例>>C++>>正文


C++ wt::WString类代码示例

本文整理汇总了C++中wt::WString的典型用法代码示例。如果您正苦于以下问题:C++ WString类的具体用法?C++ WString怎么用?C++ WString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了WString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的wt::WString类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。