Qt 4.8
Classes | Public Functions | Private Functions | Properties | Friends | List of all members
QFragmentMap< Fragment > Class Template Reference

#include <qfragmentmap_p.h>

Classes

class  ConstIterator
 
class  Iterator
 

Public Functions

Iterator begin ()
 
ConstIterator begin () const
 
void clear ()
 
Iterator end ()
 
ConstIterator end () const
 
uint erase_single (uint f)
 
Iterator find (int k, uint field=0)
 
ConstIterator find (int k, uint field=0) const
 
uint findNode (int k, uint field=0) const
 
int firstNode () const
 
Fragment * fragment (uint index)
 
const Fragment * fragment (uint index) const
 
uint insert_single (int key, uint length)
 
bool isEmpty () const
 
bool isValid (uint n) const
 
ConstIterator last () const
 
int length (uint field=0) const
 
uint next (uint n) const
 
int numNodes () const
 
uint position (uint node, uint field=0) const
 
uint previous (uint n) const
 
 QFragmentMap ()
 
void setSize (uint node, int new_size, uint field=0)
 
uint size (uint node, uint field=0) const
 
 ~QFragmentMap ()
 

Private Functions

QFragmentMapoperator= (const QFragmentMap &m)
 
 QFragmentMap (const QFragmentMap &m)
 

Properties

QFragmentMapData< Fragment > data
 

Friends

class ConstIterator
 
class Iterator
 

Detailed Description

template<class Fragment>
class QFragmentMap< Fragment >

Definition at line 723 of file qfragmentmap_p.h.

Constructors and Destructors

◆ QFragmentMap() [1/2]

template<class Fragment>
QFragmentMap< Fragment >::QFragmentMap ( )
inline

Definition at line 801 of file qfragmentmap_p.h.

801 {}

◆ ~QFragmentMap()

template<class Fragment>
QFragmentMap< Fragment >::~QFragmentMap ( )
inline

Definition at line 802 of file qfragmentmap_p.h.

803  {
804  if (!data.fragments)
805  return; // in case of out-of-memory, we won't have fragments
806  for (Iterator it = begin(); !it.atEnd(); ++it)
807  it.value()->free();
808  }
#define it(className, varName)
Iterator begin()
friend class Iterator
QFragmentMapData< Fragment > data

◆ QFragmentMap() [2/2]

template<class Fragment>
QFragmentMap< Fragment >::QFragmentMap ( const QFragmentMap< Fragment > &  m)
private

Functions

◆ begin() [1/2]

template<class Fragment>
Iterator QFragmentMap< Fragment >::begin ( )
inline

Definition at line 816 of file qfragmentmap_p.h.

Referenced by QTextDocumentPrivate::compressPieceTable(), QTextDocumentPrivate::setLayout(), and QTextOdfWriter::writeAll().

816 { return Iterator(this, data.minimum(data.root())); }
friend class Iterator
QFragmentMapData< Fragment > data

◆ begin() [2/2]

template<class Fragment>
ConstIterator QFragmentMap< Fragment >::begin ( ) const
inline

Definition at line 818 of file qfragmentmap_p.h.

818 { return ConstIterator(this, data.minimum(data.root())); }
QFragmentMapData< Fragment > data
friend class ConstIterator

◆ clear()

template<class Fragment>
void QFragmentMap< Fragment >::clear ( )
inline

Definition at line 810 of file qfragmentmap_p.h.

Referenced by QTextDocumentPrivate::clear().

810  {
811  for (Iterator it = begin(); !it.atEnd(); ++it)
812  it.value()->free();
813  data.init();
814  }
#define it(className, varName)
Iterator begin()
friend class Iterator
QFragmentMapData< Fragment > data

◆ end() [1/2]

template<class Fragment>
Iterator QFragmentMap< Fragment >::end ( )
inline

Definition at line 817 of file qfragmentmap_p.h.

Referenced by QTextOdfWriter::writeAll().

817 { return Iterator(this, 0); }
friend class Iterator

◆ end() [2/2]

template<class Fragment>
ConstIterator QFragmentMap< Fragment >::end ( ) const
inline

Definition at line 819 of file qfragmentmap_p.h.

819 { return ConstIterator(this, 0); }
friend class ConstIterator

◆ erase_single()

template<class Fragment>
uint QFragmentMap< Fragment >::erase_single ( uint  f)
inline

Definition at line 842 of file qfragmentmap_p.h.

Referenced by QTextDocumentPrivate::remove_block(), QTextDocumentPrivate::remove_string(), and QTextDocumentPrivate::unite().

843  {
844  if (f != 0) {
845  Fragment *frag = fragment(f);
846  Q_ASSERT(frag);
847  frag->free();
848  }
849  return data.erase_single(f);
850  }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
Fragment * fragment(uint index)
QFragmentMapData< Fragment > data

◆ find() [1/2]

template<class Fragment>
Iterator QFragmentMap< Fragment >::find ( int  k,
uint  field = 0 
)
inline

Definition at line 827 of file qfragmentmap_p.h.

Referenced by QTextDocumentPrivate::blockCharFormatIndex(), QTextDocumentPrivate::setCharFormat(), and QTextTable::splitCell().

827 { return Iterator(this, data.findNode(k, field)); }
friend class Iterator
QFragmentMapData< Fragment > data

◆ find() [2/2]

template<class Fragment>
ConstIterator QFragmentMap< Fragment >::find ( int  k,
uint  field = 0 
) const
inline

Definition at line 828 of file qfragmentmap_p.h.

828 { return ConstIterator(this, data.findNode(k, field)); }
QFragmentMapData< Fragment > data
friend class ConstIterator

◆ findNode()

template<class Fragment>
uint QFragmentMap< Fragment >::findNode ( int  k,
uint  field = 0 
) const
inline

◆ firstNode()

template<class Fragment>
int QFragmentMap< Fragment >::firstNode ( ) const
inline

Definition at line 874 of file qfragmentmap_p.h.

Referenced by QTextCursor::charFormat().

874 { return data.minimum(data.root()); }
QFragmentMapData< Fragment > data

◆ fragment() [1/2]

template<class Fragment>
Fragment* QFragmentMap< Fragment >::fragment ( uint  index)
inline

◆ fragment() [2/2]

template<class Fragment>
const Fragment* QFragmentMap< Fragment >::fragment ( uint  index) const
inline

Definition at line 856 of file qfragmentmap_p.h.

856  {
857  Q_ASSERT(index != 0);
858  return data.fragment(index);
859  }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QFragmentMapData< Fragment > data
quint16 index

◆ insert_single()

template<class Fragment>
uint QFragmentMap< Fragment >::insert_single ( int  key,
uint  length 
)
inline

Definition at line 832 of file qfragmentmap_p.h.

Referenced by QTextDocumentPrivate::insert_block(), QTextDocumentPrivate::insert_string(), and QTextDocumentPrivate::split().

833  {
834  uint f = data.insert_single(key, length);
835  if (f != 0) {
836  Fragment *frag = fragment(f);
837  Q_ASSERT(frag);
838  frag->initialize();
839  }
840  return f;
841  }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
int length(uint field=0) const
unsigned int uint
Definition: qglobal.h:996
Fragment * fragment(uint index)
int key
QFragmentMapData< Fragment > data

◆ isEmpty()

template<class Fragment>
bool QFragmentMap< Fragment >::isEmpty ( ) const
inline

Definition at line 823 of file qfragmentmap_p.h.

823 { return data.head->node_count == 0; }
QFragmentMapData< Fragment > data

◆ isValid()

template<class Fragment>
bool QFragmentMap< Fragment >::isValid ( uint  n) const
inline

Definition at line 861 of file qfragmentmap_p.h.

861 { return data.isValid(n); }
QFragmentMapData< Fragment > data

◆ last()

template<class Fragment>
ConstIterator QFragmentMap< Fragment >::last ( ) const
inline

Definition at line 821 of file qfragmentmap_p.h.

821 { return ConstIterator(this, data.maximum(data.root())); }
QFragmentMapData< Fragment > data
friend class ConstIterator

◆ length()

template<class Fragment>
int QFragmentMap< Fragment >::length ( uint  field = 0) const
inline

◆ next()

template<class Fragment>
uint QFragmentMap< Fragment >::next ( uint  n) const
inline

◆ numNodes()

template<class Fragment>
int QFragmentMap< Fragment >::numNodes ( ) const
inline

Definition at line 824 of file qfragmentmap_p.h.

Referenced by QTextDocumentPrivate::ensureMaximumBlockCount(), and QTextDocumentPrivate::finishEdit().

824 { return data.head->node_count; }
QFragmentMapData< Fragment > data

◆ operator=()

template<class Fragment>
QFragmentMap& QFragmentMap< Fragment >::operator= ( const QFragmentMap< Fragment > &  m)
private

◆ position()

template<class Fragment>
uint QFragmentMap< Fragment >::position ( uint  node,
uint  field = 0 
) const
inline

◆ previous()

template<class Fragment>
uint QFragmentMap< Fragment >::previous ( uint  n) const
inline

Definition at line 863 of file qfragmentmap_p.h.

Referenced by QTextDocumentPrivate::insert_string(), QTextDocumentPrivate::move(), and QTextFrame::iterator::operator--().

863 { return data.previous(n); }
QFragmentMapData< Fragment > data

◆ setSize()

template<class Fragment>
void QFragmentMap< Fragment >::setSize ( uint  node,
int  new_size,
uint  field = 0 
)
inline

Definition at line 865 of file qfragmentmap_p.h.

Referenced by QTextDocumentPrivate::insert_block(), QTextDocumentPrivate::insert_string(), QTextDocumentPrivate::remove_block(), QTextDocumentPrivate::remove_string(), QTextDocumentPrivate::split(), and QTextDocumentPrivate::unite().

866  { data.setSize(node, new_size, field);
867  if (node != 0 && field == 0) {
868  Fragment *frag = fragment(node);
869  Q_ASSERT(frag);
870  frag->invalidate();
871  }
872  }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
Fragment * fragment(uint index)
QFragmentMapData< Fragment > data

◆ size()

template<class Fragment>
uint QFragmentMap< Fragment >::size ( uint  node,
uint  field = 0 
) const
inline

Friends and Related Functions

◆ ConstIterator

template<class Fragment>
friend class ConstIterator
friend

Definition at line 878 of file qfragmentmap_p.h.

◆ Iterator

template<class Fragment>
friend class Iterator
friend

Definition at line 877 of file qfragmentmap_p.h.

Properties

◆ data

template<class Fragment>
QFragmentMapData<Fragment> QFragmentMap< Fragment >::data
private

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