Revision 328d0fa5
Added by David Sorber over 9 years ago
| software/photo_compress_archiver/PhotoCompressArchiver.hh | ||
|---|---|---|
|
// Alias the boost fs namespace to keep the code readable
|
||
|
namespace bfs = boost::filesystem;
|
||
|
|
||
|
const std::string BOLD("\033[1m");
|
||
|
const std::string ENDC("\033[0m");
|
||
|
const std::string RED("\033[31m");
|
||
|
const std::string YELLOW("\033[33m");
|
||
|
const std::string PURPLE("\033[35m");
|
||
|
|
||
|
const std::string version("v0.1.0");
|
||
|
|
||
|
const boost::regex JPEG_REGEX("^.+\\.(jpg)|(jpeg)$", boost::regex::icase);
|
||
|
const boost::regex PJG_REGEX("^.+\\.pjg$", boost::regex::icase);
|
||
|
|
||
|
class PhotoCompressArchiver
|
||
|
{
|
||
|
public:
|
||
|
|
||
|
PhotoCompressArchiver(const char* path, uint32_t num_cores);
|
||
|
PhotoCompressArchiver(
|
||
|
const std::string& path,
|
||
|
uint32_t num_cores,
|
||
|
bool decompress,
|
||
|
bool keep_orig);
|
||
|
|
||
|
~PhotoCompressArchiver();
|
||
|
|
||
| ... | ... | |
|
|
||
|
const bfs::path m_path; // top level path where to look for input files
|
||
|
uint32_t m_num_cores; // number of cores on the machine
|
||
|
bool m_decompress; // decompress files instead of compress them
|
||
|
bool m_keep_orig; // keep; don't delete original files
|
||
|
|
||
|
std::mutex m_output_mutex; // output mutex
|
||
|
|
||
|
std::atomic<uint32_t> m_files_processed; // number of input files processed
|
||
Adding proper option parsing and some general improvements. I've added an option for decompression but I still need to implement it.