32#include <exiv2/exiv2.hpp>
44#ifdef EXV_HAVE_UNISTD_H
53#if defined(__CYGWIN__) || defined(__MINGW__)
56#include <sys/select.h>
60#if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW__) || defined(_MSC_VER)
70enum CmdId { invalidCmdId, add, set, del, reg };
76 , iptc = Exiv2::mdIptc
77 , exif = Exiv2::mdExif
140 std::string optstring_;
148 typedef std::vector<std::string>
Files;
154 typedef std::vector<std::string>
Keys;
211 enum Yod { yodYear, yodMonth, yodDay };
260 static const YodAdjust emptyYodAdjust_[];
269 Params() : optstring_(
":hVvqfbuktTFa:Y:O:D:r:p:P:d:e:i:c:m:M:l:S:g:K:n:Q:"),
285 target_(ctExif|ctIptc|ctComment|ctXmp),
291 yodAdjust_[yodYear] = emptyYodAdjust_[yodYear];
292 yodAdjust_[yodMonth] = emptyYodAdjust_[yodMonth];
304 int setLogLevel(
const std::string& optarg);
305 int evalGrep(
const std::string& optarg);
306 int evalKey(
const std::string& optarg);
307 int evalRename(
int opt,
const std::string& optarg);
308 int evalAdjust(
const std::string& optarg);
309 int evalYodAdjust(
const Yod& yod,
const std::string& optarg);
310 int evalPrint(
const std::string& optarg);
311 int evalPrintFlags(
const std::string& optarg);
312 int evalDelete(
const std::string& optarg);
313 int evalExtract(
const std::string& optarg);
314 int evalInsert(
const std::string& optarg);
315 int evalModify(
int opt,
const std::string& optarg);
329 int getopt(
int argc,
char*
const argv[]);
332 virtual int option(
int opt,
const std::string& optarg,
int optopt);
335 virtual int nonoption(
const std::string& argv);
338 void usage(std::ostream& os =std::cout)
const;
341 void help(std::ostream& os =std::cout)
const;
344 void version(
bool verbose =
false, std::ostream& os =std::cout)
const;
347 static std::string
printTarget(
const std::string& before,
int target,
bool bPrint=
false,std::ostream& os=std::cout);
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:193
Implements the command line handling for the program.
Definition: exiv2app.hpp:138
virtual int nonoption(const std::string &argv)
Handle non-option parameters.
Definition: exiv2.cpp:822
void usage(std::ostream &os=std::cout) const
Print a minimal usage note to an output stream.
Definition: exiv2.cpp:241
std::string charset_
Charset to use for UNICODE Exif user comment.
Definition: exiv2app.hpp:252
bool preserve_
Preserve timestamps flag.
Definition: exiv2app.hpp:226
void help(std::ostream &os=std::cout) const
Print further usage explanations to an output stream.
Definition: exiv2.cpp:267
int target_
What common target to process.
Definition: exiv2app.hpp:236
bool version_
Version option flag.
Definition: exiv2app.hpp:221
exv_grep_keys_t Greps
Container for greps.
Definition: exiv2app.hpp:152
Yod
Enumerates year, month and day adjustments.
Definition: exiv2app.hpp:211
PrintMode printMode_
Print mode.
Definition: exiv2app.hpp:231
CmdFiles cmdFiles_
Names of the modification command files.
Definition: exiv2app.hpp:242
PreviewNumbers previewNumbers_
List of preview numbers.
Definition: exiv2app.hpp:249
std::string format_
Filename format (-r option arg).
Definition: exiv2app.hpp:240
bool verbose_
Verbose (talkative) option flag.
Definition: exiv2app.hpp:222
bool force_
Force overwrites flag.
Definition: exiv2app.hpp:223
std::string jpegComment_
Jpeg comment to set in the image.
Definition: exiv2app.hpp:245
int getopt(int argc, char *const argv[])
Call Getopt::getopt() with optstring, to inititate command line argument parsing, perform consistency...
Definition: exiv2.cpp:1007
std::vector< std::string > CmdLines
Container for commands from the command line.
Definition: exiv2app.hpp:146
std::vector< std::string > CmdFiles
Container for command files.
Definition: exiv2app.hpp:144
std::vector< std::string > Files
Container to store filenames.
Definition: exiv2app.hpp:148
bool formatSet_
Whether the format is set with -r.
Definition: exiv2app.hpp:241
std::string directory_
Location for files to extract/insert.
Definition: exiv2app.hpp:246
unsigned long printTags_
Print tags (bitmap of MetadataId flags). Action (integer rather than TaskType to avoid dependency).
Definition: exiv2app.hpp:233
long adjustment_
Adjustment in seconds.
Definition: exiv2app.hpp:238
FileExistsPolicy
Enumerates the policies to handle existing files in rename action.
Definition: exiv2app.hpp:208
bool unknown_
Suppress unknown tags.
Definition: exiv2app.hpp:225
Greps greps_
List of keys to 'grep' from the metadata.
Definition: exiv2app.hpp:250
unsigned long printItems_
Print items.
Definition: exiv2app.hpp:232
CmdLines cmdLines_
Commands from the command line.
Definition: exiv2app.hpp:243
void getStdin(Exiv2::DataBuf &buf)
getStdin binary data read from stdin to DataBuf
Definition: exiv2.cpp:951
virtual int option(int opt, const std::string &optarg, int optopt)
Handle options and their arguments.
Definition: exiv2.cpp:373
static std::string printTarget(const std::string &before, int target, bool bPrint=false, std::ostream &os=std::cout)
Print target_.
Definition: exiv2.cpp:248
void cleanup()
Destructor.
Definition: exiv2.cpp:211
FileExistsPolicy fileExistsPolicy_
What to do if file to rename exists.
Definition: exiv2app.hpp:229
Exiv2::DataBuf stdinBuf
DataBuf with the binary bytes from stdin.
Definition: exiv2app.hpp:254
std::set< int > PreviewNumbers
Container for preview image numbers.
Definition: exiv2app.hpp:150
void version(bool verbose=false, std::ostream &os=std::cout) const
Print version information to an output stream.
Definition: exiv2.cpp:217
bool timestamp_
Rename also sets the file timestamp.
Definition: exiv2app.hpp:227
CommonTarget
Enumerates common targets, bitmap.
Definition: exiv2app.hpp:193
std::string suffix_
File extension of the file to insert.
Definition: exiv2app.hpp:247
std::vector< std::string > Keys
Container for keys.
Definition: exiv2app.hpp:154
PrintItem
Individual items to print, bitmap.
Definition: exiv2app.hpp:177
PrintMode
Enumerates print modes.
Definition: exiv2app.hpp:165
ModifyCmds modifyCmds_
Parsed modification commands.
Definition: exiv2app.hpp:244
bool timestampOnly_
Rename only sets the file timestamp.
Definition: exiv2app.hpp:228
bool adjust_
Adjustment flag.
Definition: exiv2app.hpp:230
YodAdjust yodAdjust_[3]
Year, month and day adjustment info.
Definition: exiv2app.hpp:239
Files files_
List of non-option arguments.
Definition: exiv2app.hpp:248
static Params & instance()
Controls all access to the global Params instance.
Definition: exiv2.cpp:195
Keys keys_
List of keys to match from the metadata.
Definition: exiv2app.hpp:251
bool help_
Help option flag.
Definition: exiv2app.hpp:220
bool binary_
Suppress long binary values.
Definition: exiv2app.hpp:224
MetadataId
Metadata identifiers.
Definition: exiv2app.hpp:75
std::vector< ModifyCmd > ModifyCmds
Container for modification commands.
Definition: exiv2app.hpp:96
CmdId
Command identifiers.
Definition: exiv2app.hpp:70
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
TypeId
Exiv2 value type identifiers.
Definition: types.hpp:119
Structure to link command identifiers to strings.
Definition: exiv2app.hpp:98
CmdId cmdId_
Commands identifier.
Definition: exiv2app.hpp:99
std::string cmdString_
Command string.
Definition: exiv2app.hpp:100
Structure for one parsed modification command.
Definition: exiv2app.hpp:82
ModifyCmd()
C'tor.
Definition: exiv2app.hpp:84
Exiv2::TypeId typeId_
Exiv2 type identifier Flag to indicate if the type was explicitly specified (true)
Definition: exiv2app.hpp:90
CmdId cmdId_
Command identifier.
Definition: exiv2app.hpp:87
std::string value_
Data.
Definition: exiv2app.hpp:93
std::string key_
Exiv2 key string.
Definition: exiv2app.hpp:88
MetadataId metadataId_
Metadata identifier.
Definition: exiv2app.hpp:89
Structure for year, month and day adjustment command line arguments.
Definition: exiv2app.hpp:214
long adjustment_
Adjustment value.
Definition: exiv2app.hpp:217
const char * option_
Adjustment option string.
Definition: exiv2app.hpp:216
bool flag_
Adjustment flag.
Definition: exiv2app.hpp:215