Exiv2: Params Class Reference

- Main Page
- Namespaces
- Classes
- Files
- Examples

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Params Class Reference

Implements the command line handling for the program. More...

`#include <exiv2.hpp>`

Inheritance diagram for Params:

[legend]
Collaboration diagram for Params:

[legend]

List of all members.

## Public Types
enum | PrintMode { pmSummary, pmList, pmIptc, pmXmp, pmComment }
| Enumerates print modes.
enum | PrintItem { prTag = 1, prGroup = 2, prKey = 4, prName = 8, prLabel = 16, prType = 32, prCount = 64, prSize = 128, prValue = 256, prTrans = 512, prHex = 1024 }
| Individual items to print.
enum | CommonTarget { ctExif = 1, ctIptc = 2, ctComment = 4, ctThumb = 8, ctXmp = 16, ctXmpPacket = 32 }
| Enumerates common targets, bitmap.
enum | FileExistsPolicy { overwritePolicy, renamePolicy, askPolicy }
| Enumerates the policies to handle existing files in rename action.
enum | Yod { yodYear, yodMonth, yodDay }
| Enumerates year, month and day adjustments.
typedef std::vector< std::string > | CmdFiles
| Container for command files.
typedef std::vector< std::string > | CmdLines
| Container for commands from the command line.
typedef std::vector< std::string > | Files
| Container to store filenames.
## Public Member Functions
void | cleanup ()
| Destructor.
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
static 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 | binary_
| Suppress long binary values.
bool | unknown_
| Suppress unknown tags.
bool | preserve_
| Preserve timestamps flag.
bool | timestamp_
| Rename also sets the file timestamp.
bool | timestampOnly_
| Rename only sets the file timestamp.
FileExistsPolicy | fileExistsPolicy_
| What to do if file to rename exists.
bool | adjust_
| Adjustment flag.
PrintMode | printMode_
| Print mode.
unsigned long | printItems_
int | action_
| Action (integer rather than TaskType to avoid dependency).
int | target_
| What common target to process.
long | adjustment_
| Adjustment in seconds.
YodAdjust | yodAdjust_ [3]
| Year, month and day adjustment info.
std::string | format_
| Filename format (-r option arg).
bool | formatSet_
| Whether the format is set with -r.
CmdFiles | cmdFiles_
| Names of the modification command files.
CmdLines | cmdLines_
| Commands from the command line.
ModifyCmds | modifyCmds_
| Parsed modification commands.
std::string | jpegComment_
| Jpeg comment to set in the image.
std::string | directory_
| Location for files to extract/insert.
std::string | suffix_
| File extension of the file to insert.
Files | files_
| List of non-option arguments.
bool | iptc_
| Iptc option flag.
bool | exif_
| Exif option flag.
bool | comment_
| JPEG comment option flag.
std::string | read_
| Source file.
std::string | write_
| Destination file.
## Classes
struct | YodAdjust
| Structure for year, month and day adjustment command line arguments. More...

## Detailed Description

Implements the command line handling for the program.

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;
      }

## Member Function Documentation

Params & Params::instance | ( |  | ) | `[static]`

Controls all access to the global Params instance.

Returns:
  Reference to the global Params instance.

int Params::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.

Parameters:

  | argc | Argument count as passed to main() on program invocation.
  | argv | Argument array as passed to main() on program invocation.

Returns:
  0 if successful, >0 in case of errors.

int Params::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.

Parameters:

  | argc | Argument count as passed to main() on program invocation.
  | argv | Argument array as passed to main() on program invocation.

Returns:
  0 if successful, >0 in case of errors.

## Member Data Documentation

bool Params::preserve_

Preserve timestamps flag.

Preserve existing metadata option flag.

unsigned long Params::printItems_

Print items.

The documentation for this class was generated from the following files:

- exiv2.hpp
- metacopy.hpp
- exiv2.cpp
- metacopy.cpp