TuttleOFX  1
File.cpp
Go to the documentation of this file.
00001 #include <File.hpp>
00002 #include <iomanip>
00003 #include <boost/regex.hpp>
00004 
00005 
00006 namespace sequenceParser {
00007 
00008 namespace bfs = boost::filesystem;
00009 
00010 std::ostream& File::getCout( std::ostream& os ) const
00011 {
00012         bfs::path dir;
00013         if( showAbsolutePath() )
00014         {
00015                 dir = bfs::absolute( _directory );
00016                 dir = boost::regex_replace( dir.string(), boost::regex( "/\\./" ), "/" );
00017         }
00018         os << std::left;
00019         if( showProperties() )
00020         {
00021                 os << std::setw( PROPERTIES_WIDTH ) << "f ";
00022         }
00023         if( showRelativePath() )
00024         {
00025                 dir = _directory;
00026                 dir = boost::regex_replace( dir.string(), boost::regex( "/\\./$" ), "/" );
00027                 std::string path = ( dir / _filename ).string();
00028 
00029                 os << std::setw( NAME_WIDTH_WITH_DIR ) << _kColorFile + path + _kColorStd;
00030         }
00031         else
00032         {
00033                 os << std::setw( NAME_WIDTH ) << _kColorFile + ( dir / _filename ).string() + _kColorStd;
00034         }
00035         return os;
00036 }
00037 
00038 std::vector<boost::filesystem::path> File::getFiles() const
00039 {
00040         std::vector<boost::filesystem::path> allPaths;
00041         allPaths.push_back( _directory / _filename );
00042         return allPaths;
00043 }
00044 
00045 }