Public Member Functions | Private Member Functions | Private Attributes

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 PP_PropertyVector &attrs, const PP_PropertyVector &props)
 ~PP_RevisionAttr ()
void setRevision (const gchar *r)
void setRevision (std::string &r)
void addRevision (UT_uint32 iId, PP_RevisionType eType, const PP_PropertyVector &pAttrs, const PP_PropertyVector &pProps)
void addRevision (UT_uint32 iId, PP_RevisionType eType)
 Logically Performs addRevision( iId, eType, 0, 0 ).
void addRevision (const PP_Revision *r)
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
const PP_RevisiongetLowestGreaterOrEqualRevision (UT_uint32 id) const
const PP_RevisiongetLastRevision () const
const PP_RevisiongetRevisionWithId (UT_uint32 iId, UT_uint32 &iMinId) const
UT_uint32 getHighestId () const
UT_uint32 getRevisionsCount () const
bool empty () const
const PP_RevisiongetNthRevision (UT_uint32 n) const
void pruneForCumulativeResult (PD_Document *pDoc)
bool isVisible (UT_uint32 id) const
bool hasProperty (UT_uint32 iId, const gchar *pName, const gchar *&pValue) const
bool hasProperty (const gchar *pName, const gchar *&pValue) const
PP_RevisionType getType (UT_uint32 iId) const
PP_RevisionType getType () const
UT_uint32 getHighestRevisionNumberWithAttribute (const gchar *pName) const
const gchar * getXMLstring () const
std::string getXMLstringUpTo (UT_uint32 iId) const
void forceDirty ()
bool isFragmentSuperfluous () const
bool operator== (const PP_RevisionAttr &op2) const
void mergeAll (const PP_RevisionAttr &ra)
void mergeAttr (UT_uint32 iId, PP_RevisionType t, const gchar *pzName, const gchar *pzValue)
void mergeAttrIfNotAlreadyThere (UT_uint32 iId, PP_RevisionType t, const gchar *pzName, const gchar *pzValue)
 Do not replace the attribute/value if it exists in the given revision already.
const PP_RevisiongetLowestDeletionRevision () const

Private Member Functions

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

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 PP_PropertyVector attrs,
const PP_PropertyVector props 
)

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::_clear (  )  [private]
void PP_RevisionAttr::_init ( const gchar *  r  )  [private]

parse given XML attribute string and fill the instance with the data

References UT_GenericVector< T >::addItem(), FREEP, gchar, m_bDirty, m_iSuperfluous, m_pLastRevision, m_vRev, PP_REVISION_ADDITION, PP_REVISION_DELETION, PP_REVISION_FMT_CHANGE, s, and UT_DEBUGMSG.

Referenced by PP_RevisionAttr(), and setRevision().

void PP_RevisionAttr::_refreshString (  )  const [private]
void PP_RevisionAttr::addRevision ( UT_uint32  iId,
PP_RevisionType  eType,
const PP_PropertyVector pAttrs,
const PP_PropertyVector pProps 
)
void PP_RevisionAttr::addRevision ( UT_uint32  iId,
PP_RevisionType  eType 
)

Logically Performs addRevision( iId, eType, 0, 0 ).

This method is mainly useful for loading an ODT+GCT file where you want to add and delete revisions but don't actually care about the attrs/props for that action.

References addRevision().

void PP_RevisionAttr::addRevision ( const PP_Revision r  ) 
bool PP_RevisionAttr::changeRevisionId ( UT_uint32  iOldId,
UT_uint32  iNewId 
)
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::empty (  )  const [inline]
void PP_RevisionAttr::forceDirty (  )  [inline]
const PP_Revision * PP_RevisionAttr::getGreatestLesserOrEqualRevision ( UT_uint32  id,
const PP_Revision **  ppR 
) const
UT_uint32 PP_RevisionAttr::getHighestId (  )  const
UT_uint32 PP_RevisionAttr::getHighestRevisionNumberWithAttribute ( const gchar *  pName  )  const
const PP_Revision * PP_RevisionAttr::getLastRevision (  )  const
const PP_Revision * PP_RevisionAttr::getLowestDeletionRevision (  )  const
const PP_Revision * PP_RevisionAttr::getLowestGreaterOrEqualRevision ( UT_uint32  id  )  const
const PP_Revision* PP_RevisionAttr::getNthRevision ( UT_uint32  n  )  const [inline]
UT_uint32 PP_RevisionAttr::getRevisionsCount (  )  const [inline]
const PP_Revision * PP_RevisionAttr::getRevisionWithId ( UT_uint32  iId,
UT_uint32 minId 
) const

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(), and m_vRev.

Referenced by pt_PieceTable::_fixHdrFtrReferences().

PP_RevisionType PP_RevisionAttr::getType ( UT_uint32  iId  )  const

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

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

PP_RevisionType PP_RevisionAttr::getType ( void   )  const

returns the type of overall cumulative revision represented by this attribute

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

const gchar * PP_RevisionAttr::getXMLstring (  )  const
std::string PP_RevisionAttr::getXMLstringUpTo ( UT_uint32  iId  )  const
bool PP_RevisionAttr::hasProperty ( UT_uint32  iId,
const gchar *  pName,
const gchar *&  pValue 
) const

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 
) const

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().

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::isVisible ( UT_uint32  id  )  const

please note that the following are convenience functions; if you need to make repeated enqueries, it is better to call getGreatestLesserOrEqualRevision() or getLastRevision() and query 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.

void PP_RevisionAttr::mergeAll ( const PP_RevisionAttr ra  ) 
void PP_RevisionAttr::mergeAttr ( UT_uint32  iId,
PP_RevisionType  t,
const gchar *  pzName,
const gchar *  pzValue 
)

References addRevision(), and mergeAll().

Referenced by mergeAttrIfNotAlreadyThere().

void PP_RevisionAttr::mergeAttrIfNotAlreadyThere ( UT_uint32  iId,
PP_RevisionType  t,
const gchar *  pzName,
const gchar *  pzValue 
)
bool PP_RevisionAttr::operator== ( const PP_RevisionAttr op2  )  const
void PP_RevisionAttr::pruneForCumulativeResult ( PD_Document pDoc  ) 
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(), and getXMLstringUpTo().

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::removeRevision ( const PP_Revision pRev  ) 
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::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::setRevision ( std::string &  r  ) 

References setRevision().

void PP_RevisionAttr::setRevision ( const gchar *  r  ) 

initialize instance with XML attribute string

References _clear(), and _init().

Referenced by pt_PieceTable::_translateRevisionAttribute(), addRevision(), getXMLstringUpTo(), mergeAll(), and setRevision().


Member Data Documentation

bool PP_RevisionAttr::m_bDirty [mutable, private]
const PP_Revision* PP_RevisionAttr::m_pLastRevision [mutable, private]

Referenced by _refreshString(), and getXMLstring().


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