# # patch "ChangeLog" # from [ed1131f32e1512babb84f4a6d4db5c43ed5ff432] # to [e9ef2840f22898dc2fc42b734e3df6bcf9259657] # # patch "paths.cc" # from [adbd7ec83e52a8c0a7da240e6ecdf7b36a7db4e6] # to [f2fe69f3895760212a53333be292da4e6cef92c4] # # patch "paths.hh" # from [bba60652b42f333ccf0d9d2fd542900cf8065596] # to [e3af3c34d2cf32e279d86a64e1ce33e7093cd90f] # ======================================================================== --- ChangeLog ed1131f32e1512babb84f4a6d4db5c43ed5ff432 +++ ChangeLog e9ef2840f22898dc2fc42b734e3df6bcf9259657 @@ -1,5 +1,11 @@ 2005-08-23 Nathaniel Smith + * paths.{cc,hh} (operator <<): Implement for any_paths. + * paths.hh (class bookkeeping_path): Note that current design is + bogus to remind myself to fix it tomorrow... + +2005-08-23 Nathaniel Smith + * work.{hh,cc}: Convert to paths.hh. 2005-08-23 Nathaniel Smith ======================================================================== --- paths.cc adbd7ec83e52a8c0a7da240e6ecdf7b36a7db4e6 +++ paths.cc f2fe69f3895760212a53333be292da4e6cef92c4 @@ -1,8 +1,10 @@ // copyright (C) 2005 nathaniel smith // all rights reserved. // licensed to the public under the terms of the GNU GPL (>= 2) // see the file COPYING for details +#include + #include "constants.hh" #include "paths.hh" #include "platform.hh" @@ -234,6 +236,18 @@ #endif } +/////////////////////////////////////////////////////////////////////////// +// writing out paths +// we do _not_ convert charsets here, because this is for embedding in larger +// streams, and those larger streams will be converted as a whole +/////////////////////////////////////////////////////////////////////////// + +std::ostream & +operator <<(std::ostream & o, any_path const & a) +{ + o << a.data; +} + #ifdef BUILD_UNIT_TESTS #include "unit_tests.hh" ======================================================================== --- paths.hh bba60652b42f333ccf0d9d2fd542900cf8065596 +++ paths.hh e3af3c34d2cf32e279d86a64e1ce33e7093cd90f @@ -39,9 +39,10 @@ any_path(); any_path(any_path const & other); any_path & operator=(any_path const & other); + friend std::ostream & operator<<(std::ostream & o, any_path const & a); } -std::ostream & operator<<(ostream & o, any_path const & a); +std::ostream & operator<<(std::ostream & o, any_path const & a); class file_path : public any_path { @@ -84,6 +85,9 @@ public: // path should _not_ contain the leading MT/ // and _should_ look like an internal path + // FIXME: this^^ is bogus + // you can't poke around at subdirs of a tree! given MT/foo, you can't + // generate the path MT/foo/bar... bookkeeping_path(std::string const & path); std::string as_external() const; }; @@ -93,7 +97,8 @@ { public: // this path can contain anything, and it will be absolutified and - // tilde-expanded. it should be in utf8. + // tilde-expanded. it will considered to be relative to the directory + // monotone started in. it should be in utf8. system_path(std::string const & path); bool empty() const; };