#include <exiv2.hpp>
Inheritance diagram for Params:
Public Types | |
typedef std::vector< std::string > | Files |
Container to store filenames. | |
enum | PrintMode { pmSummary, pmInterpreted, pmValues, pmHexdump, pmIptc, pmComment } |
Enumerates print modes. | |
enum | commonTarget { ctExif = 1, ctIptc = 2, ctComment = 4, ctThumb = 8 } |
Enumerates common targets, bitmap. | |
Public Member Functions | |
int | getopt (int argc, char *const argv[]) |
Call Getopt::getopt() with optstring, to inititate command line argument parsing, perform consistency checks after all command line arguments are parsed. | |
virtual int | option (int opt, const std::string &optarg, int optopt) |
Handle options and their arguments. | |
virtual int | nonoption (const std::string &argv) |
Handle non-option parameters. | |
void | usage (std::ostream &os=std::cout) const |
Print a minimal usage note to an output stream. | |
void | help (std::ostream &os=std::cout) const |
Print further usage explanations to an output stream. | |
void | version (std::ostream &os=std::cout) const |
Print version information to an output stream. | |
Params () | |
Default constructor. Note that optstring_ is initialized here. | |
int | getopt (int argc, char *const argv[]) |
Call Getopt::getopt() with optstring, to initiate command line argument parsing, perform consistency checks after all command line arguments are parsed. | |
virtual int | option (int opt, const std::string &optarg, int optopt) |
Handle options and their arguments. | |
virtual int | nonoption (const std::string &argv) |
Handle non-option parameters. | |
void | usage (std::ostream &os=std::cout) const |
Print a minimal usage note to an output stream. | |
void | help (std::ostream &os=std::cout) const |
Print further usage explanations to an output stream. | |
Static Public Member Functions | |
Params & | instance () |
Controls all access to the global Params instance. | |
Public Attributes | |
bool | help_ |
Help option flag. | |
bool | version_ |
Version option flag. | |
bool | verbose_ |
Verbose (talkative) option flag. | |
bool | force_ |
Force overwrites flag. | |
bool | adjust_ |
Adjustment flag. | |
PrintMode | printMode_ |
int | action_ |
Action (integer rather than TaskType to avoid dependency). | |
int | target_ |
What common target to process. | |
long | adjustment_ |
Adjustment in seconds. | |
std::string | format_ |
Filename format (-r option arg). | |
Files | files_ |
List of non-option arguments. | |
bool | iptc_ |
Iptc option flag. | |
bool | exif_ |
Exif option flag. | |
bool | comment_ |
JPEG comment option flag. | |
bool | preserve_ |
Preserve existing metadata option flag. | |
std::string | read_ |
Source file. | |
std::string | write_ |
Destination file. |
Derives from Util::Getopt to use the command line argument parsing functionalty provided there. This class is implemented as a Singleton, i.e., there is only one global instance of it, which can be accessed from everywhere.
Usage example:
#include "params.h" int main(int argc, char* const argv[]) { Params& params = Params::instance(); if (params.getopt(argc, argv)) { params.usage(); return 1; } if (params.help_) { params.help(); return 0; } if (params.version_) { params.version(); return 0; } // do something useful here... return 0; }
|
Call Getopt::getopt() with optstring, to initiate command line argument parsing, perform consistency checks after all command line arguments are parsed.
|
|
Call Getopt::getopt() with optstring, to inititate command line argument parsing, perform consistency checks after all command line arguments are parsed.
|
|
Controls all access to the global Params instance.
|
|
Print mode. |