LibPkg
|
A class for mapping source paths to destination paths. More...
#include <path_table.h>
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... | |
![]() | |
table () | |
Construct table. More... | |
virtual | ~table () |
Destroy table. More... | |
Additional Inherited Members | |
![]() | |
void | notify () |
Notify watchers that a change has occurred. More... | |
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.
typedef string pkg::path_table::key_type |
typedef string pkg::path_table::mapped_type |
typedef std::map<key_type,mapped_type>::const_iterator pkg::path_table::const_iterator |
pkg::path_table::path_table | ( | ) |
Construct empty path table.
pkg::path_table::path_table | ( | const string & | pathname | ) |
Construct path table from file.
pathname | the pathname of the underlying paths file |
References rollback().
|
virtual |
Destroy path table.
string pkg::path_table::operator() | ( | const string & | src_pathname, |
const string & | pkgname | ||
) | const |
Convert source pathname to destination pathname.
src_pathname | the source pathname |
pkgname | the package name |
References pkg::canonicalise(), and pkg::is_alias().
|
inline |
Get const iterator for start of table.
|
inline |
Get const iterator for end of table.
References alter(), clear(), dst_pathname, erase(), find(), and src_pathname.
path_table::const_iterator pkg::path_table::find | ( | const string & | src_pathname | ) |
Find table entry.
src_pathname | the required source pathname |
References pkg::is_alias().
Referenced by end().
void pkg::path_table::alter | ( | const string & | src_pathname, |
const string & | dst_pathname | ||
) |
Alter table entry.
src_pathname | the required source pathname |
dst_pathname | the required destination pathname |
References dst_pathname, pkg::table::notify(), and src_pathname.
Referenced by end(), and pkg::commit::poll().
void pkg::path_table::erase | ( | const string & | src_pathname | ) |
Erase table entry.
src_pathname | the source pathname to be erased |
References pkg::table::notify().
Referenced by end().
void pkg::path_table::clear | ( | ) |
|
inline |
Get number of paths in table.
References commit(), ensure_defaults(), and rollback().
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(), and size().
void pkg::path_table::rollback | ( | ) |
Roll back changes.
Any changes since the last call to commit() or rollback() are discarded.
Referenced by path_table(), pkg::commit::poll(), and size().
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.
References pkg::table::notify().
Referenced by size().
Reference Manual | LibPkg | Version 0.6.1 (28 Jan 2015) |