WT_USTRING WFileUpload::contentDescription() const { if (!empty()) return WT_USTRING::fromUTF8(uploadedFiles_[0].contentType()); else return WT_USTRING(); }
// 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; } }
WT_USTRING WFileUpload::clientFileName() const { if (!empty()) return WT_USTRING::fromUTF8(uploadedFiles_[0].clientFileName()); else return WT_USTRING(); }
WT_USTRING WDateEdit::format() const { WDateValidator *dv = validator(); if (dv) { return dv->format(); } else { LOG_WARN("format() is bogus since validator is not a WDateValidator"); return WT_USTRING(); } }
// Unless the given text is empty, input the text as if it was // entered character by character on the client side, applying // the input mask, if present. WT_USTRING WLineEdit::inputText(const WT_USTRING& text) const { if (!raw_.empty() && !text.empty()) { std::u32string newText = text; std::u32string result = raw_; char32_t chr; bool hadIgnoredChar = false; std::size_t j = 0, i = 0; for (i = 0; i < newText.length(); ++i) { std::size_t previousJ = j; chr = newText[i]; while (j < mask_.length() && !acceptChar(chr, j)) { ++j; /* Try to move forward as long as this characer is not * accepted in this position */ } if (j == mask_.length()) { j = previousJ; hadIgnoredChar = true; } else { if (raw_[j] != chr) { if (case_[j] == '>') { chr = toupper(chr); } else if (case_[j] == '<') { chr = tolower(chr); } result[j] = chr; } ++j; } } if (hadIgnoredChar) { LOG_INFO("Input mask: not all characters in input '" + text + "' complied with " "input mask " + inputMask_ + " and were ignored. Result is '" + result + "'."); } return WT_USTRING(result); } return text; }
WT_USTRING WRegExpValidator::regExp() const { return regexp_ ? regexp_->pattern() : WT_USTRING(); }
WT_USTRING WSortFilterProxyModel::filterRegExp() const { return regex_ ? regex_->pattern() : WT_USTRING(); }
WT_USTRING WPushButton::valueText() const { return WT_USTRING(); }
WT_USTRING WFormModel::valueText(Field field) const { WValidator *v = validator(field); return asString(value(field), v ? v->format() : WT_USTRING()); }