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
Atom Class Reference

The Atom class is the fundamental unit for representing documents internally. More...

#include <atom.h>

+ Inheritance diagram for Atom:
+ Collaboration diagram for Atom:

Public Types

enum  AtomType {
  AnnotatedList , AutoLink , BaseName , BR ,
  BriefLeft , BriefRight , C , CaptionLeft ,
  CaptionRight , Code , CodeBad , CodeQuoteArgument ,
  CodeQuoteCommand , ComparesLeft , ComparesRight , DetailsLeft ,
  DetailsRight , DivLeft , DivRight , ExampleFileLink ,
  ExampleImageLink , FootnoteLeft , FootnoteRight , FormatElse ,
  FormatEndif , FormatIf , FormattingLeft , FormattingRight ,
  GeneratedList , HR , Image , ImageText ,
  ImportantLeft , ImportantRight , InlineImage , Keyword ,
  LegaleseLeft , LegaleseRight , LineBreak , Link ,
  LinkNode , ListLeft , ListItemNumber , ListTagLeft ,
  ListTagRight , ListItemLeft , ListItemRight , ListRight ,
  NavAutoLink , NavLink , Nop , NoteLeft ,
  NoteRight , ParaLeft , ParaRight , Qml ,
  QuotationLeft , QuotationRight , RawString , SectionLeft ,
  SectionRight , SectionHeadingLeft , SectionHeadingRight , SidebarLeft ,
  SidebarRight , SinceList , SinceTagLeft , SinceTagRight ,
  SnippetCommand , SnippetIdentifier , SnippetLocation , String ,
  TableLeft , TableRight , TableHeaderLeft , TableHeaderRight ,
  TableRowLeft , TableRowRight , TableItemLeft , TableItemRight ,
  TableOfContents , Target , UnhandledFormat , WarningLeft ,
  WarningRight , UnknownCommand , Last = UnknownCommand
}
 \value AnnotatedList \value AutoLink \value BaseName \value BriefLeft \value BriefRight \value C \value CaptionLeft \value CaptionRight \value Code \value CodeBad \value CodeQuoteArgument \value CodeQuoteCommand \value DetailsLeft \value DetailsRight \value DivLeft \value DivRight \value ExampleFileLink \value ExampleImageLink \value FormatElse \value FormatEndif \value FormatIf \value FootnoteLeft \value FootnoteRight \value FormattingLeft \value FormattingRight \value GeneratedList \value Image \value ImageText \value ImportantNote \value InlineImage \value Keyword \value LineBreak \value Link \value LinkNode \value ListLeft \value ListItemNumber \value ListTagLeft \value ListTagRight \value ListItemLeft \value ListItemRight \value ListRight \value NavAutoLink \value NavLink \value Nop \value Note \value ParaLeft \value ParaRight \value Qml \value QuotationLeft \value QuotationRight \value RawString \value SectionLeft \value SectionRight \value SectionHeadingLeft \value SectionHeadingRight \value SidebarLeft \value SidebarRight \value SinceList \value SinceTagLeft \value SinceTagRight \value String \value TableLeft \value TableRight \value TableHeaderLeft \value TableHeaderRight \value TableRowLeft \value TableRowRight \value TableItemLeft \value TableItemRight \value TableOfContents \value Target \value UnhandledFormat \value UnknownCommand More...
 

Public Member Functions

 Atom (AtomType type, const QString &string="")
 Constructs an atom of the specified type with the single parameter string and does not put the new atom in a list.
 
 Atom (AtomType type, const QString &p1, const QString &p2)
 Constructs an atom of the specified type with the two parameters p1 and p2 and does not put the new atom in a list.
 
 Atom (Atom *previous, AtomType type, const QString &string)
 
 Atom (Atom *previous, AtomType type, const QString &p1, const QString &p2)
 Constructs an atom of the specified type with the two parameters p1 and p2 and inserts the new atom into the list after the previous atom.
 
virtual ~Atom ()=default
 
void appendChar (QChar ch)
 Appends ch to the string parameter of this atom.
 
void concatenateString (const QString &string)
 Appends string to the string parameter of this atom.
 
void append (const QString &string)
 
void chopString ()
 \also string()
 
void setString (const QString &string)
 
Atomnext ()
 Return the next atom in the atom list.
 
void setNext (Atom *newNext)
 
const Atomfind (AtomType t) const
 Starting from this Atom, searches the linked list for the atom of specified type t and returns it.
 
const Atomfind (AtomType t, const QString &s) const
 Starting from this Atom, searches the linked list for the atom of specified type t and string s, and returns it.
 
const Atomnext () const
 Return the next atom in the atom list.
 
const Atomnext (AtomType t) const
 Return the next Atom in the list if it is of AtomType t.
 
const Atomnext (AtomType t, const QString &s) const
 Return the next Atom in the list if it is of AtomType t and its string part is s.
 
AtomType type () const
 Return the type of this atom.
 
QString typeString () const
 Return the type of this atom as a string.
 
const QStringstring () const
 Returns the string parameter that together with the type characterizes this atom.
 
const QStringstring (int i) const
 
qsizetype count () const
 
QString linkText () const
 For a link atom, returns the string representing the link text if one exist in the list of atoms.
 
const QStringListstrings () const
 
virtual bool isLinkAtom () const
 
virtual Node::Genus genus ()
 
virtual Treedomain ()
 
virtual void resolveSquareBracketParams ()
 

Protected Attributes

Atomm_next = nullptr
 
AtomType m_type {}
 
QStringList m_strs {}
 

Friends

class LinkAtom
 

Detailed Description

The Atom class is the fundamental unit for representing documents internally.

Atoms have a \i type and are completed by a \i string whose meaning depends on the \i type. For example, the string \quotation \i italic text looks nicer than \bold bold text \endquotation is represented by the following atoms: \quotation (FormattingLeft, ATOM_FORMATTING_ITALIC) (String, "italic") (FormattingRight, ATOM_FORMATTING_ITALIC) (String, " text is more attractive than ") (FormattingLeft, ATOM_FORMATTING_BOLD) (String, "bold") (FormattingRight, ATOM_FORMATTING_BOLD) (String, " text") \endquotation

\also Text

Definition at line 17 of file atom.h.

Member Enumeration Documentation

◆ AtomType

\value AnnotatedList \value AutoLink \value BaseName \value BriefLeft \value BriefRight \value C \value CaptionLeft \value CaptionRight \value Code \value CodeBad \value CodeQuoteArgument \value CodeQuoteCommand \value DetailsLeft \value DetailsRight \value DivLeft \value DivRight \value ExampleFileLink \value ExampleImageLink \value FormatElse \value FormatEndif \value FormatIf \value FootnoteLeft \value FootnoteRight \value FormattingLeft \value FormattingRight \value GeneratedList \value Image \value ImageText \value ImportantNote \value InlineImage \value Keyword \value LineBreak \value Link \value LinkNode \value ListLeft \value ListItemNumber \value ListTagLeft \value ListTagRight \value ListItemLeft \value ListItemRight \value ListRight \value NavAutoLink \value NavLink \value Nop \value Note \value ParaLeft \value ParaRight \value Qml \value QuotationLeft \value QuotationRight \value RawString \value SectionLeft \value SectionRight \value SectionHeadingLeft \value SectionHeadingRight \value SidebarLeft \value SidebarRight \value SinceList \value SinceTagLeft \value SinceTagRight \value String \value TableLeft \value TableRight \value TableHeaderLeft \value TableHeaderRight \value TableRowLeft \value TableRowRight \value TableItemLeft \value TableItemRight \value TableOfContents \value Target \value UnhandledFormat \value UnknownCommand

Enumerator
AnnotatedList 
AutoLink 
BaseName 
BR 
BriefLeft 
BriefRight 
CaptionLeft 
CaptionRight 
Code 
CodeBad 
CodeQuoteArgument 
CodeQuoteCommand 
ComparesLeft 
ComparesRight 
DetailsLeft 
DetailsRight 
DivLeft 
DivRight 
ExampleFileLink 
ExampleImageLink 
FootnoteLeft 
FootnoteRight 
FormatElse 
FormatEndif 
FormatIf 
FormattingLeft 
FormattingRight 
GeneratedList 
HR 
Image 
ImageText 
ImportantLeft 
ImportantRight 
InlineImage 
Keyword 
LegaleseLeft 
LegaleseRight 
LineBreak 
Link 
LinkNode 
ListLeft 
ListItemNumber 
ListTagLeft 
ListTagRight 
ListItemLeft 
ListItemRight 
ListRight 
NavAutoLink 
NavLink 
Nop 
NoteLeft 
NoteRight 
ParaLeft 
ParaRight 
Qml 
QuotationLeft 
QuotationRight 
RawString 
SectionLeft 
SectionRight 
SectionHeadingLeft 
SectionHeadingRight 
SidebarLeft 
SidebarRight 
SinceList 
SinceTagLeft 
SinceTagRight 
SnippetCommand 
SnippetIdentifier 
SnippetLocation 
String 
TableLeft 
TableRight 
TableHeaderLeft 
TableHeaderRight 
TableRowLeft 
TableRowRight 
TableItemLeft 
TableItemRight 
TableOfContents 
Target 
UnhandledFormat 
WarningLeft 
WarningRight 
UnknownCommand 
Last 

Definition at line 20 of file atom.h.

Constructor & Destructor Documentation

◆ Atom() [1/4]

Atom::Atom ( AtomType type,
const QString & string = "" )
inlineexplicit

Constructs an atom of the specified type with the single parameter string and does not put the new atom in a list.

Definition at line 112 of file atom.h.

References m_type.

◆ Atom() [2/4]

Atom::Atom ( AtomType type,
const QString & p1,
const QString & p2 )
inline

Constructs an atom of the specified type with the two parameters p1 and p2 and does not put the new atom in a list.

Definition at line 114 of file atom.h.

References m_type.

◆ Atom() [3/4]

Atom::Atom ( Atom * previous,
AtomType type,
const QString & string )
inline

Definition at line 120 of file atom.h.

References m_next, and m_type.

◆ Atom() [4/4]

Atom::Atom ( Atom * previous,
AtomType type,
const QString & p1,
const QString & p2 )
inline

Constructs an atom of the specified type with the two parameters p1 and p2 and inserts the new atom into the list after the previous atom.

Definition at line 126 of file atom.h.

References m_next, and m_type.

◆ ~Atom()

virtual Atom::~Atom ( )
virtualdefault

Member Function Documentation

◆ append()

void Atom::append ( const QString & string)
inline

Definition at line 138 of file atom.h.

◆ appendChar()

void Atom::appendChar ( QChar ch)
inline

Appends ch to the string parameter of this atom.

\also string()

Definition at line 136 of file atom.h.

◆ chopString()

void Atom::chopString ( )
inline

\also string()

Definition at line 139 of file atom.h.

Referenced by DocParser::parse().

+ Here is the caller graph for this function:

◆ concatenateString()

void Atom::concatenateString ( const QString & string)
inline

Appends string to the string parameter of this atom.

\also string()

Definition at line 137 of file atom.h.

◆ count()

qsizetype Atom::count ( ) const
inlinenodiscard

Definition at line 153 of file atom.h.

◆ domain()

virtual Tree * Atom::domain ( )
inlinevirtual

Reimplemented in LinkAtom.

Definition at line 159 of file atom.h.

Referenced by QDocDatabase::findNodeForAtom().

+ Here is the caller graph for this function:

◆ find() [1/2]

const Atom * Atom::find ( AtomType t) const
nodiscard

Starting from this Atom, searches the linked list for the atom of specified type t and returns it.

Returns \nullptr if no such atom is found.

Definition at line 259 of file atom.cpp.

References next(), and type().

+ Here is the call graph for this function:

◆ find() [2/2]

const Atom * Atom::find ( AtomType t,
const QString & s ) const
nodiscard

Starting from this Atom, searches the linked list for the atom of specified type t and string s, and returns it.

Returns \nullptr if no such atom is found.

Definition at line 272 of file atom.cpp.

References next(), and type().

+ Here is the call graph for this function:

◆ genus()

virtual Node::Genus Atom::genus ( )
inlinevirtual

Reimplemented in LinkAtom.

Definition at line 158 of file atom.h.

References Node< _Tp >::DontCare.

Referenced by QDocDatabase::findNodeForAtom().

+ Here is the caller graph for this function:

◆ isLinkAtom()

virtual bool Atom::isLinkAtom ( ) const
inlinenodiscardvirtual

Reimplemented in LinkAtom.

Definition at line 157 of file atom.h.

Referenced by QDocDatabase::findNodeForAtom(), and HtmlGenerator::generateAtom().

+ Here is the caller graph for this function:

◆ linkText()

QString Atom::linkText ( ) const
nodiscard

For a link atom, returns the string representing the link text if one exist in the list of atoms.

Definition at line 353 of file atom.cpp.

References FormattingRight, Link, m_type, next(), and type().

+ Here is the call graph for this function:

◆ next() [1/4]

Atom * Atom::next ( )
inline

Return the next atom in the atom list.

\also type(), string()

Definition at line 141 of file atom.h.

References m_next.

Referenced by Text::clear(), Text::splitAtFirst(), Text::stripFirstAtom(), and Text::stripLastAtom().

+ Here is the caller graph for this function:

◆ next() [2/4]

◆ next() [3/4]

const Atom * Atom::next ( AtomType t) const
nodiscard

Return the next Atom in the list if it is of AtomType t.

Otherwise return 0.

Definition at line 289 of file atom.cpp.

References m_next, and type().

Referenced by nextSection().

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

◆ next() [4/4]

const Atom * Atom::next ( AtomType t,
const QString & s ) const
nodiscard

Return the next Atom in the list if it is of AtomType t and its string part is s.

Otherwise return 0.

Definition at line 298 of file atom.cpp.

References m_next, and type().

+ Here is the call graph for this function:

◆ resolveSquareBracketParams()

virtual void Atom::resolveSquareBracketParams ( )
inlinevirtual

Reimplemented in LinkAtom.

Definition at line 160 of file atom.h.

◆ setNext()

void Atom::setNext ( Atom * newNext)
inline

Definition at line 142 of file atom.h.

References m_next.

Referenced by Text::splitAtFirst(), and Text::stripLastAtom().

+ Here is the caller graph for this function:

◆ setString()

void Atom::setString ( const QString & string)
inline

Definition at line 140 of file atom.h.

◆ string() [1/2]

const QString & Atom::string ( ) const
inlinenodiscard

Returns the string parameter that together with the type characterizes this atom.

\also type(), next()

Definition at line 151 of file atom.h.

◆ string() [2/2]

const QString & Atom::string ( int i) const
inlinenodiscard

Definition at line 152 of file atom.h.

◆ strings()

const QStringList & Atom::strings ( ) const
inlinenodiscard

Definition at line 155 of file atom.h.

◆ type()

◆ typeString()

QString Atom::typeString ( ) const
nodiscard

Return the type of this atom as a string.

Return "Invalid" if type() returns an impossible value.

This is only useful for debugging.

\also type()

Definition at line 321 of file atom.cpp.

References english, Last, no, and type().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ LinkAtom

friend class LinkAtom
friend

Definition at line 110 of file atom.h.

Member Data Documentation

◆ m_next

Atom* Atom::m_next = nullptr
protected

Definition at line 163 of file atom.h.

Referenced by Atom(), Atom(), LinkAtom::LinkAtom(), next(), next(), next(), next(), and setNext().

◆ m_strs

QStringList Atom::m_strs {}
protected

Definition at line 165 of file atom.h.

◆ m_type

AtomType Atom::m_type {}
protected

Definition at line 164 of file atom.h.

Referenced by Atom(), Atom(), Atom(), Atom(), linkText(), and type().


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