Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef PT_VARSET_H
00024 #define PT_VARSET_H
00025
00026 #include "ut_types.h"
00027 #include "ut_growbuf.h"
00028 #include "pt_Types.h"
00029 #include "pp_TableAttrProp.h"
00030
00031 class PD_Document;
00032
00033 class ABI_EXPORT pt_VarSet
00034 {
00035 public:
00036 pt_VarSet();
00037 ~pt_VarSet();
00038
00039 void setPieceTableState(PTState pts);
00040 bool appendBuf(const UT_UCSChar * pBuf, UT_uint32 length, PT_BufIndex * pbi);
00041 bool storeAP(const PP_PropertyVector & vecAttributes, PT_AttrPropIndex * papi);
00042 inline const UT_UCSChar *getPointer(PT_BufIndex bi) const { return (UT_UCSChar *)m_buffer[_varsetFromBufIndex(bi)].getPointer(_subscriptFromBufIndex(bi)); }
00043 inline PT_BufIndex getBufIndex(PT_BufIndex bi, UT_uint32 offset) const
00044 { return _makeBufIndex(_varsetFromBufIndex(bi),
00045 _subscriptFromBufIndex(bi)+offset);
00046 }
00047
00048 bool isContiguous(PT_BufIndex bi, UT_uint32 length, PT_BufIndex bi2) const;
00049 inline const PP_AttrProp *getAP(PT_AttrPropIndex api) const
00050 {
00051 return m_tableAttrProp[_varsetFromAPIndex(api)].getAP(_subscriptFromAPIndex(api));
00052 }
00053 bool mergeAP(PTChangeFmt ptc,PT_AttrPropIndex apiOld,
00054 const PP_PropertyVector & attributes,
00055 const PP_PropertyVector & properties,
00056 PT_AttrPropIndex * papiNew,
00057 PD_Document * pDoc);
00058 bool addIfUniqueAP(PP_AttrProp * pAP, PT_AttrPropIndex * papi);
00059 bool overwriteBuf(UT_UCSChar * pBuf, UT_uint32 length, PT_BufIndex * pbi);
00060
00061 private:
00062 inline UT_uint32 _subscriptFromBufIndex(PT_BufIndex bi) const
00063 {
00064 return (bi & 0x7fffffff);
00065 }
00066 inline UT_uint32 _subscriptFromAPIndex(PT_AttrPropIndex api) const
00067 {
00068 return (api & 0x7fffffff);
00069 }
00070
00071 inline UT_uint32 _varsetFromBufIndex(PT_BufIndex bi) const
00072 {
00073 return (bi >> 31);
00074 }
00075
00076 inline UT_uint32 _varsetFromAPIndex(PT_AttrPropIndex api) const
00077 {
00078 return (api >> 31);
00079 }
00080
00081 inline PT_BufIndex _makeBufIndex(UT_uint32 varset, UT_uint32 subscript) const
00082 {
00083 return ((varset<<31)|subscript);
00084 }
00085
00086 inline PT_AttrPropIndex _makeAPIndex(UT_uint32 varset, UT_uint32 subscript) const
00087 {
00088 return ((varset<<31)|subscript);
00089 }
00090
00091 bool _finishConstruction(void);
00092
00093 bool m_bInitialized;
00094 UT_uint32 m_currentVarSet;
00095
00096 UT_GrowBuf m_buffer[2];
00097 pp_TableAttrProp m_tableAttrProp[2];
00098 };
00099
00100
00101 #endif