diff --git a/include/fc/filesystem.hpp b/include/fc/filesystem.hpp index d490d44..76e168c 100644 --- a/include/fc/filesystem.hpp +++ b/include/fc/filesystem.hpp @@ -28,6 +28,7 @@ namespace fc { friend path operator /( const fc::path& p, const fc::path& ); friend bool operator ==( const fc::path& p, const fc::path& ); friend bool operator !=( const fc::path& p, const fc::path& ); + friend bool operator < ( const fc::path& p, const fc::path& ); operator boost::filesystem::path& (); operator const boost::filesystem::path& ()const; @@ -69,6 +70,9 @@ namespace fc { fc::path operator*()const; recursive_directory_iterator& operator++(int); recursive_directory_iterator& operator++(); + void pop(); + int level(); + friend bool operator==( const recursive_directory_iterator&, const recursive_directory_iterator& ); friend bool operator!=( const recursive_directory_iterator&, const recursive_directory_iterator& ); diff --git a/include/fc/string.hpp b/include/fc/string.hpp index 490941e..5c58de1 100644 --- a/include/fc/string.hpp +++ b/include/fc/string.hpp @@ -24,12 +24,18 @@ namespace std { namespace fc { // typedef std::string string; /** + * @brief wrapper on std::string + * * Including results in 4000 lines of code * that must be included to build your header. This * class hides all of those details while maintaining * compatability with std::string. Using fc::string * instead of std::string can accelerate compile times * 10x. + * + * The implementation of this class is std::string, this header simply + * accelerates compile times. fc::string is automatically convertable to / from + * std::string. */ class string { public: diff --git a/include/fc/vector.hpp b/include/fc/vector.hpp index f65d695..1a56e3e 100644 --- a/include/fc/vector.hpp +++ b/include/fc/vector.hpp @@ -347,6 +347,15 @@ namespace fc { }; } + /** + * @brief provides a light-weight vector similar to std::vector except that + * it prevents needing to include which requires many more headers + * and increases compile times. + * + * This class should have the same API as std::vector and can be expanded as + * additional features of std::vector are required. + * + */ template class vector : public detail::vector_impl::type> { public: diff --git a/src/error_report.cpp b/src/error_report.cpp index 3dbecfb..ec4c588 100644 --- a/src/error_report.cpp +++ b/src/error_report.cpp @@ -84,56 +84,6 @@ fc::string error_frame::to_detail_string()const { fc::string error_frame::to_string()const { return substitute( desc, meta ? *meta : fc::value() ); } -#if 0 - fc::stringstream ss; - size_t prev = 0; - auto next = desc.find( '$' ); - while( prev != size_t(fc::string::npos) && prev < size_t(desc.size()) ) { - // slog( "prev: %d next %d %s", prev, next, desc.substr(prev,next).c_str() ); - // print everything from the last pos until the first '$' - ss << desc.substr( prev, size_t(next-prev) ); - - // if we got to the end, return it. - if( next == string::npos ) { return ss.str(); } - - // if we are not at the end, then update the start - prev = next + 1; - - if( desc[prev] == '{' ) { - // if the next char is a open, then find close - next = desc.find( '}', prev ); - // if we found close... - if( next != fc::string::npos ) { - // the key is between prev and next - fc::string key = desc.substr( prev+1, (next-prev-1) ); - //slog( "key '%s'", key.c_str() ); - if( meta ) { - auto itr = meta->find( key.c_str() ); - if( itr != meta->end() ) { - if( itr->val.is_string() ) { - ss<val.cast(); - } else { - ss << fc::json::to_string( itr->val ); - } - } else { - ss << "???"; - } - } - prev = next + 1; - // find the next $ - next = desc.find( '$', prev ); - } else { - // we didn't find it.. continue to while... - } - } else { - ss << desc[prev]; - ++prev; - next = desc.find( '$', prev ); - } - } - return ss.str(); -} -#endif fc::string substitute( const fc::string& format, const fc::value& keys ) { fc::stringstream ss; @@ -164,10 +114,10 @@ fc::string substitute( const fc::string& format, const fc::value& keys ) { if( itr->val.is_string() ) { ss<val.cast(); } else { - ss << fc::json::to_string( itr->val ); + ss << fc::json::to_string( itr->val ); } } else { - ss << "???"; + ss << "${"<level(); } + bool operator==( const recursive_directory_iterator& r, const recursive_directory_iterator& l) { return *r._p == *l._p; } diff --git a/src/time.cpp b/src/time.cpp index e55c965..0e30792 100644 --- a/src/time.cpp +++ b/src/time.cpp @@ -1,3 +1,4 @@ +#include #include #include #include