]> Dogcows Code - chaz/yoink/blobdiff - src/stlplus/subsystems/library_manager.hpp
testing new non-autotools build system
[chaz/yoink] / src / stlplus / subsystems / library_manager.hpp
diff --git a/src/stlplus/subsystems/library_manager.hpp b/src/stlplus/subsystems/library_manager.hpp
new file mode 100644 (file)
index 0000000..96e1afd
--- /dev/null
@@ -0,0 +1,708 @@
+#ifndef STLPLUS_LIBRARY_MANAGER\r
+#define STLPLUS_LIBRARY_MANAGER\r
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+//   Author:    Andy Rushton\r
+//   Copyright: (c) Southampton University 1999-2004\r
+//              (c) Andy Rushton           2004-2009\r
+//   License:   BSD License, see ../docs/license.html\r
+\r
+//   Generalised library manager.\r
+\r
+//   Manages library units in a set of library directories. A unit is both a file\r
+//   on-disk and a data-structure in memory. To use the library manager, you need\r
+//   to:\r
+\r
+//     - design a type based on lm_unit with serialising functions read/write \r
+//     - decide on a file extension for the type\r
+//     - decide on a description of the type\r
+//     - write a create callback for this type\r
+//     - register the file extension, description and callback with the library manager\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+#include "subsystems_fixes.hpp"\r
+#include "ini_manager.hpp"\r
+#include "smart_ptr.hpp"\r
+#include <iostream>\r
+#include <string>\r
+#include <vector>\r
+#include <list>\r
+#include <map>\r
+#include <time.h>\r
+\r
+namespace stlplus\r
+{\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+  // Internals\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+\r
+  class lm_library;\r
+  class library_manager;\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+  // unit names\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+\r
+  class lm_unit_name\r
+  {\r
+  public:\r
+    lm_unit_name(const std::string& name = std::string(), const std::string& type = std::string());\r
+    ~lm_unit_name(void);\r
+\r
+    const std::string& name(void) const;\r
+    void set_name(const std::string& name);\r
+    void lowercase(void);\r
+\r
+    const std::string& type(void) const;\r
+    void set_type(const std::string& type);\r
+\r
+    bool write(std::ostream& context) const;\r
+    bool read(std::istream& context);\r
+\r
+    std::string to_string(void) const;\r
+    bool print(std::ostream&) const;\r
+\r
+  private:\r
+    std::string m_name;\r
+    std::string m_type;\r
+  };\r
+\r
+  std::ostream& operator << (std::ostream&, const lm_unit_name&);\r
+  bool operator == (const lm_unit_name& l, const lm_unit_name& r);\r
+  bool operator < (const lm_unit_name& l, const lm_unit_name& r);\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+  // dependencies\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+\r
+  // dependencies on external files\r
+\r
+  class lm_file_dependency\r
+  {\r
+  public:\r
+    lm_file_dependency(void);\r
+    lm_file_dependency(const std::string& library_path, const std::string& path, unsigned line = 0, unsigned column = 0);\r
+    ~lm_file_dependency(void);\r
+\r
+    // a path can be retrieved as either a relative path to the library or as a\r
+    // full path by providing the library path as an argument\r
+    const std::string& path(void) const;\r
+    std::string path_full(const std::string& library_path) const;\r
+    void set_path(const std::string& library_path, const std::string& path);\r
+\r
+    unsigned line(void) const;\r
+    void set_line(unsigned line = 0);\r
+\r
+    unsigned column(void) const;\r
+    void set_column(unsigned column = 0);\r
+\r
+    bool write(std::ostream& context) const;\r
+    bool read(std::istream& context);\r
+\r
+    bool print(std::ostream&) const;\r
+\r
+  private:\r
+    std::string m_path; // file dependencies are stored as paths relative to the containing library\r
+    unsigned m_line;    // line - starts at 1, 0 means no line/column information\r
+    unsigned m_column;  // column - starts at 0\r
+  };\r
+\r
+  std::ostream& operator <<(std::ostream&, const lm_file_dependency&);\r
+\r
+  // dependencies on other units\r
+\r
+  class lm_unit_dependency\r
+  {\r
+  public:\r
+    lm_unit_dependency(void);\r
+    lm_unit_dependency(const std::string& library, const lm_unit_name& name);\r
+    ~lm_unit_dependency(void);\r
+\r
+    const std::string& library(void) const;\r
+    void set_library(const std::string& library);\r
+\r
+    const lm_unit_name& unit_name(void) const;\r
+    void set_unit_name(const lm_unit_name& unit_name);\r
+\r
+    const std::string& name(void) const;\r
+    void set_name(const std::string& name);\r
+\r
+    const std::string& type(void) const;\r
+    void set_type(const std::string& type);\r
+\r
+    bool write(std::ostream& context) const;\r
+    bool read(std::istream& context);\r
+\r
+    bool print(std::ostream&) const;\r
+\r
+  private:\r
+    std::string m_library;\r
+    lm_unit_name m_name;\r
+  };\r
+\r
+  std::ostream& operator<<(std::ostream&, const lm_unit_dependency&);\r
+\r
+  // the set of all dependencies\r
+\r
+  class lm_dependencies\r
+  {\r
+  public:\r
+    lm_dependencies(void);\r
+    lm_dependencies(const lm_dependencies&);\r
+    lm_dependencies& operator=(const lm_dependencies&);\r
+    ~lm_dependencies(void);\r
+\r
+    // source file dependency\r
+    void set_source_file(const lm_file_dependency&);\r
+    bool source_file_present(void) const;\r
+    const lm_file_dependency& source_file(void) const;\r
+\r
+    // other file dependencies\r
+    unsigned file_add(const lm_file_dependency& dependency);\r
+    unsigned file_size(void) const;\r
+    const lm_file_dependency& file_dependency(unsigned) const;\r
+    void file_erase(unsigned);\r
+\r
+    // unit dependencies\r
+    unsigned unit_add(const lm_unit_dependency& dependency);\r
+    unsigned unit_size(void) const;\r
+    const lm_unit_dependency& unit_dependency(unsigned) const;\r
+    void unit_erase(unsigned);\r
+\r
+    void clear(void);\r
+    bool empty(void) const;\r
+\r
+    bool write(std::ostream& context) const;\r
+    bool read(std::istream& context);\r
+\r
+    bool print(std::ostream&) const;\r
+\r
+  private:\r
+    lm_file_dependency* m_source;            // source file dependency (optional)\r
+    std::vector<lm_file_dependency> m_files; // other file dependencies\r
+    std::vector<lm_unit_dependency> m_units; // unit dependencies\r
+  };\r
+\r
+  std::ostream& operator << (std::ostream&, const lm_dependencies&);\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+  // library unit superclass\r
+  // user's units must be derivatives of lm_unit and overload all the virtuals\r
+\r
+  class lm_unit\r
+  {\r
+    friend class lm_library;\r
+  public:\r
+    ////////////////////////////////////////\r
+    // constructor/destructor\r
+\r
+    lm_unit(const lm_unit_name& name, lm_library* library);\r
+    virtual ~lm_unit(void);\r
+\r
+    ////////////////////////////////////////\r
+    // Header data\r
+\r
+    // unit name\r
+    const lm_unit_name& unit_name(void) const;\r
+    const std::string& name(void) const;\r
+    const std::string& type(void) const;\r
+\r
+    // dependencies\r
+    // all file dependencies are converted for internal use to a path relative to the library\r
+    // they can be retrieved either in this form or as a full path\r
+\r
+    // source file dependency\r
+    void set_source_file(const lm_file_dependency&);\r
+    bool source_file_present(void) const;\r
+    const lm_file_dependency& source_file(void) const;\r
+\r
+    // other file dependencies\r
+    unsigned file_add(const lm_file_dependency& dependency);\r
+    unsigned file_size(void) const;\r
+    const lm_file_dependency& file_dependency(unsigned) const;\r
+    void file_erase(unsigned);\r
+\r
+    // unit dependencies\r
+    unsigned unit_add(const lm_unit_dependency& dependency);\r
+    unsigned unit_size(void) const;\r
+    const lm_unit_dependency& unit_dependency(unsigned) const;\r
+    void unit_erase(unsigned);\r
+\r
+    const lm_dependencies& dependencies(void) const;\r
+    void set_dependencies(const lm_dependencies&);\r
+    void clear_dependencies(void);\r
+    bool empty_dependencies(void) const;\r
+\r
+    // dependency checking\r
+\r
+    bool out_of_date(void) const;\r
+    bool up_to_date(void) const;\r
+    lm_dependencies out_of_date_reason(void) const;\r
+\r
+    // supplementary data\r
+\r
+    const std::string& supplementary_data(void) const;\r
+    void set_supplementary_data(const std::string& data);\r
+\r
+    ////////////////////////////////////////\r
+    // unit data management\r
+\r
+    bool load(void);\r
+    bool save(void);\r
+    bool loaded(void) const;\r
+    void mark(void);\r
+\r
+    // file modified time - only changes after a save\r
+\r
+    time_t modified(void) const;\r
+\r
+    ////////////////////////////////////////\r
+    // containing library manager details\r
+\r
+    // get the owning library\r
+    const lm_library* library(void) const;\r
+    lm_library* library(void);\r
+\r
+    // owning library name and path\r
+    const std::string& library_name(void) const;\r
+    const std::string& library_path(void) const;\r
+\r
+    ////////////////////////////////////////\r
+    // error handling - these apply to the last read/write operation\r
+\r
+    bool error(void) const;\r
+\r
+    ////////////////////////////////////////\r
+    // functions that customise subclasses of this superclass\r
+    // You MUST provide at least:\r
+    //   - read - either read operation can be overloaded\r
+    //   - write - either write operation can be overloaded\r
+    //   - clone\r
+\r
+    // read(filename) is the one actually called to read your data\r
+    // the default read(filename) simply calls read(istream) to actually read the file\r
+    // the default read(istream) does nothing but fail by returning false so you must overload one or other\r
+\r
+    // you can just overload read(istream) if you want to use IOstream, or you\r
+    // can overload read(filename) to use any I/O system\r
+\r
+    virtual bool read(const std::string& filename, void* type_data);\r
+    virtual bool read(std::istream& file, void* type_data);\r
+\r
+    // as above, but for writing the data type\r
+\r
+    // write(filename) is the one actually called to write your data\r
+    // the default write(filename) simply calls write(ostream) to actually write the file\r
+    // the default write(ostream) does nothing but fail by returning false so you must overload one or other\r
+\r
+    // you can just overload write(ostream) if you want to use IOstream, or you\r
+    // can overload write(filename) to use any I/O system\r
+\r
+    virtual bool write(const std::string& filename, void* type_data);\r
+    virtual bool write(std::ostream& file, void* type_data);\r
+\r
+    // purge clears any memory associated with the unit - makes the unit unloaded\r
+    // the default does nothing\r
+    virtual bool purge(void);\r
+\r
+    // the clone function creates a new-ed copy of the subclass\r
+    virtual lm_unit* clone(void) const;\r
+\r
+    // the default print routines print header-only information\r
+    // you can overload these to provide a debug printout of the data structure\r
+    virtual bool print(std::ostream&) const;\r
+    virtual bool print_long(std::ostream&) const;\r
+\r
+  protected:\r
+    // header file management\r
+    std::string filename(void) const;\r
+    std::string header_filename(void) const;\r
+    bool write_header(void);\r
+    bool read_header(void);\r
+\r
+  private:\r
+    // header fields\r
+    lm_unit_name m_name;            // name\r
+    lm_dependencies m_dependencies; // file and unit dependencies\r
+    std::string m_supplement;       // supplementary data\r
+    bool m_header_modified;         // header modified\r
+\r
+    // internal fields\r
+    bool m_loaded;                  // loaded flag\r
+    bool m_marked;                  // mark - determines whether the unit needs saving\r
+\r
+    // library manager fields\r
+    lm_library* m_library;          // parent library\r
+\r
+    // error handling fields\r
+    bool m_error;                    // error flag if load or save fails - from IOstream\r
+  };\r
+\r
+  // Iostream print calls the short print method\r
+  std::ostream& operator << (std::ostream& str, const lm_unit& u);\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+  // other types used in the library manager\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+\r
+  // user types\r
+\r
+  typedef smart_ptr_nocopy<lm_unit> lm_unit_ptr;\r
+  typedef lm_unit* (*lm_create_callback)(const lm_unit_name& unit_name, lm_library* parent_library, void* type_data);\r
+\r
+  // internal types used in the library manager but made global because they are shared\r
+\r
+  struct lm_callback_entry\r
+  {\r
+    lm_create_callback m_callback;\r
+    std::string m_description;\r
+    void* m_type_data;\r
+\r
+    lm_callback_entry(lm_create_callback callback = 0, const std::string& description = std::string(), void* type_data = 0) :\r
+      m_callback(callback), m_description(description), m_type_data(type_data) {}\r
+  };\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+  // Library\r
+  // Must be contained in a library_manager\r
+  // Manages objects of class lm_unit and its subclasses\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+\r
+  class lm_library\r
+  {\r
+  public:\r
+    friend class library_manager;\r
+    friend class lm_unit;\r
+\r
+    //////////////////////////////////////////////////////////////////////////////\r
+    // constructors/destructor - lm_library should only ever be constructed by library_manager\r
+\r
+    lm_library(library_manager* manager);\r
+    lm_library(const lm_library&);\r
+    lm_library& operator = (const lm_library&);\r
+    ~lm_library(void);\r
+\r
+  public:\r
+\r
+    const library_manager* manager(void) const;\r
+    library_manager* manager(void);\r
+\r
+    //////////////////////////////////////////////////////////////////////////////\r
+    // initialisers\r
+\r
+    bool create(const std::string& name, const std::string& path, bool writable);\r
+    bool open(const std::string& path);\r
+\r
+    //////////////////////////////////////////////////////////////////////////////\r
+    // management of types\r
+\r
+    bool load_type(const std::string& type);\r
+    bool load_types(void);\r
+    bool remove_type(const std::string& type);\r
+\r
+    //////////////////////////////////////////////////////////////////////////////\r
+    // whole library operations\r
+\r
+    bool load(void);\r
+    bool save(void);\r
+    bool purge(void);\r
+    bool close(void);\r
+    bool erase(void);\r
+\r
+    const std::string& name(void) const;\r
+    const std::string& path(void) const;\r
+\r
+    //////////////////////////////////////////////////////////////////////////////\r
+    // managing read/write status\r
+\r
+    bool set_read_write(bool writable);\r
+    bool set_writable(void);\r
+    bool set_read_only(void);\r
+    bool writable(void) const;\r
+    bool read_only(void) const;\r
+    bool os_writable(void) const;\r
+    bool os_read_only(void) const;\r
+    bool lm_writable(void) const;\r
+    bool lm_read_only(void) const;\r
+\r
+    //////////////////////////////////////////////////////////////////////////////\r
+    // unit management\r
+\r
+    bool exists(const lm_unit_name& name) const;\r
+    lm_unit_ptr create(const lm_unit_name&);\r
+    bool loaded(const lm_unit_name& name) const;\r
+    bool load(const lm_unit_name& unit);\r
+    bool purge(const lm_unit_name& unit);\r
+    bool save(const lm_unit_name& unit);\r
+    bool erase(const lm_unit_name& name);\r
+    bool mark(const lm_unit_name& name);\r
+    time_t modified(const lm_unit_name& name) const;\r
+\r
+    bool erase_by_source(const std::string& source_file);\r
+\r
+    const lm_unit_ptr find(const lm_unit_name& name) const;\r
+    lm_unit_ptr find(const lm_unit_name& name);\r
+\r
+    std::vector<lm_unit_name> names(void) const;\r
+    std::vector<std::string> names(const std::string& type) const;\r
+    std::vector<lm_unit_ptr> handles(void) const;\r
+    std::vector<lm_unit_ptr> handles(const std::string& type) const;\r
+\r
+    //////////////////////////////////////////////////////////////////////////////\r
+    // dependency checking\r
+\r
+    bool out_of_date(const lm_unit_name& name) const;\r
+    bool up_to_date(const lm_unit_name& name) const;\r
+    lm_dependencies out_of_date_reason(const lm_unit_name& name) const;\r
+\r
+    std::pair<bool,unsigned> tidy(void);\r
+\r
+    //////////////////////////////////////////////////////////////////////////////\r
+    // do-everything print function\r
+\r
+    bool pretty_print(std::ostream& str,\r
+                      bool print_units = false,                       // print the unit names not just the library names\r
+                      const std::string& type = std::string()) const; // print just this type ("" means all)\r
+\r
+    ////////////////////////////////////////////////////////////////////////////////\r
+    // diagnostic print routines\r
+\r
+    bool print(std::ostream& str) const;\r
+    bool print_long(std::ostream& str) const;\r
+\r
+  private:\r
+\r
+    std::map<lm_unit_name,lm_unit_ptr>::iterator local_find(const lm_unit_name& name);\r
+    std::map<lm_unit_name,lm_unit_ptr>::const_iterator local_find(const lm_unit_name& name) const;\r
+\r
+    std::string m_name;                         // name\r
+    std::string m_path;                         // path\r
+    bool m_writable;                            // writable\r
+    std::map<lm_unit_name,lm_unit_ptr> m_units; // units\r
+    library_manager* m_manager;                 // parent library manager\r
+  };\r
+\r
+  std::ostream& operator << (std::ostream& str, const lm_library& lib);\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+  // Library Manager\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+\r
+  class library_manager\r
+  {\r
+  public:\r
+    friend class lm_library;\r
+    friend class lm_unit;\r
+\r
+    ////////////////////////////////////////////////////////////////////////////////\r
+    // static functions allow you to test whether a directory is a library before opening it\r
+    // you can also find the library's name without opening it\r
+\r
+    static bool is_library(const std::string& path, const std::string& owner);\r
+    static std::string library_name(const std::string& path, const std::string& owner);\r
+\r
+    // non-static forms test for libraries with the same owner as the library manager\r
+\r
+    bool is_library(const std::string& path);\r
+    std::string library_name(const std::string& path);\r
+\r
+    //////////////////////////////////////////////////////////////////////////////\r
+    // tructors\r
+\r
+    explicit library_manager(const std::string& owner, bool library_case = false, bool unit_case = false);\r
+    ~library_manager(void);\r
+\r
+    //////////////////////////////////////////////////////////////////////////////\r
+    // case sensitivity\r
+\r
+    bool library_case(void) const;\r
+    void set_library_case(bool library_case);\r
+\r
+    bool unit_case(void) const;\r
+    void set_unit_case(bool library_case);\r
+\r
+    //////////////////////////////////////////////////////////////////////////////\r
+    // type handling\r
+    // only units of types added in this way will be recognised\r
+\r
+    bool add_type(const std::string& type,\r
+                  const std::string& description,\r
+                  lm_create_callback fn = 0,\r
+                  void* type_data = 0);\r
+    bool remove_type(const std::string& type);\r
+    std::vector<std::string> types(void) const;\r
+\r
+    std::string description(const std::string& type) const;\r
+    lm_create_callback callback(const std::string& type) const;\r
+    void* type_data(const std::string& type) const;\r
+\r
+    //////////////////////////////////////////////////////////////////////////////\r
+    // Library mappings\r
+    // The library manager implements two different styles of library mappings\r
+    //   - mapping file\r
+    //   - ini file\r
+    // mapping file handling uses a simple text file to store the mappings in an internally-defined format\r
+    // ini file handling stores library mappings using the ini_manager component\r
+    // These modes are switched on by simply specifying a mapping file or an ini file to hold the mappings\r
+\r
+    // mapping file methods\r
+\r
+    // set but do not load - use this when you want to create a new mapping file\r
+    void set_mapping_file(const std::string& mapping_file);\r
+    // set and load - use this with an existing mapping file\r
+    bool load_mappings (const std::string& mapping_file);\r
+    // return the mapping file string\r
+    std::string mapping_file();\r
+\r
+    // ini file methods - the ini manager must be pre-loaded with the list of ini files to manage\r
+\r
+    // set and load - this will create the relevant sections in the local ini file if not present already\r
+    bool set_ini_manager(ini_manager* ini_files, const std::string& library_section, const std::string& work_section);\r
+    ini_manager* get_ini_manager(void) const;\r
+\r
+    // save to the library mapping handler, whichever kind it is\r
+    bool save_mappings (void);\r
+\r
+    //////////////////////////////////////////////////////////////////////////////\r
+    // library management\r
+\r
+    // operations on a single library\r
+    // test whether a named library exists\r
+    bool exists(const std::string& name) const;\r
+    // create a new libarry in the specified directory\r
+    lm_library* create(const std::string& name, const std::string& path, bool writable = true);\r
+    // open an existing library\r
+    lm_library* open(const std::string& path);\r
+    // load all units in the library\r
+    bool load(const std::string& name);\r
+    // save all marked units in the library\r
+    bool save(const std::string& name);\r
+    // purge all loaded units in the library\r
+    bool purge(const std::string& name);\r
+    // close the library - remove it from the manager but leave on disk\r
+    bool close(const std::string& name);\r
+    // erase the library - delete the directory and remove the library from the manager\r
+    bool erase(const std::string& name);\r
+\r
+    // operations on all libraries - as above but applied to all the libraries in the manager\r
+    bool load(void);\r
+    bool save(void);\r
+    bool purge(void);\r
+    bool close(void);\r
+    bool erase(void);\r
+\r
+    // get name and path of a library - name can differ in case if the library manager is case-insensitive\r
+    std::string name(const std::string& library) const;\r
+    std::string path(const std::string& library) const;\r
+\r
+    // control and test read/write status\r
+    bool set_writable(const std::string& library);\r
+    bool set_read_only(const std::string& library);\r
+    bool writable(const std::string& library) const;\r
+    bool read_only(const std::string& library) const;\r
+    bool os_writable(const std::string& library) const;\r
+    bool os_read_only(const std::string& library) const;\r
+    bool lm_writable(const std::string& library) const;\r
+    bool lm_read_only(const std::string& library) const;\r
+\r
+    // find a library in the manager - returns null if not found\r
+    lm_library* find(const std::string& name);\r
+    const lm_library* find(const std::string& name) const;\r
+\r
+    // get the set of all library names\r
+    std::vector<std::string> names(void) const;\r
+    // get the set of all libraries\r
+    std::vector<const lm_library*> handles(void) const;\r
+    std::vector<lm_library*> handles(void);\r
+\r
+    //////////////////////////////////////////////////////////////////////////////\r
+    // current library management\r
+\r
+    bool setwork(const std::string& library);\r
+    bool unsetwork(void);\r
+    const lm_library* work(void) const;\r
+    lm_library* work(void);\r
+    std::string work_name(void) const;\r
+\r
+    //////////////////////////////////////////////////////////////////////////////\r
+    // unit management within a library\r
+    // Note: you can also manipulate the library class through a handle returned by find() or handles()\r
+\r
+    bool exists(const std::string& library, const lm_unit_name& name) const;\r
+    lm_unit_ptr create(const std::string& library, const lm_unit_name& name);\r
+    bool loaded(const std::string& library, const lm_unit_name& name) const;\r
+    bool load(const std::string& library, const lm_unit_name& name);\r
+    bool purge(const std::string& library, const lm_unit_name& name);\r
+    bool save(const std::string& library, const lm_unit_name& name);\r
+    bool erase(const std::string& library, const lm_unit_name& name);\r
+    bool mark(const std::string& library, const lm_unit_name& name);\r
+    time_t modified(const std::string& library, const lm_unit_name& name) const;\r
+\r
+    bool erase_by_source(const std::string& source_file);\r
+\r
+    const lm_unit_ptr find(const std::string& library, const lm_unit_name& name) const;\r
+    lm_unit_ptr find(const std::string& library, const lm_unit_name& name);\r
+\r
+    std::vector<lm_unit_name> names(const std::string& library) const;\r
+    std::vector<std::string> names(const std::string& library, const std::string& type) const;\r
+    std::vector<lm_unit_ptr> handles(const std::string& library) const;\r
+    std::vector<lm_unit_ptr> handles(const std::string& library, const std::string& type) const;\r
+\r
+    //////////////////////////////////////////////////////////////////////////////\r
+    // dependency checking\r
+\r
+    bool out_of_date(const std::string& library, const lm_unit_name& name) const;\r
+    bool up_to_date(const std::string& library, const lm_unit_name& name) const;\r
+    lm_dependencies out_of_date_reason(const std::string& library, const lm_unit_name& name) const;\r
+\r
+    // delete out of date units from a library or all libraries\r
+    // return the number of units tidied and a flag to say whether all units were successfully tidied\r
+    std::pair<bool,unsigned> tidy(const std::string& library);\r
+    std::pair<bool,unsigned> tidy(void);\r
+\r
+    //////////////////////////////////////////////////////////////////////////////\r
+    // do-everything print routine!\r
+\r
+    bool pretty_print(std::ostream& str,\r
+                      bool print_units = false,                       // print the unit names not just the library names\r
+                      const std::string& library = std::string(),     // print just the specified library ("" means all)\r
+                      const std::string& type = std::string()) const; // print just this type ("" means all)\r
+\r
+    ////////////////////////////////////////////////////////////////////////////////\r
+    // diagnostic print routines\r
+\r
+    bool print(std::ostream& str) const;\r
+    bool print_long(std::ostream& str) const;\r
+\r
+    //////////////////////////////////////////////////////////////////////////////\r
+    // internals\r
+\r
+  private:\r
+    // NOT a copyable object\r
+    library_manager(const library_manager&);\r
+    library_manager& operator = (const library_manager&);\r
+\r
+  protected:\r
+    std::list<lm_library>::iterator local_find(const std::string& name);\r
+    std::list<lm_library>::const_iterator local_find(const std::string& name) const;\r
+\r
+    std::string m_owner;                               // owner application name\r
+    std::string m_mapping_file;                        // mapping file method of library management\r
+    ini_manager* m_ini_files;                          // ini manager method of library management\r
+    std::string m_ini_section;                         // ini manager method of library management\r
+    std::string m_ini_work;                            // ini manager method of library management\r
+    std::list<lm_library> m_libraries;                 // libraries\r
+    std::string m_work;                                // work library\r
+    std::map<std::string,lm_callback_entry> m_callbacks; // callbacks\r
+    bool m_library_case;                               // case sensitivity for library names\r
+    bool m_unit_case;                                  // case sensitivity for unit names\r
+  };\r
+\r
+  std::ostream& operator << (std::ostream& str, const library_manager& libraries);\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+\r
+} // end namespace stlplus\r
+\r
+#endif\r
This page took 0.038925 seconds and 4 git commands to generate.