// Path.h #ifndef Path_H #define Path_H // Describe a unix path and feteches it from and writes it to the // current environment. The path is an ordered list of strings which are // delimited by colons in the environment: A:B:C #include #include #include class Path : public std::list { public : // functions // Constructor. // Argument is a colon-separated value. // (Not the name of an environmental variable); explicit Path(std::string value =""); // Read from a string. // Original contents are lost. void get(std::string value); // Read from environment. // Original contents are lost. void getenv(std::string env); // Set the environmental variable using this path. void setenv(std::string env); // Return the sub-path with entries which are directories // in which the specified file exists. Path find(std::string filname); // Return the path in string format as in the constructor. std::string to_string() const; }; // Output stream. std::ostream& operator<<(std::ostream& lhs, const Path& rhs); // Formatted output stream. std::ostream& print(std::ostream& lhs, const Path& rhs, std::string indent); #endif