PP_RevisionAttr Class Reference

#include <pp_Revision.h>

List of all members.

Public Member Functions

 PP_RevisionAttr ()
 PP_RevisionAttr (const gchar *r)
 PP_RevisionAttr (UT_uint32 iId, PP_RevisionType eType, const gchar **pAttrs, const gchar **pProps)
 ~PP_RevisionAttr ()
void setRevision (const gchar *r)
void addRevision (UT_uint32 iId, PP_RevisionType eType, const gchar **pAttrs, const gchar **pProps)
bool changeRevisionType (UT_uint32 iId, PP_RevisionType eType)
bool changeRevisionId (UT_uint32 iOldId, UT_uint32 iNewId)
void removeRevisionIdWithType (UT_uint32 iId, PP_RevisionType eType)
void removeRevisionIdTypeless (UT_uint32 iId)
void removeAllLesserOrEqualIds (UT_uint32 id)
void removeAllHigherOrEqualIds (UT_uint32 id)
void removeRevision (const PP_Revision *pRev)
const PP_RevisiongetGreatestLesserOrEqualRevision (UT_uint32 id, const PP_Revision **ppR)
const PP_RevisiongetLowestGreaterOrEqualRevision (UT_uint32 id)
const PP_RevisiongetLastRevision ()
const PP_RevisiongetRevisionWithId (UT_uint32 iId, UT_uint32 &iMinId)
UT_uint32 getRevisionsCount () const
const PP_RevisiongetNthRevision (UT_uint32 n) const
void pruneForCumulativeResult (PD_Document *pDoc)
bool isVisible (UT_uint32 id)
bool hasProperty (UT_uint32 iId, const gchar *pName, const gchar *&pValue)
bool hasProperty (const gchar *pName, const gchar *&pValue)
PP_RevisionType getType (UT_uint32 iId)
PP_RevisionType getType ()
const gchar * getXMLstring ()
void forceDirty ()
bool isFragmentSuperfluous () const
bool operator== (const PP_RevisionAttr &op2) const

Private Member Functions

void _init (const gchar *r)
void _clear ()
void _refreshString ()

Private Attributes

UT_Vector m_vRev
UT_String m_sXMLstring
bool m_bDirty
UT_uint32 m_iSuperfluous
const PP_Revisionm_pLastRevision


Detailed Description

PP_RevisionAttr is class that represent a revision attribute; it is initialized by an attribute string:

some text</> ^^^^^^^^^^^^^^

R1, etc., conform to the following syntax (items in square brackets are optional):

[+]n[{props}[{atrrs}]] -- addition with optional properties and attributes; props and attrs are formed as `name:value' -n -- deletion !n{props} -- formating change only

where n is a numerical id of the revision and props is regular property string, for instance

font-family:Times New Roman

revoval of property/attribute is indicated by setting to -/-, e.g.,

font-family:-/-

(the revision attribute parser in the class translates that into "")

The class provides methods for adding and removing individual revisions and evaluating how a particular revised fragment should be displayed in the document


Constructor & Destructor Documentation

PP_RevisionAttr::PP_RevisionAttr (  )  [inline]

PP_RevisionAttr::PP_RevisionAttr ( const gchar *  r  ) 

create class instance from an XML attribute string

References _init().

PP_RevisionAttr::PP_RevisionAttr ( UT_uint32  iId,
PP_RevisionType  eType,
const gchar **  pAttrs,
const gchar **  pProps 
)

create class instance from a single revision data

References UT_GenericVector< T >::addItem(), and m_vRev.

PP_RevisionAttr::~PP_RevisionAttr (  ) 

References _clear().


Member Function Documentation

void PP_RevisionAttr::setRevision ( const gchar *  r  ) 

initialize instance with XML attribute string

References _clear(), and _init().

Referenced by pt_PieceTable::_translateRevisionAttribute().

void PP_RevisionAttr::addRevision ( UT_uint32  iId,
PP_RevisionType  eType,
const gchar **  pAttrs,
const gchar **  pProps 
)

bool PP_RevisionAttr::changeRevisionType ( UT_uint32  iId,
PP_RevisionType  eType 
)

changes the type of revision with id iId to eType; if revision with that id is not present, returns false

References PP_Revision::getId(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), m_bDirty, m_vRev, and PP_Revision::setType().

bool PP_RevisionAttr::changeRevisionId ( UT_uint32  iOldId,
UT_uint32  iNewId 
)

void PP_RevisionAttr::removeRevisionIdWithType ( UT_uint32  iId,
PP_RevisionType  eType 
)

removes id from this revision, respecting the sign, i.e., it will not remove -5 if given 5

References UT_GenericVector< T >::deleteNthItem(), PP_Revision::getId(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), PP_Revision::getType(), m_bDirty, m_pLastRevision, and m_vRev.

void PP_RevisionAttr::removeRevisionIdTypeless ( UT_uint32  iId  ) 

removes id from the attribute disregarding sign, i.e., if given 5 it will remove both -5 and +5

References UT_GenericVector< T >::deleteNthItem(), PP_Revision::getId(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), m_bDirty, m_pLastRevision, and m_vRev.

void PP_RevisionAttr::removeAllLesserOrEqualIds ( UT_uint32  iId  ) 

removes all IDs from the attribute whose value is lesser or equal the given id

References UT_GenericVector< T >::deleteNthItem(), PP_Revision::getId(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), m_bDirty, m_pLastRevision, and m_vRev.

void PP_RevisionAttr::removeAllHigherOrEqualIds ( UT_uint32  iId  ) 

removes all IDs from the attribute whose value is higher or equal the given id

References UT_GenericVector< T >::deleteNthItem(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), m_bDirty, m_pLastRevision, and m_vRev.

Referenced by PD_Document::_acceptRejectRevision().

void PP_RevisionAttr::removeRevision ( const PP_Revision pRev  ) 

const PP_Revision * PP_RevisionAttr::getGreatestLesserOrEqualRevision ( UT_uint32  id,
const PP_Revision **  ppR 
)

const PP_Revision * PP_RevisionAttr::getLowestGreaterOrEqualRevision ( UT_uint32  id  ) 

const PP_Revision * PP_RevisionAttr::getLastRevision (  ) 

const PP_Revision * PP_RevisionAttr::getRevisionWithId ( UT_uint32  iId,
UT_uint32 minId 
)

find revision with id == iId; if revision is not found minId contains the smallest id in this set greater than iId; if return value is and minId is PD_MAX_REVISION then there are revisions preset

References PP_Revision::getId(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), m_vRev, and PD_MAX_REVISION.

Referenced by pt_PieceTable::_fixHdrFtrReferences(), and PD_Document::explodeRevisions().

UT_uint32 PP_RevisionAttr::getRevisionsCount (  )  const [inline]

const PP_Revision* PP_RevisionAttr::getNthRevision ( UT_uint32  n  )  const [inline]

void PP_RevisionAttr::pruneForCumulativeResult ( PD_Document pDoc  ) 

bool PP_RevisionAttr::isVisible ( UT_uint32  id  ) 

please note that the following are convenience functions; if you need to make repeated enqueries, it is better to call getGreatestLesserOrEqualRevision() or getLastRevision() and querie the returned PP_Revision object.

given revision level id, this function returns true if given segment of text is to be visible, false if it is to be hidden

References getGreatestLesserOrEqualRevision(), PP_Revision::getType(), PP_REVISION_ADDITION, and PP_REVISION_ADDITION_AND_FMT.

Referenced by PD_Document::explodeRevisions().

bool PP_RevisionAttr::hasProperty ( UT_uint32  iId,
const gchar *  pName,
const gchar *&  pValue 
)

returns true if after revision iId this fragment carries revised property pName, the value of which will be stored in pValue; see notes on PP_Revision::hasProperty(...)

References getGreatestLesserOrEqualRevision(), PP_AttrProp::getProperty(), and s.

bool PP_RevisionAttr::hasProperty ( const gchar *  pName,
const gchar *&  pValue 
)

returns true if after the last revision this fragment carries revised property pName, the value of which will be stored in pValue; see notes on PP_Revision::hasProperty(...)

References getLastRevision(), and PP_AttrProp::getProperty().

PP_RevisionType PP_RevisionAttr::getType ( UT_uint32  iId  ) 

returns the type of cumulative revision up to iId represented by this attribute

References getGreatestLesserOrEqualRevision(), PP_Revision::getType(), PP_REVISION_FMT_CHANGE, and s.

PP_RevisionType PP_RevisionAttr::getType ( void   ) 

returns the type of overall cumulative revision represented by this attribute

References getLastRevision(), and PP_Revision::getType().

const gchar * PP_RevisionAttr::getXMLstring (  ) 

void PP_RevisionAttr::forceDirty (  )  [inline]

bool PP_RevisionAttr::isFragmentSuperfluous (  )  const

returns true if the fragment marked by this attribute is superfluous, i.e, it was created in the process of the present revision but the editor has later changed his/her mind and decided it should go away

References UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), m_iSuperfluous, m_vRev, and UT_return_val_if_fail.

bool PP_RevisionAttr::operator== ( const PP_RevisionAttr op2  )  const

void PP_RevisionAttr::_init ( const gchar *  r  )  [private]

void PP_RevisionAttr::_clear (  )  [private]

void PP_RevisionAttr::_refreshString (  )  [private]


Member Data Documentation

Referenced by _refreshString(), and getXMLstring().

bool PP_RevisionAttr::m_bDirty [private]


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

Generated on Sat Aug 30 00:07:10 2008 for AbiWord by  doxygen 1.5.5