Merge pull request #2131 from Exiv2/mainCleanups
Include what you use + more SPDX identifiers + few other cleanups
This commit is contained in:
+3
-24
@@ -1,28 +1,9 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// addmoddel.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Sample program showing how to add, modify and delete Exif metadata.
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cassert>
|
||||
|
||||
int main(int argc, char* const argv[])
|
||||
@@ -122,9 +103,7 @@ try {
|
||||
|
||||
// *************************************************************************
|
||||
// Finally, write the remaining Exif data to the image file
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert(image.get() != 0);
|
||||
|
||||
auto image = Exiv2::ImageFactory::open(file);
|
||||
image->setExifData(exifData);
|
||||
image->writeMetadata();
|
||||
|
||||
|
||||
+1
-20
@@ -1,23 +1,4 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// con-test.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Tester application for testing the http/https/ftp/ssh/sftp connection
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
|
||||
@@ -1,28 +1,9 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// convert-test.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Conversion test driver - make sure you have a copy of the input file around!
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cassert>
|
||||
|
||||
int main(int argc, char* const argv[])
|
||||
@@ -38,8 +19,7 @@ try {
|
||||
return 1;
|
||||
}
|
||||
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
assert(image.get() != 0);
|
||||
auto image = Exiv2::ImageFactory::open(argv[1]);
|
||||
image->readMetadata();
|
||||
|
||||
Exiv2::XmpData xmpData;
|
||||
|
||||
@@ -1,23 +1,4 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// easyaccess-test.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Sample program using high-level metadata access functions
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
@@ -82,8 +63,7 @@ try {
|
||||
return 1;
|
||||
}
|
||||
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
assert (image.get() != 0);
|
||||
auto image = Exiv2::ImageFactory::open(argv[1]);
|
||||
image->readMetadata();
|
||||
Exiv2::ExifData& ed = image->exifData();
|
||||
|
||||
|
||||
+7
-33
@@ -1,26 +1,5 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/*
|
||||
Abstract : Sample program showing how to set the Exif comment of an image,
|
||||
Exif.Photo.UserComment
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Abstract : Sample program showing how to set the Exif comment of an image, Exif.Photo.UserComment
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
#include <iostream>
|
||||
@@ -41,8 +20,7 @@ try {
|
||||
return 1;
|
||||
}
|
||||
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
assert (image.get() != 0);
|
||||
auto image = Exiv2::ImageFactory::open(argv[1]);
|
||||
image->readMetadata();
|
||||
Exiv2::ExifData &exifData = image->exifData();
|
||||
|
||||
@@ -58,14 +36,10 @@ try {
|
||||
Following are a few examples of valid comments. The last one is written to
|
||||
the file.
|
||||
*/
|
||||
exifData["Exif.Photo.UserComment"]
|
||||
= "charset=Unicode A Unicode Exif comment added with Exiv2";
|
||||
exifData["Exif.Photo.UserComment"]
|
||||
= "charset=Undefined An undefined Exif comment added with Exiv2";
|
||||
exifData["Exif.Photo.UserComment"]
|
||||
= "Another undefined Exif comment added with Exiv2";
|
||||
exifData["Exif.Photo.UserComment"]
|
||||
= "charset=Ascii An ASCII Exif comment added with Exiv2";
|
||||
exifData["Exif.Photo.UserComment"] = "charset=Unicode A Unicode Exif comment added with Exiv2";
|
||||
exifData["Exif.Photo.UserComment"] = "charset=Undefined An undefined Exif comment added with Exiv2";
|
||||
exifData["Exif.Photo.UserComment"] = "Another undefined Exif comment added with Exiv2";
|
||||
exifData["Exif.Photo.UserComment"] = "charset=Ascii An ASCII Exif comment added with Exiv2";
|
||||
|
||||
std::cout << "Writing user comment '"
|
||||
<< exifData["Exif.Photo.UserComment"]
|
||||
|
||||
@@ -1,28 +1,7 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
void write(const std::string& file, Exiv2::ExifData& ed);
|
||||
void print(const std::string& file);
|
||||
@@ -44,8 +23,8 @@ try {
|
||||
}
|
||||
std::string file(argv[1]);
|
||||
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert (image.get() != 0);
|
||||
auto image = Exiv2::ImageFactory::open(file);
|
||||
assert (image);
|
||||
image->readMetadata();
|
||||
|
||||
Exiv2::ExifData &ed = image->exifData();
|
||||
@@ -117,16 +96,14 @@ catch (Exiv2::AnyError& e) {
|
||||
|
||||
void write(const std::string& file, Exiv2::ExifData& ed)
|
||||
{
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert (image.get() != 0);
|
||||
auto image = Exiv2::ImageFactory::open(file);
|
||||
image->setExifData(ed);
|
||||
image->writeMetadata();
|
||||
}
|
||||
|
||||
void print(const std::string& file)
|
||||
{
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert (image.get() != 0);
|
||||
auto image = Exiv2::ImageFactory::open(file);
|
||||
image->readMetadata();
|
||||
|
||||
Exiv2::ExifData &ed = image->exifData();
|
||||
|
||||
+3
-23
@@ -1,28 +1,9 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// exifdata.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Sample program to format exif data in various external formats
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
|
||||
@@ -203,8 +184,7 @@ int main(int argc,const char* argv[])
|
||||
}
|
||||
|
||||
if ( !result ) try {
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert(image.get() != 0);
|
||||
auto image = Exiv2::ImageFactory::open(file);
|
||||
image->readMetadata();
|
||||
Exiv2::ExifData &exifData = image->exifData();
|
||||
|
||||
|
||||
+2
-24
@@ -1,28 +1,7 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
#include <regex>
|
||||
|
||||
// copied from src/tiffvisitor_int.cpp
|
||||
@@ -85,8 +64,7 @@ try {
|
||||
return rc;
|
||||
}
|
||||
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert(image.get() != 0);
|
||||
auto image = Exiv2::ImageFactory::open(file);
|
||||
image->readMetadata();
|
||||
|
||||
Exiv2::ExifData &exifData = image->exifData();
|
||||
|
||||
+3
-25
@@ -1,30 +1,9 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// exifvalue.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Sample program to print value of an exif key in an image
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
|
||||
int main(int argc, char* const argv[])
|
||||
{
|
||||
@@ -42,8 +21,7 @@ int main(int argc, char* const argv[])
|
||||
const char* file = argv[1];
|
||||
const char* key = argv[2];
|
||||
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert(image.get() != 0);
|
||||
auto image = Exiv2::ImageFactory::open(file);
|
||||
image->readMetadata();
|
||||
Exiv2::ExifData &exifData = image->exifData();
|
||||
|
||||
|
||||
+11
-35
@@ -1,45 +1,21 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// exiv2json.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Sample program to print metadata in JSON format
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
#include "Jzon.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <cstdlib>
|
||||
#include <limits.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
|
||||
#include "Jzon.h"
|
||||
|
||||
#if defined(__MINGW32__) || defined(__MINGW64__)
|
||||
# ifndef __MINGW__
|
||||
# define __MINGW__
|
||||
# endif
|
||||
#ifndef __MINGW__
|
||||
#define __MINGW__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct Token {
|
||||
|
||||
+6
-38
@@ -1,46 +1,15 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// geotag.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Sample program to read gpx files and update images with GPS tags
|
||||
// g++ geotag.cpp -o geotag -lexiv2 -lexpat
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
#include "unused.h"
|
||||
#include <expat.h>
|
||||
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <cstdlib>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <expat.h>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
|
||||
#if defined(__MINGW32__) || defined(__MINGW64__)
|
||||
# ifndef __MINGW__
|
||||
@@ -419,14 +388,13 @@ time_t parseTime(const char* arg,bool bAdjust)
|
||||
// West of GMT is negative (PDT = Pacific Daylight = -07:00 == -25200 seconds
|
||||
int timeZoneAdjust()
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
[[maybe_unused]] time_t now = time(nullptr);
|
||||
int offset;
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MINGW__)
|
||||
TIME_ZONE_INFORMATION TimeZoneInfo;
|
||||
GetTimeZoneInformation( &TimeZoneInfo );
|
||||
offset = - (((int)TimeZoneInfo.Bias + (int)TimeZoneInfo.DaylightBias) * 60);
|
||||
UNUSED(now);
|
||||
#elif defined(__CYGWIN__)
|
||||
struct tm lcopy = *localtime(&now);
|
||||
time_t gmt = timegm(&lcopy) ; // timegm modifies lcopy
|
||||
|
||||
+2
-22
@@ -1,23 +1,5 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// getopt-test.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
// Sample program to test getopt()
|
||||
// Command:
|
||||
// $ getopt-test -v pr -P EIXxgklnycsvth file1 file2
|
||||
@@ -48,8 +30,6 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cassert>
|
||||
|
||||
#define Safe(x) (x?x:"unknown")
|
||||
const char* optstring = ":hVvqfbuktTFa:Y:O:D:r:p:P:d:e:i:c:m:M:l:S:g:K:n:Q:";
|
||||
|
||||
+1
-19
@@ -1,22 +1,4 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*
|
||||
670 rmills@rmillsmbp:~/gnu/exiv2/trunk/samples $ gcc ../src/ini.cpp ini-test.cpp -lstdc++ -o ini-test
|
||||
|
||||
+3
-25
@@ -1,29 +1,7 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// *****************************************************************************
|
||||
// included header files
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#include <exiv2/exiv2.hpp>
|
||||
#include <cstdio> // for EOF
|
||||
#include <cstring>
|
||||
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
|
||||
using Exiv2::byte;
|
||||
using Exiv2::BasicIo;
|
||||
@@ -71,7 +49,7 @@ int main(int argc, char* const argv[])
|
||||
std::vector<Exiv2::byte> bytes (blocksize);
|
||||
|
||||
// copy fileIn from a remote location.
|
||||
BasicIo::UniquePtr io = Exiv2::ImageFactory::createIo(fr);
|
||||
auto io = Exiv2::ImageFactory::createIo(fr);
|
||||
if ( io->open() != 0 ) {
|
||||
Error(Exiv2::kerFileOpenFailed, io->path(), "rb", strError());
|
||||
}
|
||||
|
||||
+3
-25
@@ -1,29 +1,9 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
// iptceasy.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// The quickest way to access, set or modify IPTC metadata.
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cassert>
|
||||
|
||||
int main(int argc, char* const argv[])
|
||||
try {
|
||||
@@ -57,9 +37,7 @@ try {
|
||||
std::cout << "Time sent: " << iptcData["Iptc.Envelope.TimeSent"] << "\n";
|
||||
|
||||
// Open image file
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert (image.get() != 0);
|
||||
|
||||
auto image = Exiv2::ImageFactory::open(file);
|
||||
// Set IPTC data and write it to the file
|
||||
image->setIptcData(iptcData);
|
||||
image->writeMetadata();
|
||||
|
||||
+3
-24
@@ -1,29 +1,9 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// iptcprint.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Sample program to print the IPTC metadata of an image
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cassert>
|
||||
|
||||
int main(int argc, char* const argv[])
|
||||
try {
|
||||
@@ -38,8 +18,7 @@ try {
|
||||
return 1;
|
||||
}
|
||||
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
assert (image.get() != 0);
|
||||
auto image = Exiv2::ImageFactory::open(argv[1]);
|
||||
image->readMetadata();
|
||||
|
||||
Exiv2::IptcData &iptcData = image->iptcData();
|
||||
|
||||
+3
-23
@@ -1,27 +1,8 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cassert>
|
||||
|
||||
using namespace Exiv2;
|
||||
|
||||
@@ -48,8 +29,7 @@ int main(int argc, char* const argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
Image::UniquePtr image = ImageFactory::open(argv[1]);
|
||||
assert (image.get() != 0);
|
||||
auto image = ImageFactory::open(argv[1]);
|
||||
image->readMetadata();
|
||||
|
||||
// Process commands
|
||||
|
||||
+2
-21
@@ -1,27 +1,8 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
||||
using namespace Exiv2;
|
||||
|
||||
|
||||
@@ -1,24 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
// Test for large (>65535 bytes) IPTC buffer
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
#include <cassert>
|
||||
@@ -45,7 +28,8 @@ int main(int argc, char* const argv[])
|
||||
if (io.open() != 0) {
|
||||
throw Exiv2::Error(Exiv2::kerDataSourceOpenFailed, io.path(), Exiv2::strError());
|
||||
}
|
||||
Exiv2::DataBuf buf(static_cast<long>(io.size()));
|
||||
|
||||
Exiv2::DataBuf buf(io.size());
|
||||
std::cout << "Reading " << buf.size() << " bytes from " << data << "\n";
|
||||
const size_t readBytes = io.read(buf.data(), buf.size());
|
||||
if (readBytes != buf.size() || io.error() || io.eof()) {
|
||||
@@ -53,8 +37,7 @@ int main(int argc, char* const argv[])
|
||||
}
|
||||
|
||||
// Read metadata from file
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert(image.get() != 0);
|
||||
auto image = Exiv2::ImageFactory::open(file);
|
||||
image->readMetadata();
|
||||
|
||||
// Set Preview field to the content of the data file
|
||||
|
||||
+4
-25
@@ -1,26 +1,7 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cassert>
|
||||
|
||||
// include local header files which are not part of libexiv2
|
||||
#include "getopt.hpp"
|
||||
@@ -53,12 +34,10 @@ try {
|
||||
auto memIo = std::make_unique<Exiv2::MemIo>();
|
||||
memIo->transfer(fileIo);
|
||||
|
||||
Exiv2::Image::UniquePtr readImg = Exiv2::ImageFactory::open(std::move(memIo));
|
||||
assert(readImg.get() != 0);
|
||||
auto readImg = Exiv2::ImageFactory::open(std::move(memIo));
|
||||
readImg->readMetadata();
|
||||
|
||||
Exiv2::Image::UniquePtr writeImg = Exiv2::ImageFactory::open(params.write_);
|
||||
assert(writeImg.get() != 0);
|
||||
auto writeImg = Exiv2::ImageFactory::open(params.write_);
|
||||
if (params.preserve_) {
|
||||
writeImg->readMetadata();
|
||||
}
|
||||
|
||||
+3
-23
@@ -1,28 +1,9 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
// mmap-test.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Simple mmap tests
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
|
||||
using namespace Exiv2;
|
||||
|
||||
@@ -47,8 +28,7 @@ try {
|
||||
}
|
||||
// Map it to memory
|
||||
const Exiv2::byte* pData = file.mmap();
|
||||
auto size = static_cast<long>(file.size());
|
||||
DataBuf buf(size);
|
||||
DataBuf buf(file.size());
|
||||
// Read from the memory mapped region
|
||||
buf.copyBytes(0, pData, buf.size());
|
||||
// Reopen file in write mode and write to it
|
||||
|
||||
+2
-22
@@ -1,24 +1,5 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
// mrwthumb.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Sample program to extract a Minolta thumbnail from the makernote
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
#include <cassert>
|
||||
@@ -38,8 +19,7 @@ int main(int argc, char* const argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
assert(image.get() != 0);
|
||||
auto image = Exiv2::ImageFactory::open(argv[1]);
|
||||
image->readMetadata();
|
||||
|
||||
Exiv2::ExifData& exifData = image->exifData();
|
||||
|
||||
+2
-22
@@ -1,30 +1,10 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
// path-test.cpp
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
|
||||
+3
-24
@@ -1,29 +1,9 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
// prevtest.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Test access to preview images
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
#include <string>
|
||||
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
|
||||
int main(int argc, char* const argv[])
|
||||
try {
|
||||
@@ -39,8 +19,7 @@ try {
|
||||
}
|
||||
std::string filename(argv[1]);
|
||||
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(filename);
|
||||
assert(image.get() != 0);
|
||||
auto image = Exiv2::ImageFactory::open(filename);
|
||||
image->readMetadata();
|
||||
|
||||
Exiv2::PreviewManager loader(*image);
|
||||
|
||||
+3
-24
@@ -1,26 +1,7 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
// remotetest.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Tester application for testing remote i/o.
|
||||
// It makes some modifications on the metadata of remote file, reads new metadata from that file
|
||||
// and reset the metadata back to the original status.
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
#include <iostream>
|
||||
@@ -63,15 +44,13 @@ try {
|
||||
Exiv2::ExifKey key("Exif.Image.DateTime");
|
||||
exifData.add(key, v.get());
|
||||
|
||||
Exiv2::Image::UniquePtr writeTest = Exiv2::ImageFactory::open(file, useCurlFromExiv2TestApps);
|
||||
assert(writeTest.get() != 0);
|
||||
auto writeTest = Exiv2::ImageFactory::open(file, useCurlFromExiv2TestApps);
|
||||
writeTest->setExifData(exifData);
|
||||
writeTest->writeMetadata();
|
||||
|
||||
// read the result to make sure everything fine
|
||||
std::cout << "Print out the new metadata ...\n";
|
||||
Exiv2::Image::UniquePtr readTest = Exiv2::ImageFactory::open(file, useCurlFromExiv2TestApps);
|
||||
assert(readTest.get() != 0);
|
||||
auto readTest = Exiv2::ImageFactory::open(file, useCurlFromExiv2TestApps);
|
||||
readTest->readMetadata();
|
||||
Exiv2::ExifData &exifReadData = readTest->exifData();
|
||||
if (exifReadData.empty()) {
|
||||
|
||||
@@ -1,28 +1,9 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
// stringto-test.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Test conversions from string to long, float and Rational types.
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
static constexpr const char* testcases[] = {
|
||||
// bool
|
||||
|
||||
+2
-21
@@ -1,27 +1,8 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
using namespace Exiv2;
|
||||
|
||||
|
||||
+1
-21
@@ -1,24 +1,4 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
// tiff-test.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// First and very simple TIFF write test.
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
|
||||
+1
-22
@@ -1,25 +1,4 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
// werror-test.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Simple tests for the wide-string error class WError
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
|
||||
+4
-28
@@ -1,30 +1,8 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
// *****************************************************************************
|
||||
// local declarations
|
||||
@@ -170,8 +148,7 @@ void testCase(const std::string& file1,
|
||||
ExifKey ek(key);
|
||||
|
||||
//Open first image
|
||||
Image::UniquePtr image1 = ImageFactory::open(file1);
|
||||
assert(image1.get() != 0);
|
||||
auto image1 = ImageFactory::open(file1);
|
||||
|
||||
// Load existing metadata
|
||||
std::cerr << "---> Reading file " << file1 << "\n";
|
||||
@@ -186,8 +163,7 @@ void testCase(const std::string& file1,
|
||||
pos->setValue(value);
|
||||
|
||||
// Open second image
|
||||
Image::UniquePtr image2 = ImageFactory::open(file2);
|
||||
assert(image2.get() != 0);
|
||||
auto image2 = ImageFactory::open(file2);
|
||||
|
||||
image2->setExifData(image1->exifData());
|
||||
|
||||
|
||||
+8
-32
@@ -1,28 +1,7 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
void write(const std::string& file, Exiv2::ExifData& ed);
|
||||
void print(const std::string& file);
|
||||
@@ -48,19 +27,19 @@ int main(int argc, char* const argv[])
|
||||
Exiv2::ExifData ed1;
|
||||
ed1["Exif.Image.Model"] = "Test 1";
|
||||
|
||||
Exiv2::Value::UniquePtr v1 = Exiv2::Value::create(Exiv2::unsignedShort);
|
||||
auto v1 = Exiv2::Value::create(Exiv2::unsignedShort);
|
||||
v1->read("160 161 162 163");
|
||||
ed1.add(Exiv2::ExifKey("Exif.Image.SamplesPerPixel"), v1.get());
|
||||
|
||||
Exiv2::Value::UniquePtr v2 = Exiv2::Value::create(Exiv2::signedLong);
|
||||
auto v2 = Exiv2::Value::create(Exiv2::signedLong);
|
||||
v2->read("-2 -1 0 1");
|
||||
ed1.add(Exiv2::ExifKey("Exif.Image.XResolution"), v2.get());
|
||||
|
||||
Exiv2::Value::UniquePtr v3 = Exiv2::Value::create(Exiv2::signedRational);
|
||||
auto v3 = Exiv2::Value::create(Exiv2::signedRational);
|
||||
v3->read("-2/3 -1/3 0/3 1/3");
|
||||
ed1.add(Exiv2::ExifKey("Exif.Image.YResolution"), v3.get());
|
||||
|
||||
Exiv2::Value::UniquePtr v4 = Exiv2::Value::create(Exiv2::undefined);
|
||||
auto v4 = Exiv2::Value::create(Exiv2::undefined);
|
||||
v4->read("255 254 253 252");
|
||||
ed1.add(Exiv2::ExifKey("Exif.Image.WhitePoint"), v4.get());
|
||||
|
||||
@@ -87,8 +66,7 @@ int main(int argc, char* const argv[])
|
||||
print(file);
|
||||
|
||||
std::cout <<"\n----- Non-intrusive writing of special Canon MakerNote tags\n";
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert(image.get() != 0);
|
||||
auto image = Exiv2::ImageFactory::open(file);
|
||||
image->readMetadata();
|
||||
|
||||
Exiv2::ExifData& rEd = image->exifData();
|
||||
@@ -219,8 +197,7 @@ catch (Exiv2::AnyError& e) {
|
||||
|
||||
void write(const std::string& file, Exiv2::ExifData& ed)
|
||||
{
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert(image.get() != 0);
|
||||
auto image = Exiv2::ImageFactory::open(file);
|
||||
|
||||
image->setExifData(ed);
|
||||
image->writeMetadata();
|
||||
@@ -228,8 +205,7 @@ void write(const std::string& file, Exiv2::ExifData& ed)
|
||||
|
||||
void print(const std::string& file)
|
||||
{
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert(image.get() != 0);
|
||||
auto image = Exiv2::ImageFactory::open(file);
|
||||
image->readMetadata();
|
||||
|
||||
Exiv2::ExifData &ed = image->exifData();
|
||||
|
||||
+3
-25
@@ -1,29 +1,8 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
// xmpdump.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Sample program to dump the XMP packet of an image
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
int main(int argc, char* const argv[])
|
||||
{
|
||||
@@ -39,8 +18,7 @@ int main(int argc, char* const argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
assert(image.get() != 0);
|
||||
auto image = Exiv2::ImageFactory::open(argv[1]);
|
||||
image->readMetadata();
|
||||
|
||||
const std::string& xmpPacket = image->xmpPacket();
|
||||
|
||||
+2
-22
@@ -1,29 +1,8 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// xmpparse.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Read an XMP packet from a file, parse it and print all (known) properties.
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
int main(int argc, char* const argv[])
|
||||
try {
|
||||
@@ -37,6 +16,7 @@ try {
|
||||
std::cout << "Usage: " << argv[0] << " file\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Exiv2::DataBuf buf = Exiv2::readFile(argv[1]);
|
||||
std::string xmpPacket;
|
||||
xmpPacket.assign(buf.c_str(), buf.size());
|
||||
|
||||
@@ -1,29 +1,8 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// xmpparser-test.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Read an XMP packet from a file, parse and re-serialize it.
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
int main(int argc, char* const argv[])
|
||||
try {
|
||||
|
||||
+3
-29
@@ -1,30 +1,5 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
// xmpprint.cpp
|
||||
// Read an XMP from a video or graphic file, parse it and print
|
||||
// all (known) properties.
|
||||
// ========================================================================
|
||||
// Linux standalone compilation :
|
||||
// g++ -o xmpprint xmpprint.cpp `pkg-config --cflags --libs exiv2`
|
||||
// ========================================================================
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Read an XMP from a video or graphic file, parse it and print all (known) properties.
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
#include <string>
|
||||
@@ -48,8 +23,7 @@ int main(int argc, char** argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
assert (image.get() != 0);
|
||||
auto image = Exiv2::ImageFactory::open(argv[1]);
|
||||
image->readMetadata();
|
||||
|
||||
Exiv2::XmpData &xmpData = image->xmpData();
|
||||
|
||||
+9
-37
@@ -1,33 +1,11 @@
|
||||
// ***************************************************************** -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Exiv2 authors
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// xmpsample.cpp
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Sample/test for high level XMP classes. See also addmoddel.cpp
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
#include "unused.h"
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
bool isEqual(float a, float b)
|
||||
{
|
||||
@@ -77,26 +55,22 @@ try {
|
||||
assert(xmpData["Xmp.dc.one"].toInt64() == -1);
|
||||
assert(xmpData["Xmp.dc.one"].value().ok());
|
||||
|
||||
const Exiv2::Value &getv1 = xmpData["Xmp.dc.one"].value();
|
||||
UNUSED(getv1);
|
||||
[[maybe_unused]] const Exiv2::Value &getv1 = xmpData["Xmp.dc.one"].value();
|
||||
assert(isEqual(getv1.toFloat(), -1));
|
||||
assert(getv1.ok());
|
||||
assert(getv1.toRational() == Exiv2::Rational(-1, 1));
|
||||
assert(getv1.ok());
|
||||
|
||||
const Exiv2::Value &getv2 = xmpData["Xmp.dc.two"].value();
|
||||
UNUSED(getv2);
|
||||
[[maybe_unused]] const Exiv2::Value &getv2 = xmpData["Xmp.dc.two"].value();
|
||||
assert(isEqual(getv2.toFloat(), 3.1415f));
|
||||
assert(getv2.ok());
|
||||
assert(getv2.toInt64() == 3);
|
||||
assert(getv2.ok());
|
||||
Exiv2::Rational R = getv2.toRational();
|
||||
UNUSED(R);
|
||||
[[maybe_unused]] Exiv2::Rational R = getv2.toRational();
|
||||
assert(getv2.ok());
|
||||
assert(isEqual(static_cast<float>(R.first) / R.second, 3.1415f ));
|
||||
|
||||
const Exiv2::Value &getv3 = xmpData["Xmp.dc.three"].value();
|
||||
UNUSED(getv3);
|
||||
[[maybe_unused]] const Exiv2::Value &getv3 = xmpData["Xmp.dc.three"].value();
|
||||
assert(isEqual(getv3.toFloat(), 5.0f/7.0f));
|
||||
assert(getv3.ok());
|
||||
assert(getv3.toInt64() == 0); // long(5.0 / 7.0)
|
||||
@@ -104,8 +78,7 @@ try {
|
||||
assert(getv3.toRational() == Exiv2::Rational(5, 7));
|
||||
assert(getv3.ok());
|
||||
|
||||
const Exiv2::Value &getv6 = xmpData["Xmp.dc.six"].value();
|
||||
UNUSED(getv6);
|
||||
[[maybe_unused]] const Exiv2::Value &getv6 = xmpData["Xmp.dc.six"].value();
|
||||
assert(getv6.toInt64() == 0);
|
||||
assert(getv6.ok());
|
||||
assert(getv6.toFloat() == 0.0f);
|
||||
@@ -117,8 +90,7 @@ try {
|
||||
getv7.toInt64(); // this should fail
|
||||
assert(!getv7.ok());
|
||||
|
||||
const Exiv2::Value &getv8 = xmpData["Xmp.dc.eight"].value();
|
||||
UNUSED(getv8);
|
||||
[[maybe_unused]] const Exiv2::Value &getv8 = xmpData["Xmp.dc.eight"].value();
|
||||
assert(getv8.toInt64() == 1);
|
||||
assert(getv8.ok());
|
||||
assert(getv8.toFloat() == 1.0f);
|
||||
@@ -136,7 +108,7 @@ try {
|
||||
// properties and language alternatives.
|
||||
|
||||
// Add a simple XMP property in a known namespace
|
||||
Exiv2::Value::UniquePtr v = Exiv2::Value::create(Exiv2::xmpText);
|
||||
auto v = Exiv2::Value::create(Exiv2::xmpText);
|
||||
v->read("image/jpeg");
|
||||
xmpData.add(Exiv2::XmpKey("Xmp.dc.format"), v.get());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user