本文整理汇总了C++中plainText函数的典型用法代码示例。如果您正苦于以下问题:C++ plainText函数的具体用法?C++ plainText怎么用?C++ plainText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了plainText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASSERT
void HTMLTextAreaElement::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent* event) const
{
ASSERT(event);
ASSERT(layoutObject());
int signedMaxLength = maxLength();
if (signedMaxLength < 0)
return;
unsigned unsignedMaxLength = static_cast<unsigned>(signedMaxLength);
const String& currentValue = innerEditorValue();
unsigned currentLength = computeLengthForSubmission(currentValue);
if (currentLength + computeLengthForSubmission(event->text()) < unsignedMaxLength)
return;
// selectionLength represents the selection length of this text field to be
// removed by this insertion.
// If the text field has no focus, we don't need to take account of the
// selection length. The selection is the source of text drag-and-drop in
// that case, and nothing in the text field will be removed.
unsigned selectionLength = 0;
if (focused()) {
const EphemeralRange range = document().frame()->selection().selection().toNormalizedEphemeralRange();
selectionLength = computeLengthForSubmission(plainText(range));
}
ASSERT(currentLength >= selectionLength);
unsigned baseLength = currentLength - selectionLength;
unsigned appendableLength = unsignedMaxLength > baseLength ? unsignedMaxLength - baseLength : 0;
event->setText(sanitizeUserInputValue(event->text(), appendableLength));
}
示例2: plainText
void HistoryLogger::saveMessage(const Message* message)
{
if (message->flags() & MESSAGE_FLAG_ALARM)
return;
Xapian::Document doc;
quint32 flags = message->flags();
std::string plainText(message->plainText().toUtf8());
std::string confUser(message->getConfUser().constData());
std::string data;
if (flags & MESSAGE_FLAG_RTF)
data = message->rtfText().constData();
else
data = plainText;
std::cout << "HistoryLogger::saveMessage data = " << data << std::endl;
doc.set_data(data);
Xapian::TermGenerator termGen;
termGen.set_stemmer(Xapian::Stem("ru"));
termGen.set_document(doc);
termGen.index_text(plainText);
doc.add_value(0, message->dateTime().toString("yyyyMMdd").toStdString());
doc.add_value(1, message->dateTime().toString("hhmmss").toStdString());
doc.add_value(2, QString::number(flags, 16).toStdString());
doc.add_value(3, message->type() == Message::Outgoing? "o" : "i");
doc.add_value(4, confUser);
database->add_document(doc);
database->flush();
}
示例3: ASSERT
const String& TextCheckingParagraph::text() const
{
ASSERT(m_checkingRange.isNotNull());
if (m_text.isEmpty())
m_text = plainText(paragraphRange());
return m_text;
}
示例4: String
String DOMSelection::toString()
{
if (!m_frame)
return String();
return plainText(m_frame->selection()->selection().toNormalizedRange().get());
}
示例5: parentCollection
int TKAction::plug(QWidget* widget, int index)
{
if ( widget->inherits("KToolBar") ) {
KToolBar* bar = static_cast<KToolBar*>(widget);
int id_ = KAction::getToolButtonID();
KInstance *instance;
if ( parentCollection() )
instance = parentCollection()->instance();
else
instance = KGlobal::instance();
TKToolBarButton* b = new TKToolBarButton(icon(),plainText(),bar,name(),instance);
// we don't need clicked() and buttonClicked(), do we?
// connect(b,SIGNAL(clicked()),SLOT(slotActivated()));
b->setIconMode(m_imode);
initToolBarButton(b);
bar->insertWidget( id_, 100, b, index );
addContainer(bar,id_);
connect( bar, SIGNAL(destroyed()), this, SLOT(slotDestroyed()) );
return containerCount() - 1;
}
return KAction::plug(widget,index);
}
示例6: QString
QString Fingering::accessibleInfo() const
{
QString rez = Element::accessibleInfo();
if (tid() == Tid::STRING_NUMBER)
rez += " " + QObject::tr("String number");
return QString("%1: %2").arg(rez).arg(plainText());
}
示例7: CreateDataFromPrimitive
//
// CreateDataFromPrimitive
//
// Given a nsISupports* primitive and the flavor it represents, creates a new data
// buffer with the data in it. This data will be null terminated, but the length
// parameter does not reflect that.
//
void
nsPrimitiveHelpers :: CreateDataFromPrimitive ( const char* aFlavor, nsISupports* aPrimitive,
void** aDataBuff, uint32_t aDataLen )
{
if ( !aDataBuff )
return;
*aDataBuff = nullptr;
if ( strcmp(aFlavor,kTextMime) == 0 || strcmp(aFlavor,kCustomTypesMime) == 0) {
nsCOMPtr<nsISupportsCString> plainText ( do_QueryInterface(aPrimitive) );
if ( plainText ) {
nsAutoCString data;
plainText->GetData ( data );
*aDataBuff = ToNewCString(data);
}
}
else {
nsCOMPtr<nsISupportsString> doubleByteText ( do_QueryInterface(aPrimitive) );
if ( doubleByteText ) {
nsAutoString data;
doubleByteText->GetData ( data );
*aDataBuff = ToNewUnicode(data);
}
}
}
示例8: plainText
QString TempoText::accessibleInfo() const
{
TDuration t1;
TDuration t2;
int len1;
int len2;
QString text = plainText();
QString firstPart = text.split(" = ").first();
QString secondPart = text.split(" = ").back();
int x1 = findTempoDuration(firstPart, len1, t1);
int x2 = -1;
if (_relative)
x2 = findTempoDuration(secondPart, len2, t2);
if (x1 != -1) {
QString dots1;
QString dots2;
dots1 = duration2userName(t1);
if (x2 != -1) {
dots2 = duration2userName(t2);
return QString("%1: %2 %3 = %4 %5").arg(Element::accessibleInfo()).arg(dots1).arg(tr("note")).arg(dots2).arg(tr("note"));
}
else
return QString("%1: %2 %3 = %4").arg(Element::accessibleInfo()).arg(dots1).arg(tr("note")).arg(secondPart);
}
else
return Text::accessibleInfo();
}
示例9: ASSERT
void HTMLTextAreaElement::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent* event) const
{
ASSERT(event);
ASSERT(renderer());
int signedMaxLength = maxLength();
if (signedMaxLength < 0)
return;
unsigned unsignedMaxLength = static_cast<unsigned>(signedMaxLength);
const String& currentValue = innerTextValue();
unsigned numberOfLineBreaksInCurrentValue = numberOfLineBreaks(currentValue);
if (upperBoundForLengthForSubmission(currentValue, numberOfLineBreaksInCurrentValue)
+ upperBoundForLengthForSubmission(event->text(), numberOfLineBreaks(event->text())) < unsignedMaxLength)
return;
unsigned currentLength = computeLengthForSubmission(currentValue, numberOfLineBreaksInCurrentValue);
// selectionLength represents the selection length of this text field to be
// removed by this insertion.
// If the text field has no focus, we don't need to take account of the
// selection length. The selection is the source of text drag-and-drop in
// that case, and nothing in the text field will be removed.
unsigned selectionLength = focused() ? computeLengthForSubmission(plainText(document().frame()->selection().selection().toNormalizedRange().get())) : 0;
ASSERT(currentLength >= selectionLength);
unsigned baseLength = currentLength - selectionLength;
unsigned appendableLength = unsignedMaxLength > baseLength ? unsignedMaxLength - baseLength : 0;
event->setText(sanitizeUserInputValue(event->text(), appendableLength));
}
示例10: plainText
// static
PassRefPtrWillBeRawPtr<SpellCheckRequest> SpellCheckRequest::create(TextCheckingTypeMask textCheckingOptions, TextCheckingProcessType processType, const EphemeralRange& checkingRange, const EphemeralRange& paragraphRange, int requestNumber)
{
if (checkingRange.isNull())
return nullptr;
if (!checkingRange.startPosition().computeContainerNode()->rootEditableElement())
return nullptr;
String text = plainText(checkingRange, TextIteratorEmitsObjectReplacementCharacter);
if (text.isEmpty())
return nullptr;
RefPtrWillBeRawPtr<Range> checkingRangeObject = createRange(checkingRange);
RefPtrWillBeRawPtr<Range> paragraphRangeObject = nullptr;
// Share identical Range objects.
if (checkingRange == paragraphRange)
paragraphRangeObject = checkingRangeObject;
else
paragraphRangeObject = createRange(paragraphRange);
const DocumentMarkerVector& markers = checkingRangeObject->ownerDocument().markers().markersInRange(checkingRange, DocumentMarker::SpellCheckClientMarkers());
Vector<uint32_t> hashes(markers.size());
Vector<unsigned> offsets(markers.size());
for (size_t i = 0; i < markers.size(); ++i) {
hashes[i] = markers[i]->hash();
offsets[i] = markers[i]->startOffset();
}
return adoptRefWillBeNoop(new SpellCheckRequest(checkingRangeObject, paragraphRangeObject, text, textCheckingOptions, processType, hashes, offsets, requestNumber));
}
示例11: String
String WebFrame::contentsAsString() const
{
if (!m_coreFrame)
return String();
if (isFrameSet()) {
StringBuilder builder;
for (Frame* child = m_coreFrame->tree()->firstChild(); child; child = child->tree()->nextSibling()) {
if (!builder.isEmpty())
builder.append(' ');
builder.append(static_cast<WebFrameLoaderClient*>(child->loader()->client())->webFrame()->contentsAsString());
}
// FIXME: It may make sense to use toStringPreserveCapacity() here.
return builder.toString();
}
Document* document = m_coreFrame->document();
if (!document)
return String();
RefPtr<Element> documentElement = document->documentElement();
if (!documentElement)
return String();
RefPtr<Range> range = document->createRange();
ExceptionCode ec = 0;
range->selectNode(documentElement.get(), ec);
if (ec)
return String();
return plainText(range.get());
}
示例12: VisibleSelection
void SpellChecker::markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart, const VisibleSelection& selectionAfterTyping)
{
if (unifiedTextCheckerEnabled()) {
TextCheckingTypeMask textCheckingOptions = 0;
if (isContinuousSpellCheckingEnabled())
textCheckingOptions |= TextCheckingTypeSpelling;
if (!(textCheckingOptions & TextCheckingTypeSpelling))
return;
if (isGrammarCheckingEnabled())
textCheckingOptions |= TextCheckingTypeGrammar;
VisibleSelection adjacentWords = VisibleSelection(startOfWord(wordStart, LeftWordIfOnBoundary), endOfWord(wordStart, RightWordIfOnBoundary));
if (textCheckingOptions & TextCheckingTypeGrammar) {
VisibleSelection selectedSentence = VisibleSelection(startOfSentence(wordStart), endOfSentence(wordStart));
markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, adjacentWords.toNormalizedRange().get(), selectedSentence.toNormalizedRange().get());
} else {
markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, adjacentWords.toNormalizedRange().get(), adjacentWords.toNormalizedRange().get());
}
return;
}
if (!isContinuousSpellCheckingEnabled())
return;
// Check spelling of one word
RefPtr<Range> misspellingRange = nullptr;
markMisspellings(VisibleSelection(startOfWord(wordStart, LeftWordIfOnBoundary), endOfWord(wordStart, RightWordIfOnBoundary)), misspellingRange);
// Autocorrect the misspelled word.
if (!misspellingRange)
return;
// Get the misspelled word.
const String misspelledWord = plainText(misspellingRange.get());
String autocorrectedString = textChecker().getAutoCorrectSuggestionForMisspelledWord(misspelledWord);
// If autocorrected word is non empty, replace the misspelled word by this word.
if (!autocorrectedString.isEmpty()) {
VisibleSelection newSelection(misspellingRange.get(), DOWNSTREAM);
if (newSelection != m_frame.selection().selection()) {
m_frame.selection().setSelection(newSelection);
}
m_frame.editor().replaceSelectionWithText(autocorrectedString, false, false);
// Reset the charet one character further.
m_frame.selection().moveTo(m_frame.selection().selection().visibleEnd());
m_frame.selection().modify(FrameSelection::AlterationMove, DirectionForward, CharacterGranularity);
}
if (!isGrammarCheckingEnabled())
return;
// Check grammar of entire sentence
markBadGrammar(VisibleSelection(startOfSentence(wordStart), endOfSentence(wordStart)));
}
示例13: tr
QString Fingering::accessibleInfo()
{
QString rez = Element::accessibleInfo();
if (textStyleType() == TextStyleType::STRING_NUMBER) {
rez += " " + tr("String number");
}
return QString("%1: %2").arg(rez).arg(plainText());
}
示例14: String
String DOMSelection::toString()
{
if (!m_frame)
return String();
const EphemeralRange range = m_frame->selection().selection().toNormalizedEphemeralRange();
return plainText(range, TextIteratorForSelectionToString);
}
示例15: String
String AbstractInlineTextBox::text() const
{
if (!m_inlineTextBox || !m_layoutText)
return String();
unsigned start = m_inlineTextBox->start();
unsigned len = m_inlineTextBox->len();
if (Node* node = m_layoutText->node()) {
if (node->isTextNode())
return plainText(Position(node, start), Position(node, start + len), TextIteratorIgnoresStyleVisibility);
return plainText(Position(node, PositionAnchorType::BeforeAnchor), Position(node, PositionAnchorType::AfterAnchor), TextIteratorIgnoresStyleVisibility);
}
String result = m_layoutText->text().substring(start, len).simplifyWhiteSpace(WTF::DoNotStripWhiteSpace);
if (m_inlineTextBox->nextTextBox() && m_inlineTextBox->nextTextBox()->start() > m_inlineTextBox->end() && result.length() && !result.right(1).containsOnlyWhitespace())
return result + " ";
return result;
}