QCodeEdit  2.2
Protected Attributes | List of all members
QFormatScheme Class Reference

A storage/configuration class for shared highlighting formats. More...

Inheritance diagram for QFormatScheme:
Inheritance graph
[legend]

Protected Attributes

QString m_settings
 
QVector< QString > m_formatKeys
 
QVector< QFormatm_formatValues
 
 QFormatScheme (QObject *p=0)
 Constructor.
 
 QFormatScheme (const QString &f, QObject *p=0)
 Constructor. More...
 
virtual ~QFormatScheme ()
 Destructor.
 
void clear ()
 Re-initialize the format scheme. More...
 
virtual void load (const QString &filename)
 Load format settings from a file. More...
 
virtual void save (const QString &filename=QString()) const
 Save the format settings to a file. More...
 
virtual void load (const QDomElement &doc, bool ignoreNewIds=false)
 
virtual void save (QDomElement &elem) const
 
virtual void load (QSettings &s, bool ignoreNewIds=false)
 Load format data from a QSettings object. More...
 
virtual void save (QSettings &s) const
 
int formatCount () const
 
QStringList formats () const
 
virtual QString id (int ifid) const
 
virtual int id (const QString &sfid) const
 
virtual QFormatformatRef (int ifid)
 
virtual QFormatformatRef (const QString &sfid)
 
virtual QFormat format (int ifid) const
 
virtual QFormat format (const QString &sfid) const
 
virtual void setFormat (const QString &fid, const QFormat &fmt)
 Set text format for key. More...
 

Detailed Description

A storage/configuration class for shared highlighting formats.

It stores text formats used by highlighters interfaces and provides a default serializing format in QXF format (XML-based).

See also
QLanguageFactory
QHighlighter

Constructor & Destructor Documentation

◆ QFormatScheme()

QFormatScheme::QFormatScheme ( const QString &  f,
QObject p = 0 
)

Constructor.

Parameters
fFilename of a format settings file to load

References load().

Member Function Documentation

◆ clear()

void QFormatScheme::clear ( )

Re-initialize the format scheme.

Calling this method leaves the format scheme with only one format : the "normal" one, set to a default-constructed QFormat

References setFormat().

Referenced by load().

◆ format() [1/2]

QFormat QFormatScheme::format ( int  ifid) const
virtual
Returns
The text format associated with format key fid

Referenced by format().

◆ format() [2/2]

QFormat QFormatScheme::format ( const QString &  sfid) const
virtual
Returns
The text format associated with format key fid

References format().

◆ formatCount()

int QFormatScheme::formatCount ( ) const
Returns
The number of available formats

Referenced by QFormatConfig::apply(), and QFormatConfig::cancel().

◆ formatRef() [1/2]

QFormat & QFormatScheme::formatRef ( int  ifid)
virtual
Returns
The text format associated with format key fid
Warning
Use at your own risks : if there are no format associated with the requested id this function will crash

Referenced by QFormatConfig::apply(), and QFormatConfig::cancel().

◆ formatRef() [2/2]

QFormat & QFormatScheme::formatRef ( const QString &  sfid)
virtual
Returns
The a reference to the text format associated with format key fid
Warning
Use at your own risks : if there are no format associated with the requested id this function will crash.

References id().

◆ formats()

QStringList QFormatScheme::formats ( ) const
Returns
A list of available format keys

◆ id() [1/2]

QString QFormatScheme::id ( int  ifid) const
virtual
Returns
The format key associated to integer format id ifid

Referenced by QFormatConfig::apply(), QFormatConfig::cancel(), formatRef(), QNFADefinition::match(), and QDocumentSearch::setOption().

◆ id() [2/2]

int QFormatScheme::id ( const QString &  sfid) const
virtual
Returns
The integer format id associated to format key fid

◆ load() [1/3]

void QFormatScheme::load ( const QString &  f)
virtual

Load format settings from a file.

Parameters
ffile to load data from

The default implementation loads data in QXF format (XML-based)

Note
Previous content is discarded

References clear().

Referenced by QFormatScheme().

◆ load() [2/3]

void QFormatScheme::load ( const QDomElement &  elem,
bool  ignoreNewIds = false 
)
virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
elemSource element to scan
ignoreNewIdswhether unknown format identifiers should be ignored

The given dom element must contain a proper version attribute and format data as child elements (<format> tags)

Note
Previous content is not discarded

◆ load() [3/3]

void QFormatScheme::load ( QSettings &  s,
bool  ignoreNewIds = false 
)
virtual

Load format data from a QSettings object.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
sQSettings object from which data will be fetched
ignoreNewIdswhether unknown format identifiers should be ignored

The QSettings object is assumed to be initialized properly and to point to a correct location.

Note
Previous content is not discarded

◆ save() [1/3]

void QFormatScheme::save ( const QString &  f = QString()) const
virtual

Save the format settings to a file.

Parameters
ftarget file (if none specified, last value passed to load is used)

The default implementation saves data in QXF format (XML-based)

Referenced by QFormatConfig::apply().

◆ save() [2/3]

void QFormatScheme::save ( QDomElement &  elem) const
virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ save() [3/3]

void QFormatScheme::save ( QSettings &  s) const
virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ setFormat

void QFormatScheme::setFormat ( const QString &  fid,
const QFormat fmt 
)
virtualslot

Set text format for key.

Parameters
fidFormat key
fmtFormat value

Referenced by clear(), and QFormatScheme().


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