artifact.hpp

Go to the documentation of this file.
00001 
00003 #ifndef ARTIFACT_HPP_
00004 #define ARTIFACT_HPP_
00005 
00006 #include <ctime>
00007 #include <functional>
00008 #include <string>
00009 
00011 class artifact_impl;
00012 
00014 class artifact
00015 {
00016 public:
00018   artifact();
00021   artifact(std::string const& name);
00024   artifact(artifact const& a);
00026   ~artifact();
00027 
00030   artifact& operator=(artifact const& a);
00031 
00033   std::string const& name()     const;
00035   std::time_t        mod_time() const;
00039   std::string        expand(std::string str) const;
00040 
00042   void               build();
00045   std::time_t get_mod_time();
00046 
00050   void store_variable(std::string const& name, std::string const& value);
00051 
00052 private:
00053   artifact_impl* pimpl_;
00054 };
00055 
00057 template<class Char, class Traits>
00058 std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& out, artifact const& a)
00059 {
00060   out << a.name();
00061   return out;
00062 }
00063 
00065 inline bool operator==(artifact const& a, artifact const& b)
00066 {
00067   return a.name() == b.name();
00068 }
00069 
00071 inline bool operator!=(artifact const& a, artifact const& b)
00072 {
00073   return not(a == b);
00074 }
00075 
00076 namespace std {
00078   template<>
00079   class less<artifact> : public std::binary_function<artifact, artifact, bool> {
00080   public:
00084     bool operator()(artifact const& a, artifact const& b)
00085     {
00086       return a.name() < b.name();
00087     }
00088   };
00089 }
00090 
00091 #endif // ARTIFACT_HPP_

Generated on Sun Nov 30 09:53:22 2008 for Exploring C++ - Final Forms of Key Examples by  doxygen 1.5.3