Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cManifestDir Class Reference

#include <cManifestDir.h>

Public Types

enum  MANTAG_TYPE { MANTAG_QTY }
 

Public Member Functions

 cManifestDir (cStringF sDirFullPath)
 
 cManifestDir (const cManifestRoot &root)
 
virtual ~cManifestDir ()
 
const FILECHAR_t * get_Name () const
 
cStringF get_DirPath () const noexcept
 
cManifestElemData & ref_ElemData ()
 
CRC32_t get_ManCRC32 () const
 
bool HasChild (const cManifestDir &rManChild) const
 
HRESULT ReadManifestFile (cStringF sFullManifestPath)
 Load the manifest file for this directory. More...
 
HRESULT ReadManifestFile (const cManifestRoot &root, const FILECHAR_t *pszManifestName=nullptr)
 
HRESULT ReadSearchForTitle (const cManifestRoot &root, cStringF &sPathRet, const FILECHAR_t *pszTitle, int iDescendLevels)
 
HRESULT WriteManifestSection (cStreamOutput &file)
 
HRESULT WriteManifestFile (const cManifestRoot &root)
 
HRESULT BuildManifest (cManifestBuilder &root, FILEATTR_MASK_t dwAttributes=FILEATTR_Directory)
 
cStringF makeFilePath (const FILECHAR_t *pszFileName) const
 
ITERATE_t addManifestElem (cManifestElem *pData)
 
bool rebuildManifestData ()
 

Public Attributes

cArraySortName< cManifestElem > m_aElems
 Name sorted list. More...
 

Static Public Attributes

static const IniChar_t * k_ManTags [MANTAG_QTY+1]
 
static const IniChar_t * k_pszSectionName = "Package"
 "Package" More...
 

Protected Member Functions

HRESULT BuildManifestElem (cManifestBuilder &root, const cManifestDir *pManifestOld, cFileFindEntry &FileEntry)
 
HRESULT BuildManifestMerge (cManifestBuilder &root, const cManifestDir *pManifestOld, FILEATTR_MASK_t dwAttributes)
 

Protected Attributes

const cStringF m_sDirPath
 Full (local) Dir path. Does NOT include the wild card. Not relative to cManifestRoot. More...
 
cManifestElemData m_ManData
 represents all files in this directory. More...
 

Detailed Description

A list of files and sub-directories in a particular file system directory. Typical use = match the files in a directory to its manifest then do something. sDirPath = full path inside cManifestRoot;

Member Enumeration Documentation

◆ MANTAG_TYPE

Enumerator
MANTAG_QTY 

Constructor & Destructor Documentation

◆ cManifestDir() [1/2]

GrayLib::cManifestDir::cManifestDir ( cStringF  sDirFullPath)

◆ cManifestDir() [2/2]

GrayLib::cManifestDir::cManifestDir ( const cManifestRoot &  root)

◆ ~cManifestDir()

GrayLib::cManifestDir::~cManifestDir ( )
virtual

Member Function Documentation

◆ addManifestElem()

ITERATE_t GrayLib::cManifestDir::addManifestElem ( cManifestElem *  pData)

Add the file and compute totals.

Note
Sorting by name prevents duplicates.

◆ BuildManifest()

HRESULT GrayLib::cManifestDir::BuildManifest ( cManifestBuilder &  root,
FILEATTR_MASK_t  dwAttributes = FILEATTR_Directory 
)

Read and update/Build Manifest for this directory if the manifest does not match. dwAttributes = FILEATTR_Directory + others

Returns
S_FALSE = not changed. Old manifest was accurate. S_OK = changes.

◆ BuildManifestElem()

HRESULT GrayLib::cManifestDir::BuildManifestElem ( cManifestBuilder &  root,
const cManifestDir *  pManifestOld,
cFileFindEntry &  FileEntry 
)
protected

Add a single element to the manifest. merge with old manifest element if possible.

  • pManifestOld = can be nullptr
    Returns
    S_OK = changed. S_FALSE = no change.

◆ BuildManifestMerge()

HRESULT GrayLib::cManifestDir::BuildManifestMerge ( cManifestBuilder &  root,
const cManifestDir *  pManifestOld,
FILEATTR_MASK_t  dwAttributes 
)
protected

pManifestOld = there is a previous Manifest file i can try to merge in. (get CRC's faster this way) dwAttributes = FILEATTR_Directory + others

Returns
S_OK = real dir has changes over pManifestOld. write new file. S_FALSE = no changes over pManifestOld
Note
FILEATTR_Ghost = local elements can be 'ghosted'. i.e. listd in the manifest even tho they don't exist locally. this is used for Admin only type content that can be included inline. (don't have to create a separate directory for it)

◆ get_DirPath()

cStringF GrayLib::cManifestDir::get_DirPath ( ) const
inlinenoexcept

◆ get_ManCRC32()

CRC32_t GrayLib::cManifestDir::get_ManCRC32 ( ) const
inline

< CRC for all files here.

◆ get_Name()

const FILECHAR_t* GrayLib::cManifestDir::get_Name ( ) const
inline

◆ HasChild()

bool GrayLib::cManifestDir::HasChild ( const cManifestDir &  rManChild) const

Does it have this child and is it a real match ?

◆ makeFilePath()

cStringF GrayLib::cManifestDir::makeFilePath ( const FILECHAR_t *  pszFileName) const
inline

Make full path.

◆ ReadManifestFile() [1/2]

HRESULT GrayLib::cManifestDir::ReadManifestFile ( const cManifestRoot &  root,
const FILECHAR_t *  pszManifestName = nullptr 
)

Read the manifest file for a directory.

◆ ReadManifestFile() [2/2]

HRESULT GrayLib::cManifestDir::ReadManifestFile ( cStringF  sFullManifestPath)

Load the manifest file for this directory.

Read the manifest file for a directory.

◆ ReadSearchForTitle()

HRESULT GrayLib::cManifestDir::ReadSearchForTitle ( const cManifestRoot &  root,
cStringF &  sPathRet,
const FILECHAR_t *  pszTitle,
int  iDescendLevels 
)

We are looking for a file (without ext) in the manifest and below. pszTitle = Name + EXT

Returns
S_OK = found it.

◆ rebuildManifestData()

bool GrayLib::cManifestDir::rebuildManifestData ( )

rebuild the manifest m_ManData from its elements.

Note
does not validate the manifest against the file system.
Returns
true = changed.

◆ ref_ElemData()

cManifestElemData& GrayLib::cManifestDir::ref_ElemData ( )
inline

◆ WriteManifestFile()

HRESULT GrayLib::cManifestDir::WriteManifestFile ( const cManifestRoot &  root)

Write the manifest file.

Note
If a client decides to try to read the manifest just as we are updating it. That would be bad !

◆ WriteManifestSection()

HRESULT GrayLib::cManifestDir::WriteManifestSection ( cStreamOutput &  file)

Write the file section contents.

Member Data Documentation

◆ k_ManTags

const IniChar_t * GrayLib::cManifestDir::k_ManTags
static
Initial value:
=
{
#define cManifestDirProp(a,b,c)
nullptr
}

◆ k_pszSectionName

const LOGCHAR_t * GrayLib::cManifestDir::k_pszSectionName = "Package"
static

"Package"

◆ m_aElems

cArraySortName<cManifestElem> GrayLib::cManifestDir::m_aElems

Name sorted list.

◆ m_ManData

cManifestElemData GrayLib::cManifestDir::m_ManData
protected

represents all files in this directory.

◆ m_sDirPath

const cStringF GrayLib::cManifestDir::m_sDirPath
protected

Full (local) Dir path. Does NOT include the wild card. Not relative to cManifestRoot.


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