Loading...
Searching...
No Matches
libdar::entrepot Class Referenceabstract
API

the Entrepot interface More...

`#include <entrepot.hpp>`

Inherited by libdar::entrepot_libcurl, libdar::entrepot_libssh, and libdar::entrepot_local.

## Public Member Functions

| entrepot ()
| constructor
| entrepot (const entrepot &ref)=default
| copy constructor
| entrepot (entrepot &&ref) noexcept=default
| move constructor
entrepot & | operator= (const entrepot &ref)=default
| assignment operator
entrepot & | operator= (entrepot &&ref) noexcept=default
| move operator
virtual | ~entrepot ()=default
| destructor
bool | operator== (const entrepot &ref) const
| says whether two entrepot objects points to the same location
virtual void | set_location (const path &chemin)
| defines the directory where to proceed to future open() – this is a "chdir" semantics
virtual void | set_root (const path &p_root)
| defines the root to use if set_location is given a relative path
virtual path | get_full_path () const
| returns the full path of location
virtual std::string | get_url () const =0
| full path of current directory + anything necessary to provide URL formated information
void | set_user_ownership (const std::string &x_user)
| set default ownership for files to be created thanks to the open() or create_dir() methods
void | set_group_ownership (const std::string &x_group)
virtual const path & | get_location () const
virtual const path & | get_root () const
| retreives relative to root path the current location points to
const std::string & | get_user_ownership () const
| retrieves the given root location
const std::string & | get_group_ownership () const
fichier_global * | open (const std::shared_ptr< user_interaction > &dialog, const std::string &filename, gf_mode mode, bool force_permission, U_I permission, bool fail_if_exists, bool erase, hash_algo algo, bool provide_a_plain_file=true) const
| defines the way to open a file and return a "class fichier_global" object as last argument upon success
virtual void | change_user_interaction (const std::shared_ptr< user_interaction > &new_dialog)
| change user_interaction if the implementation recorded it (at construction time for example)
virtual std::shared_ptr< user_interaction > | get_current_user_interaction () const
| get the current user_interaction if the implementation reocrded it at construction time (may be nullptr if not)
virtual void | read_dir_reset () const =0
| routines to read existing files in the current directory (see set_location() / set_root() methods)
virtual bool | read_dir_next (std::string &filename) const =0
| read the next filename of the current directory
virtual void | read_dir_reset_dirinfo () const =0
| routines to read existing files with dir information
virtual bool | read_dir_next_dirinfo (std::string &filename, inode_type &tp) const =0
| alternative to the method read_dir_next, should be implemented also
virtual void | create_dir (const std::string &dirname, U_I permission)=0
| create a new directory in the current directory
void | unlink (const std::string &filename) const
| remove the target file from the entrepot
virtual entrepot * | clone () const =0
| done this way for homogeneity with open/inherited_open

## Protected Member Functions

virtual fichier_global * | inherited_open (const std::shared_ptr< user_interaction > &dialog, const std::string &filename, gf_mode mode, bool force_permission, U_I permission, bool fail_if_exists, bool erase) const =0
virtual void | inherited_unlink (const std::string &filename) const =0
virtual void | read_dir_flush () const =0
| ends the read_dir_next, (no more entry available)

## Private Attributes

path | where
path | root
std::string | user
std::string | group

## Detailed Description

the Entrepot interface

Definition at line 56 of file entrepot.hpp.

## Member Function Documentation

## change_user_interaction()

virtual void libdar::entrepot::change_user_interaction | ( | const std::shared_ptr< user_interaction > & | new_dialog | ) |

inlinevirtual

change user_interaction if the implementation recorded it (at construction time for example)

Note
  method open() just above uses the specified user_interaction provided as its first argument

Reimplemented in libdar::entrepot_libcurl.

Definition at line 132 of file entrepot.hpp.

## clone()

virtual entrepot * libdar::entrepot::clone | ( |  | ) | const

pure virtual

done this way for homogeneity with open/inherited_open

generate a clone of "this"

Deprecated
  this method will disapear in the future it is only kept there to allow the APIv5 adaptation layer to work over APIv6

Implemented in libdar::entrepot_libcurl, libdar::entrepot_libssh, and libdar::entrepot_local.

References entrepot().

## create_dir()

virtual void libdar::entrepot::create_dir | ( | const std::string & | dirname,
|  | U_I | permission )

pure virtual

create a new directory in the current directory

Parameters

  [in] | dirname | is the name of the subdirectory to create (not its path!) It is created in as sub-directory of the directory given to set_location()
  [in] | permission | is the usual POSIX user/group/other permission bits to set to the directory to create

Note
  the operation fails if an entry of that name already exists
  the implementation should set the user and group ownership according to the argument provided to set_user_ownership() and set_group_ownership(), if this feature is supported in the underlying implementation

Implemented in libdar::entrepot_libcurl, libdar::entrepot_libssh, and libdar::entrepot_local.

## get_current_user_interaction()

virtual std::shared_ptr< user_interaction > libdar::entrepot::get_current_user_interaction | ( |  | ) | const

inlinevirtual

get the current user_interaction if the implementation reocrded it at construction time (may be nullptr if not)

Reimplemented in libdar::entrepot_libcurl.

Definition at line 135 of file entrepot.hpp.

## get_full_path()

virtual path libdar::entrepot::get_full_path | ( |  | ) | const

virtual

returns the full path of location

Note
  this is equivalent to get_root()/get_location() if get_location() is relative path else get_location()

Reimplemented in libdar::entrepot_libcurl.

Referenced by libdar::entrepot_local::get_url().

## get_group_ownership()

const std::string & libdar::entrepot::get_group_ownership | ( |  | ) | const

inline

Definition at line 104 of file entrepot.hpp.

## get_location()

virtual const path & libdar::entrepot::get_location | ( |  | ) | const

inlinevirtual

Definition at line 100 of file entrepot.hpp.

## get_root()

virtual const path & libdar::entrepot::get_root | ( |  | ) | const

inlinevirtual

retreives relative to root path the current location points to

Reimplemented in libdar::entrepot_libcurl.

Definition at line 101 of file entrepot.hpp.

## get_url()

virtual std::string libdar::entrepot::get_url | ( |  | ) | const

pure virtual

full path of current directory + anything necessary to provide URL formated information

Implemented in libdar::entrepot_libcurl, libdar::entrepot_libssh, and libdar::entrepot_local.

Referenced by operator==().

## get_user_ownership()

const std::string & libdar::entrepot::get_user_ownership | ( |  | ) | const

inline

retrieves the given root location

Definition at line 103 of file entrepot.hpp.

## inherited_open()

virtual fichier_global * libdar::entrepot::inherited_open | ( | const std::shared_ptr< user_interaction > & | dialog,
|  | const std::string & | filename,
|  | gf_mode | mode,
|  | bool | force_permission,
|  | U_I | permission,
|  | bool | fail_if_exists,
|  | bool | erase ) const

protectedpure virtual

Parameters

  dialog | for user interaction
  filename | filename to open
  mode | mode to use
  force_permission | set the permission of the file to open
  permission | value of the permission to assign when force_permission is true
  fail_if_exists | whether to fail if file exists (write mode)
  erase | whether to erase file if file already exists (write mode)

## open()

fichier_global * libdar::entrepot::open | ( | const std::shared_ptr< user_interaction > & | dialog,
|  | const std::string & | filename,
|  | gf_mode | mode,
|  | bool | force_permission,
|  | U_I | permission,
|  | bool | fail_if_exists,
|  | bool | erase,
|  | hash_algo | algo,
|  | bool | provide_a_plain_file = true ) const

defines the way to open a file and return a "class fichier_global" object as last argument upon success

Parameters

  [in] | dialog | for user interaction
  [in] | filename | is the full path+name of the file to open (read/create/write to)
  [in] | mode | defines which way to open the file (read-only, read-write or write-only)
  [in] | force_permission | whether to set the file permission to the value given in the permission argument
  [in] | permission | if force_permission is set, change the file permission to that value
  [in] | fail_if_exists | tells whether the underlying implementation have to fail throwing Erange("exists") if the file already exist when write access is required
  [in] | erase | tells whether the underlying implementation will empty an existing file before writing to it
  [in] | algo | defines the hash file to create, other value than hash_none are accepted only in writeonly mode with erase or fail_if_exist set
  [in] | provide_a_plain_file | if true a plainly seekable object is returned which mimics the available features of a plain file, else a pipe-like object which has limited seek features but which can still record the offset position is returned and is suitable to be used on real named/anonymous pipes (if the provided filename is expected to be of such type for example)

Returns
  upon success returns an object from a class inherited from fichier_global that the caller has the duty to delete, else an exception is thrown (most of the time it should be a Esystem object) by the called inherited class

## operator==()

bool libdar::entrepot::operator== | ( | const entrepot & | ref | ) | const

inline

says whether two entrepot objects points to the same location

Definition at line 79 of file entrepot.hpp.

References entrepot(), and get_url().

## read_dir_flush()

virtual void libdar::entrepot::read_dir_flush | ( |  | ) | const

protectedpure virtual

ends the read_dir_next, (no more entry available)

Implemented in libdar::entrepot_libcurl, libdar::entrepot_libssh, and libdar::entrepot_local.

## read_dir_next()

virtual bool libdar::entrepot::read_dir_next | ( | std::string & | filename | ) | const

pure virtual

read the next filename of the current directory

Parameters

  [out] | filename | name of the next entry in the directory, (valid only if this method returned true)

Returns
  false if no more filename could be fould

Note
  either use read_dir_reset() followed by read_dir_next() calls, or call read_dir_reset_dirinfo() followed by read_dir_next_dirinfo() calls

Implemented in libdar::entrepot_libcurl, libdar::entrepot_libssh, and libdar::entrepot_local.

## read_dir_next_dirinfo()

virtual bool libdar::entrepot::read_dir_next_dirinfo | ( | std::string & | filename,
|  | inode_type & | tp ) const

pure virtual

alternative to the method read_dir_next, should be implemented also

Parameters

  [out] | filename | name of the next entry in the directory, (valid only if this method returned true)
  [out] | tp | gives the nature of the entry

Note
  a call to read_dir_reset_dirinfo() should be done before the first call to this method
  either use read_dir_reset() followed by read_dir_next() calls, or call read_dir_reset_dirinfo() followed by read_dir_next_dirinfo() calls

Implemented in libdar::entrepot_libcurl, libdar::entrepot_libssh, and libdar::entrepot_local.

## read_dir_reset()

virtual void libdar::entrepot::read_dir_reset | ( |  | ) | const

pure virtual

routines to read existing files in the current directory (see set_location() / set_root() methods)

Parameters

  [in] | dir_details,if | set to true, use read_dir_next() with the isdir argument, else use the read_dir_next() with a single argument. By default and for backward compatibility dir_details is set to false.

Implemented in libdar::entrepot_libcurl, libdar::entrepot_libssh, and libdar::entrepot_local.

## read_dir_reset_dirinfo()

virtual void libdar::entrepot::read_dir_reset_dirinfo | ( |  | ) | const

pure virtual

routines to read existing files with dir information

to be used before calling read_dir_next_dirinfo().

Note
  after calling read_dir_reset_dirinfo() calling read_dir_next() gives undefined result, you first need to call read_dir_reset() or continue using read_dir_next_dirinfo()

Implemented in libdar::entrepot_libcurl, libdar::entrepot_libssh, and libdar::entrepot_local.

## set_group_ownership()

void libdar::entrepot::set_group_ownership | ( | const std::string & | x_group | ) |

inline

Definition at line 98 of file entrepot.hpp.

## set_location()

virtual void libdar::entrepot::set_location | ( | const path & | chemin | ) |

virtual

defines the directory where to proceed to future open() – this is a "chdir" semantics

Reimplemented in libdar::entrepot_libcurl.

## set_root()

virtual void libdar::entrepot::set_root | ( | const path & | p_root | ) |

virtual

defines the root to use if set_location is given a relative path

Reimplemented in libdar::entrepot_libcurl.

## set_user_ownership()

void libdar::entrepot::set_user_ownership | ( | const std::string & | x_user | ) |

inline

set default ownership for files to be created thanks to the open() or create_dir() methods

Definition at line 97 of file entrepot.hpp.

## unlink()

void libdar::entrepot::unlink | ( | const std::string & | filename | ) | const

inline

remove the target file from the entrepot

Definition at line 181 of file entrepot.hpp.

## Member Data Documentation

## group

std::string libdar::entrepot::group

private

Definition at line 207 of file entrepot.hpp.

## root

path libdar::entrepot::root

private

Definition at line 205 of file entrepot.hpp.

## user

std::string libdar::entrepot::user

private

Definition at line 206 of file entrepot.hpp.

## where

path libdar::entrepot::where

private

Definition at line 204 of file entrepot.hpp.

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

- entrepot.hpp