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