• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ WT_USTRING类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了WT_USTRING类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: result

AbstractPasswordService::StrengthValidatorResult 
PasswordStrengthValidator::evaluateStrength(const WT_USTRING& password,
					    const WT_USTRING& loginName,
					    const std::string& email) const
{
  passwdqc_params_qc_t params;
  for (unsigned i = 0; i < 5; ++i)
    params.min[i] = minLength_[i];
  params.passphrase_words = passPhraseWords_;
  params.match_length = minMatchLength_;
  params.similar_deny = false;
  params.random_bits = 0;
  params.max = 256;

  std::string login_utf8 = loginName.toUTF8();
  passwdqc_user_t user;
  user.pw_name = login_utf8.c_str();
  user.pw_email = email.c_str();
  
  int index = passwdqc_check(&params, password.toUTF8().c_str(), 0, &user);

  WString message 
    = WString::tr(std::string("Wt.Auth.passwdqc.reason-") + reasons[index]);
  bool valid = index == 0;
  AbstractPasswordService::StrengthValidatorResult result(valid, 
							  message, 
							  valid ? 5 : 0);
  return result;
}
开发者ID:913862627,项目名称:wt,代码行数:29,代码来源:PasswordStrengthValidator.C


示例2: validate

WValidator::Result WRegExpValidator::validate(const WT_USTRING& input) const
{
  if (input.empty())
    return WValidator::validate(input);

  if (std::regex_match(input.toUTF8(), regex_))
    return Result(ValidationState::Valid);
  else
    return Result(ValidationState::Invalid, invalidNoMatchText());
}
开发者ID:AmesianX,项目名称:wt,代码行数:10,代码来源:WRegExpValidator.C


示例3: addStyleClass

void WTableRow::addStyleClass(const WT_USTRING& style)
{
  std::string currentClass = styleClass_.toUTF8();
  Utils::SplitSet classes;
  Utils::split(classes, currentClass, " ", true);
  
  if (classes.find(style.toUTF8()) == classes.end()) {
    styleClass_ = WT_USTRING::fromUTF8(Utils::addWord(styleClass_.toUTF8(),
						      style.toUTF8()));
    table_->repaintRow(this);
  }
}
开发者ID:913862627,项目名称:wt,代码行数:12,代码来源:WTableRow.C


示例4: while

// Remove spaces, only for input masks
WT_USTRING WLineEdit::removeSpaces(const WT_USTRING& text) const
{
  if (!raw_.empty() && !text.empty()) {
    std::u32string result = text;
    std::size_t i = 0;
    for (std::size_t j = 0; j < raw_.length(); ++i, ++j) {
      while (j < raw_.length() &&
	     result[j] == spaceChar_ &&
	     mask_[j] != '_') {
	++j;
      }
      if (j < raw_.length()) {
	if (i != j) {
	  result[i] = result[j];
	}
      } else {
	--i;
      }
    }
    result = result.substr(0, i);
    return WT_USTRING(result);
  } else {
    return text;
  }
}
开发者ID:quatmax,项目名称:wt,代码行数:26,代码来源:WLineEdit.C


示例5: parseValue

bool WAbstractSpinBox::parseValue(const WT_USTRING& text)
{
  std::string textUtf8 = text.toUTF8();

  bool valid = true;

  if (!nativeControl()) {
    valid = false;

    std::string prefixUtf8 = prefix_.toUTF8();
    std::string suffixUtf8 = suffix_.toUTF8();

    if (boost::starts_with(textUtf8, prefixUtf8)) {
      textUtf8 = textUtf8.substr(prefixUtf8.length());
      if (boost::ends_with(textUtf8, suffixUtf8)) {
	textUtf8 = textUtf8.substr(0, textUtf8.length() - suffixUtf8.length());
	valid = true;
      }
    }
  }

  if (valid)
    valid = textUtf8.length() > 0;

  if (valid)
    valid = parseNumberValue(textUtf8);

  return valid;
}
开发者ID:caseymcc,项目名称:wt,代码行数:29,代码来源:WAbstractSpinBox.C


示例6: validate

WValidator::Result WTimeValidator::validate(const WT_USTRING& input) const
{
  if (input.empty())
    return WValidator::validate(input);

  for (unsigned i = 0; i < formats_.size(); ++i) {
    try {
      WTime d = WTime::fromString(input, formats_[i]);

      if (d.isValid()) {
	if (!bottom_.isNull())
	  if (d < bottom_)
	    return Result(Invalid, invalidTooEarlyText());

	if (!top_.isNull())
	  if (d > top_)
	    return Result(Invalid, invalidTooLateText());
    
	return Result(Valid);
      }
    } catch (std::exception& e) {
      LOG_WARN("validate(): " << e.what());
    }
  }

  return Result(Invalid, invalidNotATimeText());
}
开发者ID:bytemaster,项目名称:wt-1,代码行数:27,代码来源:WTimeValidator.C


示例7: setValueText

void WSlider::setValueText(const WT_USTRING& value)
{
  try {
    value_ = Utils::stoi(value.toUTF8());
  } catch (std::exception& e) { 
  }
}
开发者ID:kdeforche,项目名称:wt,代码行数:7,代码来源:WSlider.C


示例8: validate

WValidator::Result WRegExpValidator::validate(const WT_USTRING& input) const
{
  if (input.empty())
    return WValidator::validate(input);

  if (!regexp_ || regexp_->exactMatch(input))
    return Result(Valid);
  else
    return Result(Invalid, invalidNoMatchText());
}
开发者ID:raxen,项目名称:wt,代码行数:10,代码来源:WRegExpValidator.C


示例9: setInternalPath

void WLink::setInternalPath(const WT_USTRING& internalPath)
{
  type_ = InternalPath;
  std::string path = internalPath.toUTF8();

  if (boost::starts_with(path, "#/"))
    path = path.substr(1);

  value_ = path;
}
开发者ID:patrickjwhite,项目名称:wt,代码行数:10,代码来源:WLink.C


示例10: toInt

int WLocale::toInt(const WT_USTRING& value) const
{
  if (groupSeparator_.empty())
    return boost::lexical_cast<int>(value);

  std::string v = value.toUTF8();

  Utils::replace(v, groupSeparator_, "");

  return boost::lexical_cast<int>(v);
}
开发者ID:tristan-lanfrey,项目名称:wt,代码行数:11,代码来源:WLocale.C


示例11: validate

WValidator::Result WIntValidator::validate(const WT_USTRING& input) const
{
  if (input.empty())
    return WValidator::validate(input);

  std::string text = input.toUTF8();

  try {
    int i = WLocale::currentLocale().toInt(text);

    if (i < bottom_)
      return Result(Invalid, invalidTooSmallText());
    else if (i > top_)
      return Result(Invalid, invalidTooLargeText());
    else
      return Result(Valid);
  } catch (boost::bad_lexical_cast& e) {
    return Result(Invalid, invalidNotANumberText());
  }
}
开发者ID:913862627,项目名称:wt,代码行数:20,代码来源:WIntValidator.C


示例12: updateDom

void WLineEdit::updateDom(DomElement& element, bool all)
{
  if (all || flags_.test(BIT_CONTENT_CHANGED)) {
    WT_USTRING t = content_;
    if (!mask_.empty() && (inputMaskFlags_.test(
			   InputMaskFlag::KeepMaskWhileBlurred)))
      t = displayContent_;
    if (!all || !t.empty())
      element.setProperty(Wt::Property::Value, t.toUTF8());
    flags_.reset(BIT_CONTENT_CHANGED);
  }

  if (all || flags_.test(BIT_ECHO_MODE_CHANGED)) {
    element.setAttribute("type", echoMode_ == EchoMode::Normal 
			 ? "text" : "password");
    flags_.reset(BIT_ECHO_MODE_CHANGED);
  }

  if (all || flags_.test(BIT_AUTOCOMPLETE_CHANGED)) {
    if (!all || !autoComplete_) {
      element.setAttribute("autocomplete",
			   autoComplete_ == true ? "on" : "off");
    }
    flags_.reset(BIT_AUTOCOMPLETE_CHANGED);
  }

  if (all || flags_.test(BIT_TEXT_SIZE_CHANGED)) {
    element.setAttribute("size", std::to_string(textSize_));
    flags_.reset(BIT_TEXT_SIZE_CHANGED);
  }

  if (all || flags_.test(BIT_MAX_LENGTH_CHANGED)) {
    if (!all || maxLength_ > 0)
      element.setAttribute("maxLength", std::to_string(maxLength_));

    flags_.reset(BIT_MAX_LENGTH_CHANGED);
  }

  WFormWidget::updateDom(element, all);
}
开发者ID:quatmax,项目名称:wt,代码行数:40,代码来源:WLineEdit.C


示例13: validate

WValidator::Result WLengthValidator::validate(const WT_USTRING& input) const
{
  if (input.empty())
    return WValidator::validate(input);

#ifndef WT_TARGET_JAVA
#ifndef WT_NO_STD_WSTRING
  std::wstring text = input.value();
#else
  std::string text = input.narrow();
#endif
#else
  std::string text = input;
#endif

  if ((int)text.length() < minLength_)
    return Result(Invalid, invalidTooShortText());
  else if ((int)text.length() > maxLength_)
    return Result(Invalid, invalidTooLongText());
  else
    return Result(Valid);
}
开发者ID:913862627,项目名称:wt,代码行数:22,代码来源:WLengthValidator.C


示例14: toDouble

double WLocale::toDouble(const WT_USTRING& value) const
{
  if (isDefaultNumberLocale())
    return boost::lexical_cast<double>(value);

  std::string v = value.toUTF8();

  if (!groupSeparator_.empty())
    Utils::replace(v, groupSeparator_, "");
  if (decimalPoint_ != ".")
    Utils::replace(v, decimalPoint_, ".");

  return boost::lexical_cast<double>(v);
}
开发者ID:tristan-lanfrey,项目名称:wt,代码行数:14,代码来源:WLocale.C


示例15: validate

	WValidator::Result WMatchValidator::validate(const WT_USTRING& strInput) const
	{
		if(0 == m_pCompareWidget) {
			return Result(Invalid, invalidDataText());
		}

		if(strInput.empty()) {
			return WValidator::validate(strInput);
		}

		if(strInput != m_pCompareWidget->valueText()) {
			return Result(Invalid, mismatchText());
		}

		return Result(Valid);
	}
开发者ID:pluggulp,项目名称:wt,代码行数:16,代码来源:WMatchValidator.C


示例16: formatToRegExp

WDate::RegExpInfo WDate::formatToRegExp(const WT_USTRING& format)
{
  RegExpInfo result;
  std::string f = format.toUTF8();
  int currentGroup = 1;

  result.dayGetJS = "return 1";
  result.monthGetJS = "return 1";
  result.yearGetJS = "return 2000";

  bool inQuote = false;
  bool gotQuoteInQuote = false;

  static const std::string regexSpecial = "/[\\^$.|?*+()";

  int d = 0, M = 0, y = 0; 

  for (unsigned i = 0; i < f.length(); ++i) {
    if (inQuote) {
      if (f[i] != '\'') {
	if (gotQuoteInQuote) {
	  gotQuoteInQuote = false;
	  inQuote = false;
	} else
	  result.regexp += f[i];
      } else {
	if (gotQuoteInQuote) {
	  gotQuoteInQuote = false;
	  result.regexp += f[i];
	} else
	  gotQuoteInQuote = true;
      }
    }

    if (!inQuote) {
      switch (f[i]) {
      case 'd':
	if (d == 0)
	  writeRegExpLast(result, d, M, y, format, currentGroup);
	++d;
	break;
      case 'M':
	if (M == 0)
	  writeRegExpLast(result, d, M, y, format, currentGroup);
	++M;
	break;
      case 'y':
	if (y == 0)
	  writeRegExpLast(result, d, M, y, format, currentGroup);
	++y;
	break;
      default:
	writeRegExpLast(result, d, M, y, format, currentGroup);
	if (f[i] == '\'') {
	  inQuote = true;
	  gotQuoteInQuote = false;
	} else if (regexSpecial.find(f[i]) != std::string::npos) {
	  result.regexp += "\\";
	  result.regexp += f[i];
	} else
	  result.regexp += f[i];
      }
    }
  }

  writeRegExpLast(result, d, M, y, format, currentGroup);

  return result;
}
开发者ID:bvanhauwaert,项目名称:wt,代码行数:69,代码来源:WDate.C


示例17: setRegExp

void WRegExpValidator::setRegExp(const WT_USTRING& pattern)
{
  regex_.assign(pattern.toUTF8());
  pattern_ = pattern;
  repaint();
}
开发者ID:AmesianX,项目名称:wt,代码行数:6,代码来源:WRegExpValidator.C


示例18:

WRegExpValidator::WRegExpValidator(const WT_USTRING& pattern)
  : regex_(pattern.toUTF8())
{ }
开发者ID:AmesianX,项目名称:wt,代码行数:3,代码来源:WRegExpValidator.C


示例19: setInternalPath

void WLink::setInternalPath(const WT_USTRING& internalPath)
{
  type_ = InternalPath;
  value_ = internalPath.toUTF8();
}
开发者ID:Spencerx,项目名称:wt,代码行数:5,代码来源:WLink.C



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ WTable类代码示例发布时间:2022-05-31
下一篇:
C++ WT_SESSION类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap