locate_images.h

Go to the documentation of this file.
00001 
00012 #ifndef LOCATE_IMAGES_H
00013 #define LOCATE_IMAGES_H
00014 
00015 #include <string>
00016 #include <map>
00017 #include <vector>
00018 
00019 #include "image_errors.h"
00020 
00029 class extra_images {
00030 public:
00031     extra_images();
00032 
00035     void populate(std::vector<std::string> const & paths,
00036               std::string const & archive_path,
00037               std::string const & root_path);
00038 
00040     struct matcher {
00041         std::string const & value;
00042     public:
00043         explicit matcher(std::string const & v) : value(v) {}
00044         virtual ~matcher() {}
00046         virtual bool operator()(std::string const & str) const {
00047             return str == value;
00048         }
00049     };
00050 
00054     std::vector<std::string> const find(matcher const & match) const;
00055 
00057     std::vector<std::string> const find(std::string const & name) const;
00058 
00069     std::string const find_image_path(std::string const & image_name,
00070                 image_error & error, bool fixup) const;
00071 
00073     std::string get_archive_path() const { return archive_path; }
00074 
00077     std::string strip_path_prefix(std::string const & image) const;
00078 
00080     int get_uid() const { return uid; }
00081 
00082 private:
00083     void populate(std::vector<std::string> const & paths,
00084               std::string const & prefix_path);
00085 
00086     std::string const locate_image(std::string const & image_name,
00087                 image_error & error, bool fixup) const;
00088 
00089     typedef std::multimap<std::string, std::string> images_t;
00090     typedef images_t::value_type value_type;
00091     typedef images_t::const_iterator const_iterator;
00092 
00094     images_t images;
00096     std::string archive_path;
00099     std::string root_path;
00100 
00102     int uid;
00104     static int suid;
00105 };
00106 
00107 #endif /* LOCATE_IMAGES_H */

Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1