LibreOffice Module sot (master) 1
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
StgCache Class Reference

#include <stgcache.hxx>

Inheritance diagram for StgCache:
[legend]
Collaboration diagram for StgCache:
[legend]

Public Member Functions

 StgCache ()
 
 ~StgCache ()
 
void IncRef ()
 
sal_uInt16 DecRef ()
 
void SetPhysPageSize (short)
 
sal_Int32 GetPhysPages () const
 
short GetPhysPageSize () const
 
SvStreamGetStrm ()
 
void SetStrm (SvStream *, bool)
 
void SetStrm (UCBStorageStream *)
 
bool Good () const
 
ErrCode const & GetError () const
 
void MoveError (StorageBase const &)
 
void SetError (ErrCode)
 
void ResetError ()
 
bool Open (const OUString &rName, StreamMode)
 
void Close ()
 
bool Read (sal_Int32 nPage, void *pBuf)
 
bool Write (sal_Int32 nPage, void const *pBuf)
 
void SetToPage (const rtl::Reference< StgPage > &rPage, short nOff, sal_Int32 nVal)
 
void SetDirty (const rtl::Reference< StgPage > &rPage)
 
bool SetSize (sal_Int32 nPages)
 
rtl::Reference< StgPageFind (sal_Int32)
 
rtl::Reference< StgPageGet (sal_Int32, bool)
 
rtl::Reference< StgPageCopy (sal_Int32, sal_Int32=STG_FREE)
 
bool Commit ()
 
void Clear ()
 

Static Public Member Functions

static sal_Int32 GetFromPage (const rtl::Reference< StgPage > &rPage, short nOff)
 

Protected Member Functions

sal_Int32 Page2Pos (sal_Int32) const
 

Protected Attributes

bool m_bFile
 

Private Types

typedef std::unordered_map< sal_Int32, rtl::Reference< StgPage > > IndexToStgPage
 
typedef std::vector< rtl::Reference< StgPage > > LRUList
 

Private Member Functions

void Erase (const rtl::Reference< StgPage > &)
 
rtl::Reference< StgPageCreate (sal_Int32)
 

Private Attributes

ErrCode m_nError
 
sal_Int32 m_nPages
 
sal_uInt16 m_nRef
 
IndexToStgPage maDirtyPages
 
int m_nReplaceIdx
 
LRUList maLRUPages
 
short m_nPageSize
 
UCBStorageStreamm_pStorageStream
 
SvStreamm_pStrm
 
bool m_bMyStream
 

Detailed Description

Definition at line 37 of file stgcache.hxx.

Member Typedef Documentation

◆ IndexToStgPage

typedef std::unordered_map< sal_Int32, rtl::Reference< StgPage > > StgCache::IndexToStgPage
private

Definition at line 42 of file stgcache.hxx.

◆ LRUList

typedef std::vector< rtl::Reference< StgPage > > StgCache::LRUList
private

Definition at line 44 of file stgcache.hxx.

Constructor & Destructor Documentation

◆ StgCache()

StgCache::StgCache ( )

Definition at line 84 of file stgcache.cxx.

References ERRCODE_NONE, m_nPageSize, and m_nRef.

◆ ~StgCache()

StgCache::~StgCache ( )

Definition at line 98 of file stgcache.cxx.

References Clear(), and SetStrm().

Member Function Documentation

◆ Clear()

void StgCache::Clear ( )

Definition at line 139 of file stgcache.cxx.

References maDirtyPages, and maLRUPages.

Referenced by ~StgCache().

◆ Close()

void StgCache::Close ( )

Definition at line 301 of file stgcache.cxx.

References Close(), SvStream::GetError(), m_bFile, m_pStrm, and SetError().

Referenced by Close().

◆ Commit()

bool StgCache::Commit ( )

◆ Copy()

rtl::Reference< StgPage > StgCache::Copy ( sal_Int32  nNew,
sal_Int32  nOld = STG_FREE 
)

◆ Create()

rtl::Reference< StgPage > StgCache::Create ( sal_Int32  nPg)
private

Definition at line 117 of file stgcache.cxx.

References StgPage::Create(), m_nPageSize, m_nReplaceIdx, and maLRUPages.

Referenced by Copy(), and Get().

◆ DecRef()

sal_uInt16 StgCache::DecRef ( )
inline

Definition at line 66 of file stgcache.hxx.

References m_nRef.

Referenced by OLEStorageBase::~OLEStorageBase().

◆ Erase()

void StgCache::Erase ( const rtl::Reference< StgPage > &  xElem)
private

Definition at line 126 of file stgcache.cxx.

References maLRUPages.

Referenced by Get().

◆ Find()

rtl::Reference< StgPage > StgCache::Find ( sal_Int32  nPage)

Definition at line 148 of file stgcache.cxx.

References maDirtyPages, and maLRUPages.

Referenced by Copy(), Get(), StgDataStrm::Read(), and StgDataStrm::Write().

◆ Get()

rtl::Reference< StgPage > StgCache::Get ( sal_Int32  nPage,
bool  bForce 
)

◆ GetError()

ErrCode const & StgCache::GetError ( ) const
inline

Definition at line 74 of file stgcache.hxx.

References m_nError.

Referenced by StgIo::SetupStreams(), and StgDirStrm::StgDirStrm().

◆ GetFromPage()

sal_Int32 StgCache::GetFromPage ( const rtl::Reference< StgPage > &  rPage,
short  nOff 
)
inlinestatic

◆ GetPhysPages()

sal_Int32 StgCache::GetPhysPages ( ) const
inline

Definition at line 68 of file stgcache.hxx.

References m_nPages.

Referenced by StgFATStrm::GetPage(), StgFATStrm::SetSize(), and StgDataStrm::SetSize().

◆ GetPhysPageSize()

short StgCache::GetPhysPageSize ( ) const
inline

Definition at line 69 of file stgcache.hxx.

References m_nPageSize.

Referenced by StgFAT::StgFAT().

◆ GetStrm()

SvStream * StgCache::GetStrm ( )
inline

◆ Good()

bool StgCache::Good ( ) const
inline

Definition at line 73 of file stgcache.hxx.

References ERRCODE_NONE, and m_nError.

Referenced by Commit(), StgIo::Load(), StgHeader::Load(), Open(), Read(), SetSize(), StgHeader::Store(), and Write().

◆ IncRef()

void StgCache::IncRef ( )
inline

Definition at line 65 of file stgcache.hxx.

References m_nRef.

◆ MoveError()

void StgCache::MoveError ( StorageBase const &  r)

◆ Open()

bool StgCache::Open ( const OUString &  rName,
StreamMode  nMode 
)

◆ Page2Pos()

sal_Int32 StgCache::Page2Pos ( sal_Int32  nPage) const
protected

Definition at line 424 of file stgcache.cxx.

References m_nPageSize.

Referenced by Read(), and Write().

◆ Read()

bool StgCache::Read ( sal_Int32  nPage,
void *  pBuf 
)

◆ ResetError()

void StgCache::ResetError ( )

Definition at line 407 of file stgcache.cxx.

References ERRCODE_NONE, m_nError, m_pStrm, and SvStream::ResetError().

Referenced by MoveError(), and StgIo::SetupStreams().

◆ SetDirty()

void StgCache::SetDirty ( const rtl::Reference< StgPage > &  rPage)

Definition at line 266 of file stgcache.cxx.

References SvStream::IsWritable(), m_pStrm, and maDirtyPages.

Referenced by Copy(), StgDataStrm::GetPtr(), SetToPage(), and StgDataStrm::Write().

◆ SetError()

void StgCache::SetError ( ErrCode  n)

◆ SetPhysPageSize()

void StgCache::SetPhysPageSize ( short  n)

Definition at line 104 of file stgcache.cxx.

References lcl_GetPageCount(), m_nPages, m_nPageSize, m_pStrm, n, and SvStream::TellEnd().

Referenced by StgIo::SetupStreams().

◆ SetSize()

bool StgCache::SetSize ( sal_Int32  nPages)

◆ SetStrm() [1/2]

void StgCache::SetStrm ( SvStream p,
bool  bMy 
)

Definition at line 232 of file stgcache.cxx.

References m_bMyStream, m_pStorageStream, m_pStrm, p, and SvRefBase::ReleaseRef().

Referenced by Open(), and ~StgCache().

◆ SetStrm() [2/2]

void StgCache::SetStrm ( UCBStorageStream pStgStream)

◆ SetToPage()

void StgCache::SetToPage ( const rtl::Reference< StgPage > &  rPage,
short  nOff,
sal_Int32  nVal 
)

◆ Write()

bool StgCache::Write ( sal_Int32  nPage,
void const *  pBuf 
)

Member Data Documentation

◆ m_bFile

bool StgCache::m_bFile
protected

Definition at line 60 of file stgcache.hxx.

Referenced by Close(), Open(), and StgIo::ValidateFATs().

◆ m_bMyStream

bool StgCache::m_bMyStream
private

Definition at line 58 of file stgcache.hxx.

Referenced by SetStrm().

◆ m_nError

ErrCode StgCache::m_nError
private

Definition at line 46 of file stgcache.hxx.

Referenced by GetError(), Good(), MoveError(), ResetError(), SetError(), and SetSize().

◆ m_nPages

sal_Int32 StgCache::m_nPages
private

Definition at line 47 of file stgcache.hxx.

Referenced by GetPhysPages(), Open(), Read(), SetPhysPageSize(), and SetSize().

◆ m_nPageSize

short StgCache::m_nPageSize
private

Definition at line 52 of file stgcache.hxx.

Referenced by Create(), GetPhysPageSize(), Open(), Page2Pos(), Read(), SetPhysPageSize(), SetSize(), and Write().

◆ m_nRef

sal_uInt16 StgCache::m_nRef
private

Definition at line 48 of file stgcache.hxx.

Referenced by DecRef(), and IncRef().

◆ m_nReplaceIdx

int StgCache::m_nReplaceIdx
private

Definition at line 50 of file stgcache.hxx.

Referenced by Create().

◆ m_pStorageStream

UCBStorageStream* StgCache::m_pStorageStream
private

Definition at line 53 of file stgcache.hxx.

Referenced by SetStrm().

◆ m_pStrm

SvStream* StgCache::m_pStrm
private

◆ maDirtyPages

IndexToStgPage StgCache::maDirtyPages
private

Definition at line 49 of file stgcache.hxx.

Referenced by Clear(), Commit(), Find(), and SetDirty().

◆ maLRUPages

LRUList StgCache::maLRUPages
private

Definition at line 51 of file stgcache.hxx.

Referenced by Clear(), Create(), Erase(), and Find().


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