NCBI C++ ToolKit
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
CFileManifest Class Reference

Search Toolkit Book for CFileManifest

#include <util/file_manifest.hpp>

Public Member Functions

 CFileManifest (const string &manifest_path)
 
 CFileManifest (const CArgValue &manifest_path)
 Convenience constructor, to read a manifest from a command line argument's value. More...
 
void Validate () const
 Check the manifest for consistency and open all the referenced files. More...
 
string GetPath () const
 throws CManifestException More...
 
vector< stringGetAllFilePaths () const
 Returns all the file paths referenced by the manifest. More...
 
string GetSingleFilePath () const
 Returns the first file path in the manifest. More...
 
void WriteManyFilePaths (const vector< string > &file_paths)
 Write a list of files to a manifest. Will overwrite any previous data. More...
 

Protected Member Functions

void x_Init ()
 

Private Attributes

string m_ManifestPath
 

Detailed Description

Definition at line 49 of file file_manifest.hpp.

Constructor & Destructor Documentation

◆ CFileManifest() [1/2]

CFileManifest::CFileManifest ( const string manifest_path)

Definition at line 47 of file file_manifest.cpp.

References x_Init().

◆ CFileManifest() [2/2]

CFileManifest::CFileManifest ( const CArgValue manifest_path)

Convenience constructor, to read a manifest from a command line argument's value.

This avoids the user having to choose amongst AsString(), which is correct, and AsInputFile(), which isn't supported (as there is no constructor taking a stream as input).

Definition at line 53 of file file_manifest.cpp.

References x_Init().

Member Function Documentation

◆ GetAllFilePaths()

vector< string > CFileManifest::GetAllFilePaths ( ) const

Returns all the file paths referenced by the manifest.

Definition at line 104 of file file_manifest.cpp.

References CDirEntry::CreateAbsolutePath(), m_ManifestPath, NCBI_THROW, and CDirEntry::NormalizePath().

Referenced by CInputStreamSource::InitManifest(), and CAsnSubCacheCreateApplication::Run().

◆ GetPath()

string CFileManifest::GetPath ( void  ) const
inline

throws CManifestException

Returns the manifest file path, not the files referenced in the manifest.

Definition at line 69 of file file_manifest.hpp.

References m_ManifestPath.

◆ GetSingleFilePath()

string CFileManifest::GetSingleFilePath ( ) const

Returns the first file path in the manifest.

Throws if there are more than one file.

Definition at line 127 of file file_manifest.cpp.

References m_ManifestPath, and NCBI_THROW.

◆ Validate()

void CFileManifest::Validate ( void  ) const

Check the manifest for consistency and open all the referenced files.

WARNING: This method throws an exception on failure! Be prepared to catch it! Success is indicated by a return without an exception.

Definition at line 66 of file file_manifest.cpp.

References file, CDirEntry::IsFile(), m_ManifestPath, and NCBI_THROW.

◆ WriteManyFilePaths()

void CFileManifest::WriteManyFilePaths ( const vector< string > &  file_paths)

Write a list of files to a manifest. Will overwrite any previous data.

Definition at line 153 of file file_manifest.cpp.

References copy(), m_ManifestPath, and NCBI_THROW.

◆ x_Init()

void CFileManifest::x_Init ( void  )
protected

Definition at line 59 of file file_manifest.cpp.

References m_ManifestPath, and NCBI_THROW.

Referenced by CFileManifest().

Member Data Documentation

◆ m_ManifestPath

string CFileManifest::m_ManifestPath
private

The documentation for this class was generated from the following files:
Modified on Wed Apr 17 13:09:52 2024 by modify_doxy.py rev. 669887