Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
Text Class Reference

#include <text.h>

+ Collaboration diagram for Text:

Public Member Functions

 Text ()
 
 Text (const QString &str)
 
 Text (const Text &text)
 
 ~Text ()
 
Textoperator= (const Text &text)
 
AtomfirstAtom ()
 
AtomlastAtom ()
 
Textoperator<< (Atom::AtomType atomType)
 
Textoperator<< (const QString &string)
 
Textoperator<< (const Atom &atom)
 
Textoperator<< (const LinkAtom &atom)
 Special output operator for LinkAtom.
 
Textoperator<< (const Text &text)
 
void stripFirstAtom ()
 
void stripLastAtom ()
 
bool isEmpty () const
 
bool contains (const QString &str) const
 Returns true if this Text contains the substring str.
 
QString toString () const
 This function traverses the atom list of the Text object, extracting all the string parts.
 
const AtomfirstAtom () const
 
const AtomlastAtom () const
 
Text subText (Atom::AtomType left, Atom::AtomType right, const Atom *from=nullptr, bool inclusive=false) const
 
void dump () const
 Prints a human-readable version of the contained atoms to stderr.
 
void clear ()
 
Text splitAtFirst (Atom::AtomType start)
 Splits the current Text from start to end into a new Text object.
 

Static Public Member Functions

static Text subText (const Atom *begin, const Atom *end=nullptr)
 
static Text sectionHeading (const Atom *sectionBegin)
 
static int compare (const Text &text1, const Text &text2)
 

Detailed Description

Definition at line 11 of file text.h.

Constructor & Destructor Documentation

◆ Text() [1/3]

QT_BEGIN_NAMESPACE Text::Text ( )

Definition at line 12 of file text.cpp.

Referenced by Doc::legaleseText(), sectionHeading(), and splitAtFirst().

+ Here is the caller graph for this function:

◆ Text() [2/3]

Text::Text ( const QString & str)
explicit

Definition at line 14 of file text.cpp.

◆ Text() [3/3]

Text::Text ( const Text & text)

Definition at line 19 of file text.cpp.

References operator=().

+ Here is the call graph for this function:

◆ ~Text()

Text::~Text ( )

Definition at line 24 of file text.cpp.

References clear().

+ Here is the call graph for this function:

Member Function Documentation

◆ clear()

void Text::clear ( )

Definition at line 269 of file text.cpp.

References Atom::next().

Referenced by ~Text(), Generator::generateThreadSafeness(), and operator=().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compare()

int Text::compare ( const Text & text1,
const Text & text2 )
static

Definition at line 280 of file text.cpp.

References firstAtom(), isEmpty(), lastAtom(), Atom::next(), and Atom::type().

Referenced by operator!=(), operator<(), operator<=(), operator==(), operator>(), and operator>=().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ contains()

bool Text::contains ( const QString & str) const
nodiscard

Returns true if this Text contains the substring str.

Definition at line 140 of file text.cpp.

References Atom::AutoLink, Atom::C, firstAtom(), Atom::next(), Atom::String, and Atom::type().

+ Here is the call graph for this function:

◆ dump()

void Text::dump ( ) const

Prints a human-readable version of the contained atoms to stderr.

The output is formatted as a linear list of atoms, with each atom being on its own line.

Each atom is represented by its type and its stringified-contents, if any, with a space between the two.

Indentation is used to emphasize the possible block-level relationship between consecutive atoms, increasing after a "Left" atom and decreasing just before a "Right" atom.

For example, if this Text represented the block-comment containing the text:

{\l {somelink} {This is a link}}

Then the human-readable output would look like the following:

\badcode ParaLeft Link "somelink" FormattingLeft "link" String "This is a link" FormattingRight "link" String ParaRight

Definition at line 225 of file text.cpp.

References firstAtom(), and Atom::next().

Referenced by Doc::Doc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ firstAtom() [1/2]

Atom * Text::firstAtom ( )
inline

Definition at line 21 of file text.h.

Referenced by processComparesWithCommand(), and Doc::trimmedBriefText().

+ Here is the caller graph for this function:

◆ firstAtom() [2/2]

const Atom * Text::firstAtom ( ) const
inlinenodiscard

Definition at line 34 of file text.h.

Referenced by WebXMLGenerator::append(), compare(), contains(), dump(), DocBookGenerator::generateText(), Generator::generateText(), operator<<(), subText(), and toString().

+ Here is the caller graph for this function:

◆ isEmpty()

bool Text::isEmpty ( ) const
inlinenodiscard

Definition at line 31 of file text.h.

Referenced by compare(), Generator::generateComparisonList(), Generator::generateEnumValuesForQmlProperty(), DocBookGenerator::generateHeader(), and writeDescription().

+ Here is the caller graph for this function:

◆ lastAtom() [1/2]

Atom * Text::lastAtom ( )
inline

Definition at line 22 of file text.h.

Referenced by DocBookGenerator::generateHeader(), and DocParser::parse().

+ Here is the caller graph for this function:

◆ lastAtom() [2/2]

const Atom * Text::lastAtom ( ) const
inlinenodiscard

Definition at line 35 of file text.h.

Referenced by compare().

+ Here is the caller graph for this function:

◆ operator<<() [1/5]

Text & Text::operator<< ( Atom::AtomType atomType)

Definition at line 38 of file text.cpp.

◆ operator<<() [2/5]

Text & Text::operator<< ( const Atom & atom)

Definition at line 48 of file text.cpp.

References Atom::type().

+ Here is the call graph for this function:

◆ operator<<() [3/5]

Text & Text::operator<< ( const LinkAtom & atom)

Special output operator for LinkAtom.

It makes a copy of the LinkAtom atom and connects the cop;y to the list in this Text.

Definition at line 71 of file text.cpp.

References LinkAtom::LinkAtom(), and LinkAtom::LinkAtom().

+ Here is the call graph for this function:

◆ operator<<() [4/5]

Text & Text::operator<< ( const QString & string)

Definition at line 43 of file text.cpp.

References Atom::String.

◆ operator<<() [5/5]

Text & Text::operator<< ( const Text & text)

Definition at line 81 of file text.cpp.

References firstAtom(), and Atom::next().

+ Here is the call graph for this function:

◆ operator=()

Text & Text::operator= ( const Text & text)

Definition at line 29 of file text.cpp.

References clear().

Referenced by Text(), and DocBookGenerator::generateHeader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sectionHeading()

Text Text::sectionHeading ( const Atom * sectionBegin)
static

Definition at line 176 of file text.cpp.

References Text(), Atom::next(), Atom::SectionHeadingLeft, Atom::SectionHeadingRight, subText(), and Atom::type().

Referenced by WebXMLGenerator::addAtomElements(), and Tree::refForAtom().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ splitAtFirst()

Text Text::splitAtFirst ( Atom::AtomType start)
nodiscard

Splits the current Text from start to end into a new Text object.

Returns a new Text from the first Atom in this Text of atom type start.

Definition at line 313 of file text.cpp.

References Text(), Atom::next(), Atom::setNext(), and Atom::type().

Referenced by processComparesWithCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stripFirstAtom()

void Text::stripFirstAtom ( )

Definition at line 91 of file text.cpp.

References Atom::next().

Referenced by DocParser::parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stripLastAtom()

void Text::stripLastAtom ( )

Definition at line 102 of file text.cpp.

References Atom::next(), and Atom::setNext().

+ Here is the call graph for this function:

◆ subText() [1/2]

Text Text::subText ( Atom::AtomType left,
Atom::AtomType right,
const Atom * from = nullptr,
bool inclusive = false ) const

Definition at line 153 of file text.cpp.

References firstAtom(), Atom::next(), subText(), and Atom::type().

Referenced by Doc::briefText(), and Doc::legaleseText().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ subText() [2/2]

Text Text::subText ( const Atom * begin,
const Atom * end = nullptr )
static

Definition at line 257 of file text.cpp.

References Atom::next().

Referenced by sectionHeading(), and subText().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toString()

QString Text::toString ( ) const
nodiscard

This function traverses the atom list of the Text object, extracting all the string parts.

It concatenates them to a result string and returns it.

Definition at line 124 of file text.cpp.

References Atom::AutoLink, Atom::C, firstAtom(), Atom::next(), Atom::String, and Atom::type().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: