library_entry::impl
class
The library_entry::impl
class provides the interface that library
implementations must implement to parse individual library entries. Each
library_entry
and library::const_iterator
holds onto one of
these.
This must be overriden to perform a deep copy of the library. Almost always this should be implemented as follows:
virtual library_entry::impl* mylib::entry_type::clone() const { return new mylib::entry_type(*this); }
The function should be overriden to read the next entry from the library and return true unless the end of the library has been reached. The source of the data should be held within the
library_base
implementation, and not this class. For example, if the library implementation reads from a file via anifstream
, thelibrary_base
class should contain theifstream
and this class should access it via lb:virtual bool mylib::entry_type::readentry( library_base& lb ) { ifstream& ifs = dynamic_cast< mylib& >( lb ).ifs; std::getline( ifs, this->entry ); }None of
library_entry
's other functions should ever access the parentlibrary_base
class.This function gets called whenever a
library::const_iterator
is constructed or incremented.
These should be overriden to return the name of the current entry. The
name
function should return a name which is unique within the library (this may require the class name(s) and/or stage name be included); thebase_name
function should return the name without either the class or stage name.These functions may be implemented to simply return a name that was parsed by
readentry
; alternatively it might be implemented to parse some internal representation of the entry (such as a string containing the whole entry). It must not attempt to access the parentlibrary_base
which may no longer exist. Thereadentry
function will always have been called before this function gets called.