Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///
- /// Fields relating to pritem and pritemversion tables.
- ///
- struct CPrItemFields
- {
- protected:
- prwstring m_strRegions; // use accessors to access this data.
- public:
- long m_lItemId;
- bool m_bArchiveFlag;
- short m_nVersion;
- bool m_bVersionFlag;
- PR_TIMESTAMP_STRUCT m_tsArchiveDate;
- long m_lCharCount;
- prwstring m_strComments;
- bool m_bContentFlag;
- PR_TIMESTAMP_STRUCT m_tsDeadline;
- bool m_bDeleteFlag;
- long m_lDocId;
- prwstring m_strEdition;
- long m_lElementId;
- prwstring m_strElementName;
- prwstring m_strExtension;
- long m_lFetchedBy;
- PR_TIMESTAMP_STRUCT m_tsFetchedTime;
- prwstring m_strHnJDepth;
- short m_nImageColours;
- prwstring m_strImageDimensions;
- prwstring m_strItemName;
- short m_nItemStatus;
- long m_lItemType;
- prwstring m_strKeywords;
- PR_TIMESTAMP_STRUCT m_tsLastUpdate;
- long m_lLastUpdateBy;
- long m_lLineCount;
- long m_lLockedBy;
- prwstring m_strLockedLocation;
- bool m_bLockedOffline;
- long m_lOriginalAuthor;
- prwstring m_strOriginalName;
- short m_nPageNumber;
- long m_lParentEdition;
- bool m_bPlaced;
- prwstring m_strPub;
- PR_TIMESTAMP_STRUCT m_tsPubDate;
- long m_lPubInfoId;
- long m_lQueueId;
- short m_nScriptFlags;
- prwstring m_strSection;
- long m_lStatusId;
- long m_lStoryId;
- PR_TIMESTAMP_STRUCT m_tsTimeCreated;
- PR_TIMESTAMP_STRUCT m_tsTimeLocked;
- long m_lWordCount;
- prwstring m_strZone;
- // Region list accessors:
- // The most common access to m_strRegions will be to get at the 'dynamic' regions.
- prwstring GetRegions() const
- {
- return GetDynamicRegions();
- }
- prwstring GetRawRegions() const
- {
- return m_strRegions;
- }
- prwstring GetDynamicRegions() const
- {
- prwstring strRegions = GetNonStaticRegions();
- if ( strRegions.empty() )
- strRegions = GetStaticRegions();
- return strRegions;
- }
- prwstring GetNonStaticRegions() const
- {
- VectorWideStrings vRegions;
- stringtok( vRegions, m_strRegions, L"," );
- prwstring strRegions;
- bool bAddComma = false;
- for ( VectorWideStrings::iterator posRegionId = vRegions.begin(); posRegionId != vRegions.end(); ++posRegionId )
- {
- // skip 'subtracted' entries - these are marked by decimal point characters
- if ( posRegionId->rfind( L"." ) == prwstring::npos )
- {
- if ( bAddComma )
- strRegions += L",";
- strRegions += *posRegionId;
- bAddComma = true;
- }
- }
- return strRegions;
- }
- prwstring GetStaticRegions() const
- {
- prwstring strRegions = m_strRegions;
- return replacestring( strRegions, L".", L"" );
- }
- void SetRawRegions( const prwstring& strRegions )
- {
- m_strRegions = strRegions;
- }
- void ClearRegions( void )
- {
- m_strRegions.clear();
- }
- CPrItemFields( long lItemId = PRNULL_NUMBER, long lStoryId = PRNULL_NUMBER )
- {
- Clear();
- m_lItemId = lItemId;
- m_lStoryId = lStoryId;
- }
- bool operator < ( const CPrItemFields& prItem ) const
- {
- if ( m_lStoryId < prItem.m_lStoryId )
- return true;
- if ( m_lStoryId > prItem.m_lStoryId )
- return false;
- if ( m_lItemId < prItem.m_lItemId )
- return true;
- if ( m_lItemId > prItem.m_lItemId )
- return false;
- return ( m_bVersionFlag && prItem.m_bVersionFlag ) ? ( m_nVersion < prItem.m_nVersion ) : ( !m_bVersionFlag && prItem.m_bVersionFlag );
- }
- bool operator == ( const CPrItemFields& prItem ) const
- {
- if ( m_lStoryId != prItem.m_lStoryId )
- return false;
- if ( m_lItemId != prItem.m_lItemId )
- return false;
- return ( m_bVersionFlag && prItem.m_bVersionFlag ) ? ( m_nVersion == prItem.m_nVersion ) : ( m_bVersionFlag == prItem.m_bVersionFlag );
- }
- void Clear()
- {
- m_lItemId = PRNULL_NUMBER;
- m_bArchiveFlag = false;
- m_nVersion = PRNULL_NUMBER;
- m_bVersionFlag = false;
- m_tsArchiveDate.Clear();
- m_lCharCount = PRNULL_NUMBER;
- m_strComments.clear();
- m_bContentFlag = false;
- m_tsDeadline.Clear();
- m_bDeleteFlag = false;
- m_lDocId = PRNULL_NUMBER;
- m_strEdition.clear();
- m_lElementId = PRNULL_NUMBER;
- m_strElementName.clear();
- m_strExtension.clear();
- m_lFetchedBy = PRNULL_NUMBER;
- m_tsFetchedTime.Clear();
- m_strHnJDepth.clear();
- m_nImageColours = PRNULL_NUMBER;
- m_strImageDimensions.clear();
- m_strItemName.clear();
- m_nItemStatus = PRNULL_NUMBER;
- m_lItemType = PRNULL_NUMBER;
- m_strKeywords.clear();
- m_tsLastUpdate.Clear();
- m_lLastUpdateBy = PRNULL_NUMBER;
- m_lLineCount = PRNULL_NUMBER;
- m_lLockedBy = PRNULL_NUMBER;
- m_strLockedLocation.clear();
- m_bLockedOffline = false;
- m_lOriginalAuthor = PRNULL_NUMBER;
- m_strOriginalName.clear();
- m_nPageNumber = PRNULL_NUMBER;
- m_lParentEdition = PRNULL_NUMBER;
- m_bPlaced = false;
- m_strPub.clear();
- m_tsPubDate.Clear();
- m_lPubInfoId = PRNULL_NUMBER;
- m_lQueueId = PRNULL_NUMBER;
- m_strRegions.clear();
- m_nScriptFlags = false;
- m_strSection.clear();
- m_lStatusId = PRNULL_NUMBER;
- m_lStoryId = PRNULL_NUMBER;
- m_tsTimeCreated.Clear();
- m_tsTimeLocked.Clear();
- m_lWordCount = PRNULL_NUMBER;
- m_strZone.clear();
- }
- template < class TStream >
- void Serialise( TStream& prByteStream ) const
- {
- prByteStream << m_lItemId;
- prByteStream << m_bArchiveFlag;
- prByteStream << m_nVersion;
- prByteStream << m_bVersionFlag;
- prByteStream << m_tsArchiveDate;
- prByteStream << m_lCharCount;
- prByteStream << m_strComments;
- prByteStream << m_bContentFlag;
- prByteStream << m_tsDeadline;
- prByteStream << m_bDeleteFlag;
- prByteStream << m_lDocId;
- prByteStream << m_strEdition;
- prByteStream << m_lElementId;
- prByteStream << m_strElementName;
- prByteStream << m_strExtension;
- prByteStream << m_lFetchedBy;
- prByteStream << m_tsFetchedTime;
- prByteStream << m_strHnJDepth;
- prByteStream << m_nImageColours;
- prByteStream << m_strImageDimensions;
- prByteStream << m_strItemName;
- prByteStream << m_nItemStatus;
- prByteStream << m_lItemType;
- prByteStream << m_strKeywords;
- prByteStream << m_tsLastUpdate;
- prByteStream << m_lLastUpdateBy;
- prByteStream << m_lLineCount;
- prByteStream << m_lLockedBy;
- prByteStream << m_strLockedLocation;
- prByteStream << m_bLockedOffline;
- prByteStream << m_lOriginalAuthor;
- prByteStream << m_strOriginalName;
- prByteStream << m_nPageNumber;
- prByteStream << m_lParentEdition;
- prByteStream << m_bPlaced;
- prByteStream << m_strPub;
- prByteStream << m_tsPubDate;
- prByteStream << m_lPubInfoId;
- prByteStream << m_lQueueId;
- prByteStream << m_strRegions;
- prByteStream << m_nScriptFlags;
- prByteStream << m_strSection;
- prByteStream << m_lStatusId;
- prByteStream << m_lStoryId;
- prByteStream << m_tsTimeCreated;
- prByteStream << m_tsTimeLocked;
- prByteStream << m_lWordCount;
- prByteStream << m_strZone;
- }
- template < class TStream >
- void Deserialise( TStream& prByteStream )
- {
- prByteStream >> m_lItemId;
- prByteStream >> m_bArchiveFlag;
- prByteStream >> m_nVersion;
- prByteStream >> m_bVersionFlag;
- prByteStream >> m_tsArchiveDate;
- prByteStream >> m_lCharCount;
- prByteStream >> m_strComments;
- prByteStream >> m_bContentFlag;
- prByteStream >> m_tsDeadline;
- prByteStream >> m_bDeleteFlag;
- prByteStream >> m_lDocId;
- prByteStream >> m_strEdition;
- prByteStream >> m_lElementId;
- prByteStream >> m_strElementName;
- prByteStream >> m_strExtension;
- prByteStream >> m_lFetchedBy;
- prByteStream >> m_tsFetchedTime;
- prByteStream >> m_strHnJDepth;
- prByteStream >> m_nImageColours;
- prByteStream >> m_strImageDimensions;
- prByteStream >> m_strItemName;
- prByteStream >> m_nItemStatus;
- prByteStream >> m_lItemType;
- prByteStream >> m_strKeywords;
- prByteStream >> m_tsLastUpdate;
- prByteStream >> m_lLastUpdateBy;
- prByteStream >> m_lLineCount;
- prByteStream >> m_lLockedBy;
- prByteStream >> m_strLockedLocation;
- prByteStream >> m_bLockedOffline;
- prByteStream >> m_lOriginalAuthor;
- prByteStream >> m_strOriginalName;
- prByteStream >> m_nPageNumber;
- prByteStream >> m_lParentEdition;
- prByteStream >> m_bPlaced;
- prByteStream >> m_strPub;
- prByteStream >> m_tsPubDate;
- prByteStream >> m_lPubInfoId;
- prByteStream >> m_lQueueId;
- prByteStream >> m_strRegions;
- prByteStream >> m_nScriptFlags;
- prByteStream >> m_strSection;
- prByteStream >> m_lStatusId;
- prByteStream >> m_lStoryId;
- prByteStream >> m_tsTimeCreated;
- prByteStream >> m_tsTimeLocked;
- prByteStream >> m_lWordCount;
- prByteStream >> m_strZone;
- }
- };
- ///
- /// STL Collection typedefs
- ///
- typedef std::vector < CPrItemFields, CPrStandardAllocator < CPrItemFields > > VectorItemFields;
- typedef std::set < CPrItemFields, std::less < CPrItemFields >, CPrStandardAllocator < CPrItemFields > > SetItemFields;
- typedef std::deque < CPrItemFields, CPrStandardAllocator < CPrItemFields > > DequeItemFields;
- ///
- /// Used for passing item data details (memory or file based).
- ///
- struct CPrItemDataFields
- {
- long m_lDataId;
- short m_nDataType;
- long m_lDataNo;
- prwstring m_strDataRef;
- CPrBinaryValue m_binItemData;
- prwstring m_strItemPath;
- CPrItemDataFields( short nDataType = PRNULL_NUMBER, long lDataNo = PRNULL_NUMBER )
- {
- Clear();
- m_nDataType = nDataType;
- m_lDataNo = lDataNo;
- }
- void Clear()
- {
- m_lDataId = PRNULL_NUMBER;
- m_nDataType = PRNULL_NUMBER;
- m_lDataNo = PRNULL_NUMBER;
- m_strDataRef.clear();
- m_binItemData.Clear();
- m_strItemPath.clear();
- }
- template < class TStream >
- void Serialise( TStream& prByteStream ) const
- {
- prByteStream << m_lDataId;
- prByteStream << m_nDataType;
- prByteStream << m_lDataNo;
- prByteStream << m_strDataRef;
- prByteStream << m_strItemPath;
- prByteStream << m_binItemData;
- }
- template < class TStream >
- void Deserialise( TStream& prByteStream )
- {
- prByteStream >> m_lDataId;
- prByteStream >> m_nDataType;
- prByteStream >> m_lDataNo;
- prByteStream >> m_strDataRef;
- prByteStream >> m_strItemPath;
- prByteStream >> m_binItemData;
- }
- };
Add Comment
Please, Sign In to add comment