LibPkg
Classes | Public Types | Public Member Functions | List of all members
pkg::path_table Class Reference

A class for mapping source paths to destination paths. More...

#include <path_table.h>

Inheritance diagram for pkg::path_table:
pkg::table

Classes

class  commit_error
 An exception class for reporting failure to commit table. More...
 
class  invalid_source_path
 An exception class for reporting invalid source paths. More...
 
class  parse_error
 An exception class for reporting parse errors. More...
 

Public Types

typedef string key_type
 
typedef string mapped_type
 
typedef std::map< key_type,
mapped_type >::const_iterator 
const_iterator
 

Public Member Functions

 path_table ()
 Construct empty path table. More...
 
 path_table (const string &pathname)
 Construct path table from file. More...
 
virtual ~path_table ()
 Destroy path table. More...
 
string operator() (const string &src_pathname, const string &pkgname) const
 Convert source pathname to destination pathname. More...
 
const_iterator begin () const
 Get const iterator for start of table. More...
 
const_iterator end () const
 Get const iterator for end of table. More...
 
const_iterator find (const string &src_pathname)
 Find table entry. More...
 
void alter (const string &src_pathname, const string &dst_pathname)
 Alter table entry. More...
 
void erase (const string &src_pathname)
 Erase table entry. More...
 
void clear ()
 Clear all paths. More...
 
size_t size () const
 Get number of paths in table. More...
 
void commit ()
 Commit changes. More...
 
void rollback ()
 Roll back changes. More...
 
bool ensure_defaults ()
 Ensure that default paths are present in the table. More...
 
- Public Member Functions inherited from pkg::table
 table ()
 Construct table. More...
 
virtual ~table ()
 Destroy table. More...
 

Additional Inherited Members

- Protected Member Functions inherited from pkg::table
void notify ()
 Notify watchers that a change has occurred. More...
 

Detailed Description

A class for mapping source paths to destination paths.

The source path is with respect to the root of the zip file (but using '.' as the path separator, not '/'). The destination path is with respect to the root of the filesystem.

Member Typedef Documentation

typedef string pkg::path_table::key_type

Constructor & Destructor Documentation

pkg::path_table::path_table ( )

Construct empty path table.

pkg::path_table::path_table ( const string &  pathname)

Construct path table from file.

Parameters
pathnamethe pathname of the underlying paths file

References rollback().

pkg::path_table::~path_table ( )
virtual

Destroy path table.

Member Function Documentation

string pkg::path_table::operator() ( const string &  src_pathname,
const string &  pkgname 
) const

Convert source pathname to destination pathname.

Parameters
src_pathnamethe source pathname
pkgnamethe package name
Returns
the destination pathname

References pkg::canonicalise(), and pkg::is_alias().

const_iterator pkg::path_table::begin ( ) const
inline

Get const iterator for start of table.

Returns
the const iterator

References _data.

const_iterator pkg::path_table::end ( ) const
inline

Get const iterator for end of table.

Returns
the const iterator

References _data.

path_table::const_iterator pkg::path_table::find ( const string &  src_pathname)

Find table entry.

Parameters
src_pathnamethe required source pathname
Returns
a matching const iterator, or end() if not found

References pkg::is_alias().

void pkg::path_table::alter ( const string &  src_pathname,
const string &  dst_pathname 
)

Alter table entry.

Parameters
src_pathnamethe required source pathname
dst_pathnamethe required destination pathname

References dst_pathname, pkg::table::notify(), and src_pathname.

Referenced by pkg::commit::poll().

void pkg::path_table::erase ( const string &  src_pathname)

Erase table entry.

Parameters
src_pathnamethe source pathname to be erased

References pkg::table::notify().

void pkg::path_table::clear ( )

Clear all paths.

References pkg::table::notify().

size_t pkg::path_table::size ( ) const
inline

Get number of paths in table.

Returns
the number of paths

References _data.

void pkg::path_table::commit ( )

Commit changes.

Any changes since the last call to commit() or rollback() are committed to disc.

References dst_pathname, pkg::force_delete(), pkg::force_move(), and pkg::object_type().

Referenced by pkg::commit::poll().

void pkg::path_table::rollback ( )

Roll back changes.

Any changes since the last call to commit() or rollback() are discarded.

Referenced by path_table(), and pkg::commit::poll().

bool pkg::path_table::ensure_defaults ( )

Ensure that default paths are present in the table.

Any changes made to the table are not committed by this function.

Returns
true if any paths were added, otherwise false

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

Reference Manual LibPkg Version 0.6.1 (28 Jan 2015)