Merge pull request #1555 from piponazo/modernizationCpp
Modernization C++ (replace auto_ptr with unique_ptr)
This commit is contained in:
commit
c3251bb3d6
97
.travis.yml
97
.travis.yml
@ -10,39 +10,23 @@ env:
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- name: "Ubuntu 16.04 - gcc-5.4 (Release)"
|
||||
- name: "Ubuntu 18.04 - gcc-7.5 (Release)"
|
||||
os: linux
|
||||
dist: xenial
|
||||
dist: bionic
|
||||
sudo: required
|
||||
compiler: gcc
|
||||
env:
|
||||
- BUILD_TYPE="Release"
|
||||
|
||||
- name: "Ubuntu 16.04 - gcc-5.4 (Debug)"
|
||||
- name: "Ubuntu 18.04 - gcc-7.5 (Debug)"
|
||||
os: linux
|
||||
dist: xenial
|
||||
dist: bionic
|
||||
sudo: required
|
||||
compiler: gcc
|
||||
env:
|
||||
- BUILD_TYPE="Debug"
|
||||
|
||||
# - name: "Ubuntu 18.04 - gcc (Release)"
|
||||
# os: linux
|
||||
# dist: bionic
|
||||
# sudo: required
|
||||
# compiler: gcc
|
||||
# env:
|
||||
# - BUILD_TYPE="Release"
|
||||
#
|
||||
# - name: "Ubuntu 18.04 - gcc (Debug)"
|
||||
# os: linux
|
||||
# dist: bionic
|
||||
# sudo: required
|
||||
# compiler: gcc
|
||||
# env:
|
||||
# - BUILD_TYPE="Debug"
|
||||
|
||||
- name: "Ubuntu 20.04 - gcc (Release)"
|
||||
- name: "Ubuntu 20.04 - gcc-9.3 (Release)"
|
||||
os: linux
|
||||
dist: focal
|
||||
sudo: required
|
||||
@ -50,7 +34,7 @@ matrix:
|
||||
env:
|
||||
- BUILD_TYPE="Release"
|
||||
|
||||
- name: "Ubuntu 20.04 - gcc (Debug)"
|
||||
- name: "Ubuntu 20.04 - gcc-9.3 (Debug)"
|
||||
os: linux
|
||||
dist: focal
|
||||
sudo: required
|
||||
@ -58,56 +42,63 @@ matrix:
|
||||
env:
|
||||
- BUILD_TYPE="Debug"
|
||||
|
||||
- name: "Ubuntu 16.04 - gcc-5.4 with coverage"
|
||||
- name: "Ubuntu 20.04 - clang-7 (Release)"
|
||||
os: linux
|
||||
dist: xenial
|
||||
dist: focal
|
||||
sudo: required
|
||||
compiler: clang
|
||||
env:
|
||||
- BUILD_TYPE="Release"
|
||||
|
||||
- name: "Ubuntu 20.04 - clang-7 (Debug)"
|
||||
os: linux
|
||||
dist: focal
|
||||
sudo: required
|
||||
compiler: clang
|
||||
env:
|
||||
- BUILD_TYPE="Debug"
|
||||
|
||||
- name: "Ubuntu 20.04 - gcc-9.3 (Debug+Coverage)"
|
||||
os: linux
|
||||
dist: focal
|
||||
sudo: required
|
||||
compiler: gcc
|
||||
env:
|
||||
- BUILD_TYPE="Debug"
|
||||
- WITH_COVERAGE=1
|
||||
- BUILD_TYPE="Release"
|
||||
|
||||
- name: "Ubuntu 16.04 - gcc-5.4 with Valgrind"
|
||||
- name: "Ubuntu 20.04 - gcc-9.3 (Release+Valgrind)"
|
||||
os: linux
|
||||
dist: xenial
|
||||
dist: focal
|
||||
sudo: required
|
||||
compiler: gcc
|
||||
env:
|
||||
- BUILD_TYPE="Release"
|
||||
- WITH_VALGRIND=1
|
||||
- BUILD_TYPE="Release"
|
||||
|
||||
- name: "Ubuntu 16.04 - gcc-5.4 with sanitizers"
|
||||
os: linux
|
||||
dist: xenial
|
||||
sudo: required
|
||||
compiler: gcc
|
||||
env:
|
||||
- WITH_SANITIZERS=1
|
||||
- BUILD_TYPE="Release"
|
||||
#- name: "Ubuntu 20.04 - gcc-9.3 (Release+Sanitizers)"
|
||||
# os: linux
|
||||
# dist: focal
|
||||
# sudo: required
|
||||
# compiler: gcc
|
||||
# env:
|
||||
# - BUILD_TYPE="Release"
|
||||
# - WITH_SANITIZERS=1
|
||||
|
||||
- name: "Ubuntu 16.04 - CLANG 7.0 (Release)"
|
||||
os: linux
|
||||
dist: xenial
|
||||
sudo: required
|
||||
compiler: clang
|
||||
env:
|
||||
- BUILD_TYPE="Release"
|
||||
|
||||
- name: "Ubuntu 16.04 - CLANG 7.0 (Debug)"
|
||||
os: linux
|
||||
dist: xenial
|
||||
sudo: required
|
||||
compiler: clang
|
||||
env:
|
||||
- BUILD_TYPE="Debug"
|
||||
|
||||
- name: "macOS 10.14 - XCode 11.3"
|
||||
- name: "macOS 10.14 - XCode 11.3 (Release)"
|
||||
os: osx
|
||||
osx_image: xcode11.3
|
||||
compiler: clang
|
||||
env:
|
||||
- BUILD_TYPE="Release"
|
||||
|
||||
- name: "macOS 10.14 - XCode 11.3 (Debug)"
|
||||
os: osx
|
||||
osx_image: xcode11.3
|
||||
compiler: clang
|
||||
env:
|
||||
- BUILD_TYPE="Debug"
|
||||
|
||||
install: ./ci/install.sh
|
||||
script: ./ci/run.sh
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required( VERSION 3.3.2 )
|
||||
cmake_minimum_required( VERSION 3.5.0 )
|
||||
|
||||
project(exiv2 # use TWEAK to categorize the build
|
||||
VERSION 1.00.0.9 # 1.00.0 = GM (tagged and released)
|
||||
|
||||
@ -32,15 +32,6 @@ environment:
|
||||
UNIT_TESTS: 1
|
||||
WEBREADY: False
|
||||
WARNINGS_AS_ERRORS: ON
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
CMAKE_GENERATOR: Ninja
|
||||
INTEGRATION_TESTS: 0
|
||||
VS_COMPILER_VERSION: 12
|
||||
VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat
|
||||
ARCHITECTURE: x86_64
|
||||
UNIT_TESTS: 0
|
||||
WEBREADY: False
|
||||
WARNINGS_AS_ERRORS: OFF
|
||||
|
||||
shallow_clone: true
|
||||
|
||||
|
||||
@ -4,29 +4,22 @@ set -x # Prints every command
|
||||
|
||||
# This file is only used from Travis CI, where the only Linux distro used is Ubuntu
|
||||
|
||||
python --version
|
||||
python3 --version
|
||||
|
||||
if [[ "$(uname -s)" == 'Linux' ]]; then
|
||||
sudo apt-get update
|
||||
|
||||
sudo apt-get install cmake
|
||||
if [[ "$(lsb_release -cs)" == 'focal' ]]; then
|
||||
# In Ubuntu 20.04 python-pip does not exist. Furthermore we need to have the alias python for python3
|
||||
sudo apt-get install zlib1g-dev libssh-dev python3-pip python-is-python3 libxml2-utils
|
||||
else
|
||||
sudo apt-get install zlib1g-dev libssh-dev python-pip libxml2-utils
|
||||
fi
|
||||
sudo apt-get install cmake zlib1g-dev libssh-dev python3-pip libxml2-utils
|
||||
|
||||
if [ -n "$WITH_VALGRIND" ]; then
|
||||
sudo apt-get install valgrind
|
||||
fi
|
||||
sudo pip install virtualenv
|
||||
sudo pip3 install virtualenv
|
||||
virtualenv conan
|
||||
source conan/bin/activate
|
||||
pip install conan==1.30.2
|
||||
pip install codecov
|
||||
pip install lxml
|
||||
pip3 install conan==1.30.2
|
||||
pip3 install codecov
|
||||
pip3 install lxml
|
||||
else
|
||||
sudo pip3 install virtualenv
|
||||
virtualenv conan
|
||||
|
||||
45
ci/run.sh
45
ci/run.sh
@ -3,27 +3,33 @@
|
||||
set -e
|
||||
set -x
|
||||
|
||||
export CMAKE_OPTIONS="$COMMON_CMAKE_OPTIONS -DCMAKE_BUILD_TYPE=$BUILD_TYPE"
|
||||
|
||||
if [ -n "$WITH_COVERAGE" ]; then
|
||||
export CMAKE_OPTIONS="$CMAKE_OPTIONS -DBUILD_WITH_COVERAGE=ON"
|
||||
fi
|
||||
|
||||
if [ -n "$WITH_SANITIZERS" ]; then
|
||||
export CMAKE_OPTIONS="$CMAKE_OPTIONS -DEXIV2_TEAM_USE_SANITIZERS=ON"
|
||||
fi
|
||||
|
||||
if [ -n "$WITH_VALGRIND" ]; then
|
||||
export EXIV2_VALGRIND="valgrind --quiet"
|
||||
fi
|
||||
|
||||
if [[ "$(uname -s)" == 'Darwin' ]]; then
|
||||
export CMAKE_OPTIONS="$CMAKE_OPTIONS -DCMAKE_PREFIX_PATH=/usr/local/opt/gettext/"
|
||||
fi
|
||||
|
||||
|
||||
source conan/bin/activate
|
||||
|
||||
if [[ "$(uname -s)" == 'Linux' ]]; then
|
||||
if [ "$CC" == "clang" ]; then
|
||||
# clang + Ubuntu don't like to run with UBSAN, but ASAN works
|
||||
export CMAKE_OPTIONS="$COMMON_CMAKE_OPTIONS"
|
||||
elif [ -n "$WITH_VALGRIND" ]; then
|
||||
export EXIV2_VALGRIND="valgrind --quiet"
|
||||
else
|
||||
export CMAKE_OPTIONS="$COMMON_CMAKE_OPTIONS -DEXIV2_TEAM_USE_SANITIZERS=OFF"
|
||||
fi
|
||||
else
|
||||
export CMAKE_OPTIONS="$COMMON_CMAKE_OPTIONS -DEXIV2_TEAM_USE_SANITIZERS=OFF"
|
||||
fi
|
||||
CMAKE_OPTIONS="$COMMON_CMAKE_OPTIONS -DCMAKE_CXX_FLAGS=-Wno-deprecated -DCMAKE_CXX_STANDARD=98 -DCMAKE_BUILD_TYPE=$BUILD_TYPE"
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
mkdir build && cd build
|
||||
conan install .. -o webready=True --build missing
|
||||
|
||||
cmake ${CMAKE_OPTIONS} ..
|
||||
make -j
|
||||
make -j2
|
||||
|
||||
make tests
|
||||
make install
|
||||
|
||||
@ -35,6 +41,11 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pushd .
|
||||
cd bin
|
||||
$EXIV2_VALGRIND ./unit_tests
|
||||
popd
|
||||
|
||||
if [ -n "$COVERAGE" ]; then
|
||||
bash <(curl -s https://codecov.io/bash)
|
||||
fi
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
# These flags applies to exiv2lib, the applications, and to the xmp code
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN
|
||||
if (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
|
||||
set(COMPILER_IS_GCC ON)
|
||||
|
||||
@ -4,7 +4,7 @@ include(CheckCXXCompilerFlag)
|
||||
|
||||
if (COMPILER_IS_GCC OR COMPILER_IS_CLANG) # MINGW, Linux, APPLE, CYGWIN
|
||||
if ( EXIV2_TEAM_WARNINGS_AS_ERRORS )
|
||||
add_compile_options(-Werror -Wno-error=deprecated-declarations)
|
||||
add_compile_options(-Werror)
|
||||
check_cxx_compiler_flag(-Wno-error=deprecated-copy DEPRECATED_COPY)
|
||||
if ( DEPRECATED_COPY)
|
||||
add_compile_options(-Wno-error=deprecated-copy)
|
||||
|
||||
@ -44,27 +44,12 @@
|
||||
// Define if you have the <regex.h> header file.
|
||||
#cmakedefine EXV_HAVE_REGEX_H
|
||||
|
||||
// Define if have the <memory.h> header file.
|
||||
#cmakedefine EXV_HAVE_MEMORY_H
|
||||
|
||||
// Define if stdbool.h conforms to C99.
|
||||
#cmakedefine EXV_HAVE_STDBOOL_H
|
||||
|
||||
// Define if you have the <strings.h> header file.
|
||||
#cmakedefine EXV_HAVE_STRINGS_H
|
||||
|
||||
// Define if you have the mmap function.
|
||||
#cmakedefine EXV_HAVE_MMAP
|
||||
|
||||
// Define if you have the munmap function.
|
||||
#cmakedefine EXV_HAVE_MUNMAP
|
||||
|
||||
// Define if you have <sys/stat.h> header file.
|
||||
#cmakedefine EXV_HAVE_SYS_STAT_H
|
||||
|
||||
// Define if you have the <sys/types.h> header file.
|
||||
#cmakedefine EXV_HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#cmakedefine EXV_HAVE_UNISTD_H
|
||||
|
||||
@ -74,9 +59,6 @@
|
||||
// Define if you have are using the zlib library.
|
||||
#cmakedefine EXV_HAVE_LIBZ
|
||||
|
||||
// Define if you have the <process.h> header file.
|
||||
#cmakedefine EXV_HAVE_PROCESS_H
|
||||
|
||||
/* Define if you have (Exiv2/xmpsdk) Adobe XMP Toolkit. */
|
||||
#cmakedefine EXV_HAVE_XMP_TOOLKIT
|
||||
|
||||
|
||||
@ -38,13 +38,6 @@ int main() {
|
||||
return 0;
|
||||
}" EXV_STRERROR_R_CHAR_P )
|
||||
|
||||
check_include_file_cxx( "memory.h" EXV_HAVE_MEMORY_H )
|
||||
check_include_file_cxx( "process.h" EXV_HAVE_PROCESS_H )
|
||||
check_include_file_cxx( "stdbool.h" EXV_HAVE_STDBOOL_H )
|
||||
check_include_file_cxx( "strings.h" EXV_HAVE_STRINGS_H )
|
||||
check_include_file_cxx( "sys/stat.h" EXV_HAVE_SYS_STAT_H )
|
||||
check_include_file_cxx( "sys/types.h" EXV_HAVE_SYS_TYPES_H )
|
||||
check_include_file_cxx( "inttypes.h" EXV_HAVE_INTTYPES_H )
|
||||
check_include_file_cxx( "unistd.h" EXV_HAVE_UNISTD_H )
|
||||
check_include_file_cxx( "sys/mman.h" EXV_HAVE_SYS_MMAN_H )
|
||||
if ( NOT MINGW AND NOT MSYS AND NOT MSVC )
|
||||
|
||||
@ -38,8 +38,8 @@ message( STATUS "RelWithDebInfo: ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}" )
|
||||
message( STATUS "MinSizeRel: ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL}" )
|
||||
message( STATUS "" )
|
||||
message( STATUS "Compiler Options")
|
||||
OptionOutput( "Warnings as errors: " EXIV2_WARNINGS_AS_ERRORS )
|
||||
OptionOutput( "Use extra compiler warning flags: " EXIV2_EXTRA_WARNINGS )
|
||||
OptionOutput( "Warnings as errors: " EXIV2_TEAM_WARNINGS_AS_ERRORS )
|
||||
OptionOutput( "Use extra compiler warning flags: " EXIV2_TEAM_EXTRA_WARNINGS )
|
||||
message( STATUS "" )
|
||||
|
||||
message( STATUS "------------------------------------------------------------------" )
|
||||
|
||||
@ -19,7 +19,7 @@ class Exiv2Conan(ConanFile):
|
||||
def configure(self):
|
||||
self.options['libcurl'].shared = False
|
||||
self.options['libcurl'].with_openssl = True
|
||||
self.options['gtest'].shared = True
|
||||
self.options['gtest'].shared = False
|
||||
|
||||
def requirements(self):
|
||||
self.requires('zlib/1.2.11@conan/stable')
|
||||
@ -28,10 +28,7 @@ class Exiv2Conan(ConanFile):
|
||||
self.requires('libiconv/1.15@bincrafters/stable')
|
||||
|
||||
if self.options.unitTests:
|
||||
if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version.value) <= "12":
|
||||
self.requires('gtest/1.8.0@bincrafters/stable')
|
||||
else:
|
||||
self.requires('gtest/1.8.1@bincrafters/stable')
|
||||
self.requires('gtest/1.8.1@bincrafters/stable')
|
||||
|
||||
if self.options.webready and not os_info.is_macos:
|
||||
# Note: This difference in versions is just due to a combination of corner cases in the
|
||||
|
||||
@ -9,7 +9,6 @@ install(FILES
|
||||
crwimage.hpp
|
||||
datasets.hpp
|
||||
easyaccess.hpp
|
||||
epsimage.hpp
|
||||
error.hpp
|
||||
exif.hpp
|
||||
exiv2.hpp
|
||||
|
||||
@ -62,7 +62,7 @@ namespace Exiv2 {
|
||||
instance after it is passed to this method. Use the Image::io()
|
||||
method to get a temporary reference.
|
||||
*/
|
||||
AsfVideo(BasicIo::AutoPtr io);
|
||||
AsfVideo(BasicIo::UniquePtr io);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
@ -169,7 +169,7 @@ namespace Exiv2 {
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2LIB_DEPRECATED_EXPORT Image::AutoPtr newAsfInstance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2LIB_DEPRECATED_EXPORT Image::UniquePtr newAsfInstance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is a Windows Asf Video.
|
||||
EXIV2LIB_DEPRECATED_EXPORT bool isAsfType(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
#include "types.hpp"
|
||||
|
||||
// + standard includes
|
||||
#include <memory> // for std::auto_ptr
|
||||
#include <memory>
|
||||
|
||||
// The way to handle data from stdin or data uri path. If EXV_XPATH_MEMIO = 1,
|
||||
// it uses MemIo. Otherwises, it uses FileIo.
|
||||
@ -55,7 +55,7 @@ namespace Exiv2 {
|
||||
class EXIV2API BasicIo {
|
||||
public:
|
||||
//! BasicIo auto_ptr type
|
||||
typedef std::auto_ptr<BasicIo> AutoPtr;
|
||||
typedef std::unique_ptr<BasicIo> UniquePtr;
|
||||
|
||||
//! Seek starting positions
|
||||
enum Position { beg, cur, end };
|
||||
@ -521,7 +521,7 @@ namespace Exiv2 {
|
||||
|
||||
// Pimpl idiom
|
||||
class Impl;
|
||||
std::auto_ptr<Impl> p_;
|
||||
std::unique_ptr<Impl> p_;
|
||||
|
||||
}; // class FileIo
|
||||
|
||||
@ -721,7 +721,7 @@ namespace Exiv2 {
|
||||
|
||||
// Pimpl idiom
|
||||
class Impl;
|
||||
std::auto_ptr<Impl> p_;
|
||||
std::unique_ptr<Impl> p_;
|
||||
|
||||
}; // class MemIo
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ namespace Exiv2
|
||||
@param create Specifies if an existing image should be read (false)
|
||||
or if a new file should be created (true).
|
||||
*/
|
||||
BmffImage(BasicIo::AutoPtr io, bool create);
|
||||
BmffImage(BasicIo::UniquePtr io, bool create);
|
||||
//@}
|
||||
|
||||
//@{
|
||||
@ -167,7 +167,7 @@ namespace Exiv2
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2API Image::AutoPtr newBmffInstance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2API Image::UniquePtr newBmffInstance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is a BMFF image.
|
||||
EXIV2API bool isBmffType(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -73,7 +73,7 @@ namespace Exiv2 {
|
||||
instance after it is passed to this method. Use the Image::io()
|
||||
method to get a temporary reference.
|
||||
*/
|
||||
explicit BmpImage(BasicIo::AutoPtr io);
|
||||
explicit BmpImage(BasicIo::UniquePtr io);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
@ -118,7 +118,7 @@ namespace Exiv2 {
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2API Image::AutoPtr newBmpInstance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2API Image::UniquePtr newBmpInstance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is a Windows Bitmap image.
|
||||
EXIV2API bool isBmpType(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -68,7 +68,7 @@ namespace Exiv2 {
|
||||
@param create Specifies if an existing image should be read (false)
|
||||
or if a new file should be created (true).
|
||||
*/
|
||||
Cr2Image(BasicIo::AutoPtr io, bool create);
|
||||
Cr2Image(BasicIo::UniquePtr io, bool create);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
@ -152,7 +152,7 @@ namespace Exiv2 {
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2API Image::AutoPtr newCr2Instance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2API Image::UniquePtr newCr2Instance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is a CR2 image.
|
||||
EXIV2API bool isCr2Type(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -75,7 +75,7 @@ namespace Exiv2 {
|
||||
@param create Specifies if an existing image should be read (false)
|
||||
or if a new file should be created (true).
|
||||
*/
|
||||
CrwImage(BasicIo::AutoPtr io, bool create);
|
||||
CrwImage(BasicIo::UniquePtr io, bool create);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
@ -161,7 +161,7 @@ namespace Exiv2 {
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2API Image::AutoPtr newCrwInstance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2API Image::UniquePtr newCrwInstance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is a CRW image.
|
||||
EXIV2API bool isCrwType(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -275,7 +275,7 @@ namespace Exiv2 {
|
||||
class EXIV2API IptcKey : public Key {
|
||||
public:
|
||||
//! Shortcut for an %IptcKey auto pointer.
|
||||
typedef std::auto_ptr<IptcKey> AutoPtr;
|
||||
typedef std::unique_ptr<IptcKey> UniquePtr;
|
||||
|
||||
//! @name Creators
|
||||
//@{
|
||||
@ -320,7 +320,7 @@ namespace Exiv2 {
|
||||
virtual std::string tagName() const;
|
||||
virtual std::string tagLabel() const;
|
||||
virtual uint16_t tag() const;
|
||||
AutoPtr clone() const;
|
||||
UniquePtr clone() const;
|
||||
//! Return the name of the record
|
||||
std::string recordName() const;
|
||||
//! Return the record id
|
||||
|
||||
@ -1,124 +0,0 @@
|
||||
// ***************************************************************** -*- 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.
|
||||
*/
|
||||
/*!
|
||||
@file epsimage.hpp
|
||||
@brief EPS image.
|
||||
<br>References:
|
||||
<br>[1] <a href="http://partners.adobe.com/public/developer/en/ps/5001.DSC_Spec.pdf">Adobe PostScript Language Document Structuring Conventions Specification, Version 3.0</a>, September 1992
|
||||
<br>[2] <a href="http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf">Adobe Encapsulated PostScript File Format Specification, Version 3.0</a>, May 1992
|
||||
<br>[3] <a href="http://www.adobe.com/content/dam/Adobe/en/devnet/xmp/pdfs/XMPSpecificationPart3.pdf">Adobe XMP Specification Part 3: Storage in Files</a>, July 2010
|
||||
<br>[4] <a href="http://groups.google.com/group/adobe.illustrator.windows/msg/0a9d7b1244b59062">Re: Thumbnail data format in ai file</a>, Dec 2003
|
||||
@author Michael Ulbrich (mul)
|
||||
<a href="mailto:mul@rentapacs.de">mul@rentapacs.de</a>
|
||||
@author Volker Grabsch (vog)
|
||||
<a href="mailto:vog@notjusthosting.com">vog@notjusthosting.com</a>
|
||||
@date 7-Mar-2011, vog: created
|
||||
*/
|
||||
#ifndef EPSIMAGE_HPP_
|
||||
#define EPSIMAGE_HPP_
|
||||
|
||||
// *****************************************************************************
|
||||
#include "exiv2lib_export.h"
|
||||
|
||||
// included header files
|
||||
#include "image.hpp"
|
||||
|
||||
// *****************************************************************************
|
||||
// namespace extensions
|
||||
namespace Exiv2
|
||||
{
|
||||
|
||||
// *****************************************************************************
|
||||
// class definitions
|
||||
|
||||
// Add EPS to the supported image formats
|
||||
namespace ImageType {
|
||||
const int eps = 18; //!< EPS image type
|
||||
}
|
||||
|
||||
/*!
|
||||
@brief Class to access EPS images.
|
||||
*/
|
||||
class EXIV2LIB_DEPRECATED_EXPORT EpsImage : public Image {
|
||||
public:
|
||||
//! @name Creators
|
||||
//@{
|
||||
/*!
|
||||
@brief Constructor to open a EPS image. Since the
|
||||
constructor can't return a result, callers should check the
|
||||
good() method after object construction to determine success
|
||||
or failure.
|
||||
@param io An auto-pointer that owns a BasicIo instance used for
|
||||
reading and writing image metadata. \b Important: The constructor
|
||||
takes ownership of the passed in BasicIo instance through the
|
||||
auto-pointer. Callers should not continue to use the BasicIo
|
||||
instance after it is passed to this method. Use the Image::io()
|
||||
method to get a temporary reference.
|
||||
@param create Specifies if an existing image should be read (false)
|
||||
or if a new file should be created (true).
|
||||
*/
|
||||
EpsImage(BasicIo::AutoPtr io, bool create);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
void readMetadata();
|
||||
void writeMetadata();
|
||||
/*!
|
||||
@brief Not supported.
|
||||
Calling this function will throw an instance of Error(kerInvalidSettingForImage).
|
||||
*/
|
||||
void setComment(const std::string& comment);
|
||||
//@}
|
||||
|
||||
//! @name Accessors
|
||||
//@{
|
||||
std::string mimeType() const;
|
||||
//@}
|
||||
|
||||
private:
|
||||
//! @name NOT Implemented
|
||||
//@{
|
||||
//! Copy constructor
|
||||
EpsImage(const EpsImage& rhs);
|
||||
//! Assignment operator
|
||||
EpsImage& operator=(const EpsImage& rhs);
|
||||
//@}
|
||||
|
||||
}; // class EpsImage
|
||||
|
||||
// *****************************************************************************
|
||||
// template, inline and free functions
|
||||
|
||||
// These could be static private functions on Image subclasses but then
|
||||
// ImageFactory needs to be made a friend.
|
||||
/*!
|
||||
@brief Create a new EpsImage instance and return an auto-pointer to it.
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2LIB_DEPRECATED_EXPORT Image::AutoPtr newEpsInstance(BasicIo::AutoPtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is a EPS image.
|
||||
EXIV2LIB_DEPRECATED_EXPORT bool isEpsType(BasicIo& iIo, bool advance);
|
||||
|
||||
} // namespace Exiv2
|
||||
|
||||
#endif // #ifndef EPSIMAGE_HPP_
|
||||
@ -192,7 +192,7 @@ namespace Exiv2 {
|
||||
long toLong(long n =0) const;
|
||||
float toFloat(long n =0) const;
|
||||
Rational toRational(long n =0) const;
|
||||
Value::AutoPtr getValue() const;
|
||||
Value::UniquePtr getValue() const;
|
||||
const Value& value() const;
|
||||
//! Return the size of the data area.
|
||||
long sizeDataArea() const;
|
||||
@ -213,8 +213,8 @@ namespace Exiv2 {
|
||||
|
||||
private:
|
||||
// DATA
|
||||
ExifKey::AutoPtr key_; //!< Key
|
||||
Value::AutoPtr value_; //!< Value
|
||||
ExifKey::UniquePtr key_; //!< Key
|
||||
Value::UniquePtr value_; //!< Value
|
||||
|
||||
}; // class Exifdatum
|
||||
|
||||
|
||||
@ -30,7 +30,6 @@
|
||||
#include "exiv2/cr2image.hpp"
|
||||
#include "exiv2/crwimage.hpp"
|
||||
#include "exiv2/easyaccess.hpp"
|
||||
#include "exiv2/epsimage.hpp"
|
||||
#include "exiv2/error.hpp"
|
||||
#include "exiv2/exif.hpp"
|
||||
#include "exiv2/futils.hpp"
|
||||
|
||||
@ -66,7 +66,7 @@ namespace Exiv2 {
|
||||
instance after it is passed to this method. Use the Image::io()
|
||||
method to get a temporary reference.
|
||||
*/
|
||||
explicit GifImage(BasicIo::AutoPtr io);
|
||||
explicit GifImage(BasicIo::UniquePtr io);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
@ -111,7 +111,7 @@ namespace Exiv2 {
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2API Image::AutoPtr newGifInstance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2API Image::UniquePtr newGifInstance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is a GIF image.
|
||||
EXIV2API bool isGifType(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -78,7 +78,7 @@ namespace Exiv2 {
|
||||
class EXIV2API Image {
|
||||
public:
|
||||
//! Image auto_ptr type
|
||||
typedef std::auto_ptr<Image> AutoPtr;
|
||||
typedef std::unique_ptr<Image> UniquePtr;
|
||||
|
||||
//! @name Creators
|
||||
//@{
|
||||
@ -89,7 +89,7 @@ namespace Exiv2 {
|
||||
*/
|
||||
Image(int imageType,
|
||||
uint16_t supportedMetadata,
|
||||
BasicIo::AutoPtr io);
|
||||
BasicIo::UniquePtr io);
|
||||
//! Virtual Destructor
|
||||
virtual ~Image();
|
||||
//@}
|
||||
@ -481,7 +481,7 @@ namespace Exiv2 {
|
||||
|
||||
protected:
|
||||
// DATA
|
||||
BasicIo::AutoPtr io_; //!< Image data IO pointer
|
||||
BasicIo::UniquePtr io_; //!< Image data IO pointer
|
||||
ExifData exifData_; //!< Exif data container
|
||||
IptcData iptcData_; //!< IPTC data container
|
||||
XmpData xmpData_; //!< XMP data container
|
||||
@ -519,7 +519,7 @@ namespace Exiv2 {
|
||||
}; // class Image
|
||||
|
||||
//! Type for function pointer that creates new Image instances
|
||||
typedef Image::AutoPtr (*NewInstanceFct)(BasicIo::AutoPtr io, bool create);
|
||||
typedef Image::UniquePtr (*NewInstanceFct)(BasicIo::UniquePtr io, bool create);
|
||||
//! Type for function pointer that checks image types
|
||||
typedef bool (*IsThisTypeFct)(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -545,13 +545,13 @@ namespace Exiv2 {
|
||||
@throw Error If the file is not found or it is unable to connect to the server to
|
||||
read the remote file.
|
||||
*/
|
||||
static BasicIo::AutoPtr createIo(const std::string& path, bool useCurl = true);
|
||||
static BasicIo::UniquePtr createIo(const std::string& path, bool useCurl = true);
|
||||
#ifdef EXV_UNICODE_PATH
|
||||
/*!
|
||||
@brief Like createIo() but accepts a unicode path in an std::wstring.
|
||||
@note This function is only available on Windows.
|
||||
*/
|
||||
static BasicIo::AutoPtr createIo(const std::wstring& wpath, bool useCurl = true);
|
||||
static BasicIo::UniquePtr createIo(const std::wstring& wpath, bool useCurl = true);
|
||||
#endif
|
||||
/*!
|
||||
@brief Create an Image subclass of the appropriate type by reading
|
||||
@ -566,13 +566,13 @@ namespace Exiv2 {
|
||||
@throw Error If opening the file fails or it contains data of an
|
||||
unknown image type.
|
||||
*/
|
||||
static Image::AutoPtr open(const std::string& path, bool useCurl = true);
|
||||
static Image::UniquePtr open(const std::string& path, bool useCurl = true);
|
||||
#ifdef EXV_UNICODE_PATH
|
||||
/*!
|
||||
@brief Like open() but accepts a unicode path in an std::wstring.
|
||||
@note This function is only available on Windows.
|
||||
*/
|
||||
static Image::AutoPtr open(const std::wstring& wpath, bool useCurl = true);
|
||||
static Image::UniquePtr open(const std::wstring& wpath, bool useCurl = true);
|
||||
#endif
|
||||
/*!
|
||||
@brief Create an Image subclass of the appropriate type by reading
|
||||
@ -585,7 +585,7 @@ namespace Exiv2 {
|
||||
matches that of the data buffer.
|
||||
@throw Error If the memory contains data of an unknown image type.
|
||||
*/
|
||||
static Image::AutoPtr open(const byte* data, long size);
|
||||
static Image::UniquePtr open(const byte* data, long size);
|
||||
/*!
|
||||
@brief Create an Image subclass of the appropriate type by reading
|
||||
the provided BasicIo instance. %Image type is derived from the
|
||||
@ -603,7 +603,7 @@ namespace Exiv2 {
|
||||
determined, the pointer is 0.
|
||||
@throw Error If opening the BasicIo fails
|
||||
*/
|
||||
static Image::AutoPtr open(BasicIo::AutoPtr io);
|
||||
static Image::UniquePtr open(BasicIo::UniquePtr io);
|
||||
/*!
|
||||
@brief Create an Image subclass of the requested type by creating a
|
||||
new image file. If the file already exists, it will be overwritten.
|
||||
@ -613,13 +613,13 @@ namespace Exiv2 {
|
||||
type.
|
||||
@throw Error If the image type is not supported.
|
||||
*/
|
||||
static Image::AutoPtr create(int type, const std::string& path);
|
||||
static Image::UniquePtr create(int type, const std::string& path);
|
||||
#ifdef EXV_UNICODE_PATH
|
||||
/*!
|
||||
@brief Like create() but accepts a unicode path in an std::wstring.
|
||||
@note This function is only available on Windows.
|
||||
*/
|
||||
static Image::AutoPtr create(int type, const std::wstring& wpath);
|
||||
static Image::UniquePtr create(int type, const std::wstring& wpath);
|
||||
#endif
|
||||
/*!
|
||||
@brief Create an Image subclass of the requested type by creating a
|
||||
@ -629,7 +629,7 @@ namespace Exiv2 {
|
||||
type.
|
||||
@throw Error If the image type is not supported
|
||||
*/
|
||||
static Image::AutoPtr create(int type);
|
||||
static Image::UniquePtr create(int type);
|
||||
/*!
|
||||
@brief Create an Image subclass of the requested type by writing a
|
||||
new image to a BasicIo instance. If the BasicIo instance already
|
||||
@ -644,7 +644,7 @@ namespace Exiv2 {
|
||||
@return An auto-pointer that owns an Image instance of the requested
|
||||
type. If the image type is not supported, the pointer is 0.
|
||||
*/
|
||||
static Image::AutoPtr create(int type, BasicIo::AutoPtr io);
|
||||
static Image::UniquePtr create(int type, BasicIo::UniquePtr io);
|
||||
/*!
|
||||
@brief Returns the image type of the provided file.
|
||||
@param path %Image file. The contents of the file are tested to
|
||||
|
||||
@ -142,14 +142,14 @@ namespace Exiv2 {
|
||||
long toLong(long n =0) const;
|
||||
float toFloat(long n =0) const;
|
||||
Rational toRational(long n =0) const;
|
||||
Value::AutoPtr getValue() const;
|
||||
Value::UniquePtr getValue() const;
|
||||
const Value& value() const;
|
||||
//@}
|
||||
|
||||
private:
|
||||
// DATA
|
||||
IptcKey::AutoPtr key_; //!< Key
|
||||
Value::AutoPtr value_; //!< Value
|
||||
IptcKey::UniquePtr key_; //!< Key
|
||||
Value::UniquePtr value_; //!< Value
|
||||
|
||||
}; // class Iptcdatum
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ namespace Exiv2
|
||||
@param create Specifies if an existing image should be read (false)
|
||||
or if a new file should be created (true).
|
||||
*/
|
||||
Jp2Image(BasicIo::AutoPtr io, bool create);
|
||||
Jp2Image(BasicIo::UniquePtr io, bool create);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
@ -130,7 +130,7 @@ namespace Exiv2
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2API Image::AutoPtr newJp2Instance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2API Image::UniquePtr newJp2Instance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is a JPEG-2000 image.
|
||||
EXIV2API bool isJp2Type(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -167,7 +167,7 @@ namespace Exiv2 {
|
||||
@param dataSize Size of initData in bytes.
|
||||
*/
|
||||
JpegBase(int type,
|
||||
BasicIo::AutoPtr io,
|
||||
BasicIo::UniquePtr io,
|
||||
bool create,
|
||||
const byte initData[],
|
||||
long dataSize);
|
||||
@ -306,7 +306,7 @@ namespace Exiv2 {
|
||||
@param create Specifies if an existing image should be read (false)
|
||||
or if a new file should be created (true).
|
||||
*/
|
||||
JpegImage(BasicIo::AutoPtr io, bool create);
|
||||
JpegImage(BasicIo::UniquePtr io, bool create);
|
||||
//@}
|
||||
//! @name Accessors
|
||||
//@{
|
||||
@ -367,7 +367,7 @@ namespace Exiv2 {
|
||||
@param create Specifies if an existing image should be read (false)
|
||||
or if a new file should be created (true).
|
||||
*/
|
||||
ExvImage(BasicIo::AutoPtr io, bool create);
|
||||
ExvImage(BasicIo::UniquePtr io, bool create);
|
||||
//@}
|
||||
//! @name Accessors
|
||||
//@{
|
||||
@ -409,7 +409,7 @@ namespace Exiv2 {
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2API Image::AutoPtr newJpegInstance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2API Image::UniquePtr newJpegInstance(BasicIo::UniquePtr io, bool create);
|
||||
//! Check if the file iIo is a JPEG image.
|
||||
EXIV2API bool isJpegType(BasicIo& iIo, bool advance);
|
||||
/*!
|
||||
@ -417,7 +417,7 @@ namespace Exiv2 {
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2API Image::AutoPtr newExvInstance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2API Image::UniquePtr newExvInstance(BasicIo::UniquePtr io, bool create);
|
||||
//! Check if the file iIo is an EXV file
|
||||
EXIV2API bool isExvType(BasicIo& iIo, bool advance);
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ namespace Exiv2 {
|
||||
instance after it is passed to this method. Use the Image::io()
|
||||
method to get a temporary reference.
|
||||
*/
|
||||
MatroskaVideo(BasicIo::AutoPtr io);
|
||||
MatroskaVideo(BasicIo::UniquePtr io);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
@ -138,7 +138,7 @@ namespace Exiv2 {
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2LIB_DEPRECATED_EXPORT Image::AutoPtr newMkvInstance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2LIB_DEPRECATED_EXPORT Image::UniquePtr newMkvInstance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is a Matroska Video.
|
||||
EXIV2LIB_DEPRECATED_EXPORT bool isMkvType(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -44,7 +44,7 @@ namespace Exiv2 {
|
||||
class EXIV2API Key {
|
||||
public:
|
||||
//! Shortcut for a %Key auto pointer.
|
||||
typedef std::auto_ptr<Key> AutoPtr;
|
||||
typedef std::unique_ptr<Key> UniquePtr;
|
||||
|
||||
//! @name Creators
|
||||
//@{
|
||||
@ -76,7 +76,7 @@ namespace Exiv2 {
|
||||
The caller owns this copy and the auto-pointer ensures that it
|
||||
will be deleted.
|
||||
*/
|
||||
AutoPtr clone() const;
|
||||
UniquePtr clone() const;
|
||||
/*!
|
||||
@brief Write the key to an output stream. You do not usually have
|
||||
to use this function; it is used for the implementation of
|
||||
@ -251,7 +251,7 @@ namespace Exiv2 {
|
||||
@return An auto-pointer containing a pointer to a copy (clone) of the
|
||||
value, 0 if the value is not set.
|
||||
*/
|
||||
virtual Value::AutoPtr getValue() const =0;
|
||||
virtual Value::UniquePtr getValue() const =0;
|
||||
/*!
|
||||
@brief Return a constant reference to the value.
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ namespace Exiv2 {
|
||||
@param create Specifies if an existing image should be read (false)
|
||||
or if a new file should be created (true).
|
||||
*/
|
||||
MrwImage(BasicIo::AutoPtr io, bool create);
|
||||
MrwImage(BasicIo::UniquePtr io, bool create);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
@ -117,7 +117,7 @@ namespace Exiv2 {
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2API Image::AutoPtr newMrwInstance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2API Image::UniquePtr newMrwInstance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is a MRW image.
|
||||
EXIV2API bool isMrwType(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -61,7 +61,7 @@ namespace Exiv2 {
|
||||
@param create Specifies if an existing image should be read (false)
|
||||
or if a new file should be created (true).
|
||||
*/
|
||||
OrfImage(BasicIo::AutoPtr io, bool create);
|
||||
OrfImage(BasicIo::UniquePtr io, bool create);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
@ -138,7 +138,7 @@ namespace Exiv2 {
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2API Image::AutoPtr newOrfInstance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2API Image::UniquePtr newOrfInstance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is an ORF image.
|
||||
EXIV2API bool isOrfType(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -63,7 +63,7 @@ namespace Exiv2
|
||||
@param create Specifies if an existing image should be read (false)
|
||||
or if a new file should be created (true).
|
||||
*/
|
||||
PgfImage(BasicIo::AutoPtr io, bool create);
|
||||
PgfImage(BasicIo::UniquePtr io, bool create);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
@ -113,7 +113,7 @@ namespace Exiv2
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2API Image::AutoPtr newPgfInstance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2API Image::UniquePtr newPgfInstance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is a PGF image.
|
||||
EXIV2API bool isPgfType(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -63,7 +63,7 @@ namespace Exiv2
|
||||
@param create Specifies if an existing image should be read (false)
|
||||
or if a new file should be created (true).
|
||||
*/
|
||||
PngImage(BasicIo::AutoPtr io, bool create);
|
||||
PngImage(BasicIo::UniquePtr io, bool create);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
@ -116,7 +116,7 @@ namespace Exiv2
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2API Image::AutoPtr newPngInstance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2API Image::UniquePtr newPngInstance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is a PNG image.
|
||||
EXIV2API bool isPngType(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -231,7 +231,7 @@ namespace Exiv2 {
|
||||
{
|
||||
public:
|
||||
//! Shortcut for an %XmpKey auto pointer.
|
||||
typedef std::auto_ptr<XmpKey> AutoPtr;
|
||||
typedef std::unique_ptr<XmpKey> UniquePtr;
|
||||
|
||||
//! @name Creators
|
||||
//@{
|
||||
@ -280,7 +280,7 @@ namespace Exiv2 {
|
||||
//! Properties don't have a tag number. Return 0.
|
||||
virtual uint16_t tag() const;
|
||||
|
||||
AutoPtr clone() const;
|
||||
UniquePtr clone() const;
|
||||
|
||||
// Todo: Should this be removed? What about tagLabel then?
|
||||
//! Return the schema namespace for the prefix of the key
|
||||
@ -294,7 +294,7 @@ namespace Exiv2 {
|
||||
private:
|
||||
// Pimpl idiom
|
||||
struct Impl;
|
||||
std::auto_ptr<Impl> p_;
|
||||
std::unique_ptr<Impl> p_;
|
||||
|
||||
}; // class XmpKey
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ namespace Exiv2 {
|
||||
instance after it is passed to this method. Use the Image::io()
|
||||
method to get a temporary reference.
|
||||
*/
|
||||
explicit PsdImage(BasicIo::AutoPtr io);
|
||||
explicit PsdImage(BasicIo::UniquePtr io);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
@ -127,7 +127,7 @@ namespace Exiv2 {
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2API Image::AutoPtr newPsdInstance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2API Image::UniquePtr newPsdInstance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is a Photoshop image.
|
||||
EXIV2API bool isPsdType(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -58,7 +58,7 @@ namespace Exiv2 {
|
||||
instance after it is passed to this method. Use the Image::io()
|
||||
method to get a temporary reference.
|
||||
*/
|
||||
QuickTimeVideo(BasicIo::AutoPtr io);
|
||||
QuickTimeVideo(BasicIo::UniquePtr io);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
@ -235,7 +235,7 @@ namespace Exiv2 {
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2LIB_DEPRECATED_EXPORT Image::AutoPtr newQTimeInstance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2LIB_DEPRECATED_EXPORT Image::UniquePtr newQTimeInstance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is a Quick Time Video.
|
||||
EXIV2LIB_DEPRECATED_EXPORT bool isQTimeType(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -66,7 +66,7 @@ namespace Exiv2 {
|
||||
@param create Specifies if an existing image should be read (false)
|
||||
or if a new file should be created (true).
|
||||
*/
|
||||
RafImage(BasicIo::AutoPtr io, bool create);
|
||||
RafImage(BasicIo::UniquePtr io, bool create);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
@ -123,7 +123,7 @@ namespace Exiv2 {
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2API Image::AutoPtr newRafInstance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2API Image::UniquePtr newRafInstance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is a RAF image.
|
||||
EXIV2API bool isRafType(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -58,7 +58,7 @@ namespace Exiv2 {
|
||||
instance after it is passed to this method. Use the Image::io()
|
||||
method to get a temporary reference.
|
||||
*/
|
||||
RiffVideo(BasicIo::AutoPtr io);
|
||||
RiffVideo(BasicIo::UniquePtr io);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
@ -203,7 +203,7 @@ namespace Exiv2 {
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2LIB_DEPRECATED_EXPORT Image::AutoPtr newRiffInstance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2LIB_DEPRECATED_EXPORT Image::UniquePtr newRiffInstance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is a Riff Video.
|
||||
EXIV2LIB_DEPRECATED_EXPORT bool isRiffType(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -59,7 +59,7 @@ namespace Exiv2 {
|
||||
instance after it is passed to this method. Use the Image::io()
|
||||
method to get a temporary reference.
|
||||
*/
|
||||
explicit Rw2Image(BasicIo::AutoPtr io);
|
||||
explicit Rw2Image(BasicIo::UniquePtr io);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
@ -138,7 +138,7 @@ namespace Exiv2 {
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2API Image::AutoPtr newRw2Instance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2API Image::UniquePtr newRw2Instance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is a RW2 image.
|
||||
EXIV2API bool isRw2Type(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -140,7 +140,7 @@ namespace Exiv2 {
|
||||
class EXIV2API ExifKey : public Key {
|
||||
public:
|
||||
//! Shortcut for an %ExifKey auto pointer.
|
||||
typedef std::auto_ptr<ExifKey> AutoPtr;
|
||||
typedef std::unique_ptr<ExifKey> UniquePtr;
|
||||
|
||||
//! @name Creators
|
||||
//@{
|
||||
@ -202,7 +202,7 @@ namespace Exiv2 {
|
||||
//! Return the default type id for this tag.
|
||||
TypeId defaultTypeId() const; // Todo: should be in the base class
|
||||
|
||||
AutoPtr clone() const;
|
||||
UniquePtr clone() const;
|
||||
//! Return the index (unique id of this key within the original Exif data, 0 if not set)
|
||||
int idx() const;
|
||||
//@}
|
||||
@ -214,7 +214,7 @@ namespace Exiv2 {
|
||||
private:
|
||||
// Pimpl idiom
|
||||
struct Impl;
|
||||
std::auto_ptr<Impl> p_;
|
||||
std::unique_ptr<Impl> p_;
|
||||
|
||||
}; // class ExifKey
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ namespace Exiv2 {
|
||||
instance after it is passed to this method. Use the Image::io()
|
||||
method to get a temporary reference.
|
||||
*/
|
||||
explicit TgaImage(BasicIo::AutoPtr io);
|
||||
explicit TgaImage(BasicIo::UniquePtr io);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
@ -111,7 +111,7 @@ namespace Exiv2 {
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2API Image::AutoPtr newTgaInstance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2API Image::UniquePtr newTgaInstance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is a Targa v2 image.
|
||||
EXIV2API bool isTgaType(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -68,7 +68,7 @@ namespace Exiv2 {
|
||||
@param create Specifies if an existing image should be read (false)
|
||||
or if a new file should be created (true).
|
||||
*/
|
||||
TiffImage(BasicIo::AutoPtr io, bool create);
|
||||
TiffImage(BasicIo::UniquePtr io, bool create);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
@ -204,7 +204,7 @@ namespace Exiv2 {
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2API Image::AutoPtr newTiffInstance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2API Image::UniquePtr newTiffInstance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is a TIFF image.
|
||||
EXIV2API bool isTiffType(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -174,7 +174,7 @@ namespace Exiv2 {
|
||||
|
||||
/*!
|
||||
@brief Auxiliary type to enable copies and assignments, similar to
|
||||
std::auto_ptr_ref. See http://www.josuttis.com/libbook/auto_ptr.html
|
||||
std::unique_ptr_ref. See http://www.josuttis.com/libbook/auto_ptr.html
|
||||
for a discussion.
|
||||
*/
|
||||
struct EXIV2API DataBufRef {
|
||||
@ -202,7 +202,7 @@ namespace Exiv2 {
|
||||
DataBuf(const byte* pData, long size);
|
||||
/*!
|
||||
@brief Copy constructor. Transfers the buffer to the newly created
|
||||
object similar to std::auto_ptr, i.e., the original object is
|
||||
object similar to std::unique_ptr, i.e., the original object is
|
||||
modified.
|
||||
*/
|
||||
DataBuf(DataBuf& rhs);
|
||||
@ -214,7 +214,7 @@ namespace Exiv2 {
|
||||
//@{
|
||||
/*!
|
||||
@brief Assignment operator. Transfers the buffer and releases the
|
||||
buffer at the original object similar to std::auto_ptr, i.e.,
|
||||
buffer at the original object similar to std::unique_ptr, i.e.,
|
||||
the original object is modified.
|
||||
*/
|
||||
DataBuf& operator=(DataBuf& rhs);
|
||||
@ -244,7 +244,7 @@ namespace Exiv2 {
|
||||
@name Conversions
|
||||
|
||||
Special conversions with auxiliary type to enable copies
|
||||
and assignments, similar to those used for std::auto_ptr.
|
||||
and assignments, similar to those used for std::unique_ptr.
|
||||
See http://www.josuttis.com/libbook/auto_ptr.html for a discussion.
|
||||
*/
|
||||
//@{
|
||||
|
||||
@ -51,7 +51,7 @@ namespace Exiv2 {
|
||||
class EXIV2API Value {
|
||||
public:
|
||||
//! Shortcut for a %Value auto pointer.
|
||||
typedef std::auto_ptr<Value> AutoPtr;
|
||||
typedef std::unique_ptr<Value> UniquePtr;
|
||||
|
||||
//! @name Creators
|
||||
//@{
|
||||
@ -107,7 +107,7 @@ namespace Exiv2 {
|
||||
The caller owns this copy and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
AutoPtr clone() const { return AutoPtr(clone_()); }
|
||||
UniquePtr clone() const { return UniquePtr(clone_()); }
|
||||
/*!
|
||||
@brief Write value to a data buffer.
|
||||
|
||||
@ -224,7 +224,7 @@ namespace Exiv2 {
|
||||
@return Auto-pointer to the newly created Value. The caller owns this
|
||||
copy and the auto-pointer ensures that it will be deleted.
|
||||
*/
|
||||
static AutoPtr create(TypeId typeId);
|
||||
static UniquePtr create(TypeId typeId);
|
||||
|
||||
protected:
|
||||
/*!
|
||||
@ -253,7 +253,7 @@ namespace Exiv2 {
|
||||
class EXIV2API DataValue : public Value {
|
||||
public:
|
||||
//! Shortcut for a %DataValue auto pointer.
|
||||
typedef std::auto_ptr<DataValue> AutoPtr;
|
||||
typedef std::unique_ptr<DataValue> UniquePtr;
|
||||
|
||||
explicit DataValue(TypeId typeId =undefined);
|
||||
|
||||
@ -286,7 +286,7 @@ namespace Exiv2 {
|
||||
|
||||
//! @name Accessors
|
||||
//@{
|
||||
AutoPtr clone() const { return AutoPtr(clone_()); }
|
||||
UniquePtr clone() const { return UniquePtr(clone_()); }
|
||||
/*!
|
||||
@brief Write value to a character data buffer.
|
||||
|
||||
@ -335,7 +335,7 @@ namespace Exiv2 {
|
||||
class EXIV2API StringValueBase : public Value {
|
||||
public:
|
||||
//! Shortcut for a %StringValueBase auto pointer.
|
||||
typedef std::auto_ptr<StringValueBase> AutoPtr;
|
||||
typedef std::unique_ptr<StringValueBase> UniquePtr;
|
||||
|
||||
//! @name Creators
|
||||
//@{
|
||||
@ -372,7 +372,7 @@ namespace Exiv2 {
|
||||
|
||||
//! @name Accessors
|
||||
//@{
|
||||
AutoPtr clone() const { return AutoPtr(clone_()); }
|
||||
UniquePtr clone() const { return UniquePtr(clone_()); }
|
||||
/*!
|
||||
@brief Write value to a character data buffer.
|
||||
|
||||
@ -417,7 +417,7 @@ namespace Exiv2 {
|
||||
class EXIV2API StringValue : public StringValueBase {
|
||||
public:
|
||||
//! Shortcut for a %StringValue auto pointer.
|
||||
typedef std::auto_ptr<StringValue> AutoPtr;
|
||||
typedef std::unique_ptr<StringValue> UniquePtr;
|
||||
|
||||
//! @name Creators
|
||||
//@{
|
||||
@ -431,7 +431,7 @@ namespace Exiv2 {
|
||||
|
||||
//! @name Accessors
|
||||
//@{
|
||||
AutoPtr clone() const { return AutoPtr(clone_()); }
|
||||
UniquePtr clone() const { return UniquePtr(clone_()); }
|
||||
//@}
|
||||
|
||||
private:
|
||||
@ -449,7 +449,7 @@ namespace Exiv2 {
|
||||
class EXIV2API AsciiValue : public StringValueBase {
|
||||
public:
|
||||
//! Shortcut for a %AsciiValue auto pointer.
|
||||
typedef std::auto_ptr<AsciiValue> AutoPtr;
|
||||
typedef std::unique_ptr<AsciiValue> UniquePtr;
|
||||
|
||||
//! @name Creators
|
||||
//@{
|
||||
@ -474,7 +474,7 @@ namespace Exiv2 {
|
||||
|
||||
//! @name Accessors
|
||||
//@{
|
||||
AutoPtr clone() const { return AutoPtr(clone_()); }
|
||||
UniquePtr clone() const { return UniquePtr(clone_()); }
|
||||
/*!
|
||||
@brief Write the ASCII value up to the the first '\\0' character to an
|
||||
output stream. Any further characters are ignored and not
|
||||
@ -537,7 +537,7 @@ namespace Exiv2 {
|
||||
}; // class CharsetInfo
|
||||
|
||||
//! Shortcut for a %CommentValue auto pointer.
|
||||
typedef std::auto_ptr<CommentValue> AutoPtr;
|
||||
typedef std::unique_ptr<CommentValue> UniquePtr;
|
||||
|
||||
//! @name Creators
|
||||
//@{
|
||||
@ -572,7 +572,7 @@ namespace Exiv2 {
|
||||
|
||||
//! @name Accessors
|
||||
//@{
|
||||
AutoPtr clone() const { return AutoPtr(clone_()); }
|
||||
UniquePtr clone() const { return UniquePtr(clone_()); }
|
||||
long copy(byte* buf, ByteOrder byteOrder) const;
|
||||
/*!
|
||||
@brief Write the comment in a format which can be read by
|
||||
@ -624,7 +624,7 @@ namespace Exiv2 {
|
||||
class EXIV2API XmpValue : public Value {
|
||||
public:
|
||||
//! Shortcut for a %XmpValue auto pointer.
|
||||
typedef std::auto_ptr<XmpValue> AutoPtr;
|
||||
typedef std::unique_ptr<XmpValue> UniquePtr;
|
||||
|
||||
//! XMP array types.
|
||||
enum XmpArrayType { xaNone, xaAlt, xaBag, xaSeq };
|
||||
@ -715,7 +715,7 @@ namespace Exiv2 {
|
||||
class EXIV2API XmpTextValue : public XmpValue {
|
||||
public:
|
||||
//! Shortcut for a %XmpTextValue auto pointer.
|
||||
typedef std::auto_ptr<XmpTextValue> AutoPtr;
|
||||
typedef std::unique_ptr<XmpTextValue> UniquePtr;
|
||||
|
||||
//! @name Creators
|
||||
//@{
|
||||
@ -748,7 +748,7 @@ namespace Exiv2 {
|
||||
|
||||
//! @name Accessors
|
||||
//@{
|
||||
AutoPtr clone() const;
|
||||
UniquePtr clone() const;
|
||||
long size() const;
|
||||
virtual long count() const;
|
||||
/*!
|
||||
@ -797,7 +797,7 @@ namespace Exiv2 {
|
||||
class EXIV2API XmpArrayValue : public XmpValue {
|
||||
public:
|
||||
//! Shortcut for a %XmpArrayValue auto pointer.
|
||||
typedef std::auto_ptr<XmpArrayValue> AutoPtr;
|
||||
typedef std::unique_ptr<XmpArrayValue> UniquePtr;
|
||||
|
||||
//! @name Creators
|
||||
//@{
|
||||
@ -823,7 +823,7 @@ namespace Exiv2 {
|
||||
|
||||
//! @name Accessors
|
||||
//@{
|
||||
AutoPtr clone() const;
|
||||
UniquePtr clone() const;
|
||||
virtual long count() const;
|
||||
/*!
|
||||
@brief Return the <EM>n</EM>-th component of the value as a string.
|
||||
@ -890,7 +890,7 @@ namespace Exiv2 {
|
||||
class EXIV2API LangAltValue : public XmpValue {
|
||||
public:
|
||||
//! Shortcut for a %LangAltValue auto pointer.
|
||||
typedef std::auto_ptr<LangAltValue> AutoPtr;
|
||||
typedef std::unique_ptr<LangAltValue> UniquePtr;
|
||||
|
||||
//! @name Creators
|
||||
//@{
|
||||
@ -925,7 +925,7 @@ namespace Exiv2 {
|
||||
|
||||
//! @name Accessors
|
||||
//@{
|
||||
AutoPtr clone() const;
|
||||
UniquePtr clone() const;
|
||||
virtual long count() const;
|
||||
/*!
|
||||
@brief Return the text value associated with the default language
|
||||
@ -978,7 +978,7 @@ namespace Exiv2 {
|
||||
class EXIV2API DateValue : public Value {
|
||||
public:
|
||||
//! Shortcut for a %DateValue auto pointer.
|
||||
typedef std::auto_ptr<DateValue> AutoPtr;
|
||||
typedef std::unique_ptr<DateValue> UniquePtr;
|
||||
|
||||
//! @name Creators
|
||||
//@{
|
||||
@ -1031,7 +1031,7 @@ namespace Exiv2 {
|
||||
|
||||
//! @name Accessors
|
||||
//@{
|
||||
AutoPtr clone() const { return AutoPtr(clone_()); }
|
||||
UniquePtr clone() const { return UniquePtr(clone_()); }
|
||||
/*!
|
||||
@brief Write value to a character data buffer.
|
||||
|
||||
@ -1079,7 +1079,7 @@ namespace Exiv2 {
|
||||
class EXIV2API TimeValue : public Value {
|
||||
public:
|
||||
//! Shortcut for a %TimeValue auto pointer.
|
||||
typedef std::auto_ptr<TimeValue> AutoPtr;
|
||||
typedef std::unique_ptr<TimeValue> UniquePtr;
|
||||
|
||||
//! @name Creators
|
||||
//@{
|
||||
@ -1138,7 +1138,7 @@ namespace Exiv2 {
|
||||
|
||||
//! @name Accessors
|
||||
//@{
|
||||
AutoPtr clone() const { return AutoPtr(clone_()); }
|
||||
UniquePtr clone() const { return UniquePtr(clone_()); }
|
||||
/*!
|
||||
@brief Write value to a character data buffer.
|
||||
|
||||
@ -1235,7 +1235,7 @@ namespace Exiv2 {
|
||||
class ValueType : public Value {
|
||||
public:
|
||||
//! Shortcut for a %ValueType\<T\> auto pointer.
|
||||
typedef std::auto_ptr<ValueType<T> > AutoPtr;
|
||||
typedef std::unique_ptr<ValueType<T> > UniquePtr;
|
||||
|
||||
//! @name Creators
|
||||
//@{
|
||||
@ -1275,7 +1275,7 @@ namespace Exiv2 {
|
||||
|
||||
//! @name Accessors
|
||||
//@{
|
||||
AutoPtr clone() const { return AutoPtr(clone_()); }
|
||||
UniquePtr clone() const { return UniquePtr(clone_()); }
|
||||
virtual long copy(byte* buf, ByteOrder byteOrder) const;
|
||||
virtual long count() const;
|
||||
virtual long size() const;
|
||||
@ -1521,7 +1521,10 @@ namespace Exiv2 {
|
||||
|
||||
template<typename T>
|
||||
ValueType<T>::ValueType(const ValueType<T>& rhs)
|
||||
: Value(rhs), value_(rhs.value_), pDataArea_(0), sizeDataArea_(0)
|
||||
: Value(rhs)
|
||||
, value_(rhs.value_)
|
||||
, pDataArea_(nullptr)
|
||||
, sizeDataArea_(0)
|
||||
{
|
||||
if (rhs.sizeDataArea_ > 0) {
|
||||
pDataArea_ = new byte[rhs.sizeDataArea_];
|
||||
|
||||
@ -57,7 +57,7 @@ namespace Exiv2 {
|
||||
instance after it is passed to this method. Use the Image::io()
|
||||
method to get a temporary reference.
|
||||
*/
|
||||
WebPImage(BasicIo::AutoPtr io);
|
||||
WebPImage(BasicIo::UniquePtr io);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
@ -126,7 +126,7 @@ namespace Exiv2 {
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2API Image::AutoPtr newWebPInstance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2API Image::UniquePtr newWebPInstance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is a WebP Video.
|
||||
EXIV2API bool isWebPType(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -139,14 +139,14 @@ namespace Exiv2 {
|
||||
long toLong(long n =0) const;
|
||||
float toFloat(long n =0) const;
|
||||
Rational toRational(long n =0) const;
|
||||
Value::AutoPtr getValue() const;
|
||||
Value::UniquePtr getValue() const;
|
||||
const Value& value() const;
|
||||
//@}
|
||||
|
||||
private:
|
||||
// Pimpl idiom
|
||||
struct Impl;
|
||||
std::auto_ptr<Impl> p_;
|
||||
std::unique_ptr<Impl> p_;
|
||||
|
||||
}; // class Xmpdatum
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ namespace Exiv2 {
|
||||
@param create Specifies if an existing image should be read (false)
|
||||
or if a new image should be created (true).
|
||||
*/
|
||||
XmpSidecar(BasicIo::AutoPtr io, bool create);
|
||||
XmpSidecar(BasicIo::UniquePtr io, bool create);
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
@ -100,7 +100,7 @@ namespace Exiv2 {
|
||||
Caller owns the returned object and the auto-pointer ensures that
|
||||
it will be deleted.
|
||||
*/
|
||||
EXIV2API Image::AutoPtr newXmpInstance(BasicIo::AutoPtr io, bool create);
|
||||
EXIV2API Image::UniquePtr newXmpInstance(BasicIo::UniquePtr io, bool create);
|
||||
|
||||
//! Check if the file iIo is an XMP sidecar file.
|
||||
EXIV2API bool isXmpType(BasicIo& iIo, bool advance);
|
||||
|
||||
@ -57,7 +57,7 @@ try {
|
||||
std::cout << "Added a few tags the quick way.\n";
|
||||
|
||||
// Create a ASCII string value (note the use of create)
|
||||
Exiv2::Value::AutoPtr v = Exiv2::Value::create(Exiv2::asciiString);
|
||||
Exiv2::Value::UniquePtr v = Exiv2::Value::create(Exiv2::asciiString);
|
||||
// Set the value to a string
|
||||
v->read("1999:12:31 23:59:59");
|
||||
// Add the value together with its key to the Exif data container
|
||||
@ -66,7 +66,7 @@ try {
|
||||
std::cout << "Added key \"" << key << "\", value \"" << *v << "\"\n";
|
||||
|
||||
// Now create a more interesting value (without using the create method)
|
||||
Exiv2::URationalValue::AutoPtr rv(new Exiv2::URationalValue);
|
||||
Exiv2::URationalValue::UniquePtr rv(new Exiv2::URationalValue);
|
||||
// Set two rational components from a string
|
||||
rv->read("1/2 1/3");
|
||||
// Add more elements through the extended interface of rational value
|
||||
@ -98,7 +98,7 @@ try {
|
||||
// Downcast the Value pointer to its actual type
|
||||
Exiv2::URationalValue* prv = dynamic_cast<Exiv2::URationalValue*>(v.release());
|
||||
if (prv == 0) throw Exiv2::Error(Exiv2::kerErrorMessage, "Downcast failed");
|
||||
rv = Exiv2::URationalValue::AutoPtr(prv);
|
||||
rv = Exiv2::URationalValue::UniquePtr(prv);
|
||||
// Modify the value directly through the interface of URationalValue
|
||||
rv->value_[2] = std::make_pair(88,77);
|
||||
// Copy the modified value back to the metadatum
|
||||
@ -118,7 +118,7 @@ try {
|
||||
|
||||
// *************************************************************************
|
||||
// Finally, write the remaining Exif data to the image file
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert(image.get() != 0);
|
||||
|
||||
image->setExifData(exifData);
|
||||
|
||||
@ -38,7 +38,7 @@ try {
|
||||
return 1;
|
||||
}
|
||||
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
|
||||
|
||||
@ -82,7 +82,7 @@ try {
|
||||
return 1;
|
||||
}
|
||||
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
assert (image.get() != 0);
|
||||
image->readMetadata();
|
||||
Exiv2::ExifData& ed = image->exifData();
|
||||
|
||||
@ -41,7 +41,7 @@ try {
|
||||
return 1;
|
||||
}
|
||||
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
assert (image.get() != 0);
|
||||
image->readMetadata();
|
||||
Exiv2::ExifData &exifData = image->exifData();
|
||||
|
||||
@ -44,7 +44,7 @@ try {
|
||||
}
|
||||
std::string file(argv[1]);
|
||||
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert (image.get() != 0);
|
||||
image->readMetadata();
|
||||
|
||||
@ -117,7 +117,7 @@ catch (Exiv2::AnyError& e) {
|
||||
|
||||
void write(const std::string& file, Exiv2::ExifData& ed)
|
||||
{
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert (image.get() != 0);
|
||||
image->setExifData(ed);
|
||||
image->writeMetadata();
|
||||
@ -125,7 +125,7 @@ void write(const std::string& file, Exiv2::ExifData& ed)
|
||||
|
||||
void print(const std::string& file)
|
||||
{
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert (image.get() != 0);
|
||||
image->readMetadata();
|
||||
|
||||
|
||||
@ -197,7 +197,7 @@ int main(int argc,const char* argv[])
|
||||
}
|
||||
|
||||
if ( !result ) try {
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
Exiv2::ExifData &exifData = image->exifData();
|
||||
|
||||
@ -88,7 +88,7 @@ try {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ int main(int argc, char* const argv[])
|
||||
const char* file = argv[1];
|
||||
const char* key = argv[2];
|
||||
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
Exiv2::ExifData &exifData = image->exifData();
|
||||
|
||||
@ -302,7 +302,7 @@ int main(int argc, char* const argv[])
|
||||
while (opt[0] == '-') opt++ ; // skip past leading -'s
|
||||
char option = opt[0];
|
||||
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
|
||||
|
||||
@ -614,7 +614,7 @@ bool readImage(const char* path,Options& /* options */)
|
||||
bool bResult = false ;
|
||||
|
||||
try {
|
||||
Image::AutoPtr image = ImageFactory::open(path);
|
||||
Image::UniquePtr image = ImageFactory::open(path);
|
||||
if ( image.get() ) {
|
||||
image->readMetadata();
|
||||
ExifData &exifData = image->exifData();
|
||||
@ -640,7 +640,7 @@ time_t readImageTime(const std::string& path,std::string* pS=NULL)
|
||||
|
||||
do {
|
||||
try {
|
||||
Image::AutoPtr image = ImageFactory::open(path);
|
||||
Image::UniquePtr image = ImageFactory::open(path);
|
||||
if ( image.get() ) {
|
||||
image->readMetadata();
|
||||
ExifData &exifData = image->exifData();
|
||||
@ -921,7 +921,7 @@ int main(int argc,const char* argv[])
|
||||
try {
|
||||
time_t t = readImageTime(path,&stamp) ;
|
||||
Position* pPos = searchTimeDict(gTimeDict,t,Position::deltaMax_);
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path);
|
||||
if ( image.get() ) {
|
||||
image->readMetadata();
|
||||
Exiv2::ExifData& exifData = image->exifData();
|
||||
|
||||
@ -69,7 +69,7 @@ int main(int argc, char* const argv[])
|
||||
Exiv2::byte* bytes = blocksize>0 ? new Exiv2::byte[blocksize]: NULL;
|
||||
|
||||
// copy fileIn from a remote location.
|
||||
BasicIo::AutoPtr io = Exiv2::ImageFactory::createIo(fr);
|
||||
BasicIo::UniquePtr io = Exiv2::ImageFactory::createIo(fr);
|
||||
if ( io->open() != 0 ) {
|
||||
Error(Exiv2::kerFileOpenFailed, io->path(), "rb", strError());
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ try {
|
||||
std::cout << "Time sent: " << iptcData["Iptc.Envelope.TimeSent"] << "\n";
|
||||
|
||||
// Open image file
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert (image.get() != 0);
|
||||
|
||||
// Set IPTC data and write it to the file
|
||||
|
||||
@ -38,7 +38,7 @@ try {
|
||||
return 1;
|
||||
}
|
||||
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
assert (image.get() != 0);
|
||||
image->readMetadata();
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ int main(int argc, char* const argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
Image::AutoPtr image = ImageFactory::open(argv[1]);
|
||||
Image::UniquePtr image = ImageFactory::open(argv[1]);
|
||||
assert (image.get() != 0);
|
||||
image->readMetadata();
|
||||
|
||||
@ -120,7 +120,7 @@ void processAdd(const std::string& line, int num, IptcData &iptcData)
|
||||
data = data.substr(1, data.size()-2);
|
||||
}
|
||||
TypeId type = IptcDataSets::dataSetType(iptcKey.tag(), iptcKey.record());
|
||||
Value::AutoPtr value = Value::create(type);
|
||||
Value::UniquePtr value = Value::create(type);
|
||||
value->read(data);
|
||||
|
||||
int rc = iptcData.add(iptcKey, value.get());
|
||||
@ -171,7 +171,7 @@ void processModify(const std::string& line, int num, IptcData &iptcData)
|
||||
data = data.substr(1, data.size()-2);
|
||||
}
|
||||
TypeId type = IptcDataSets::dataSetType(iptcKey.tag(), iptcKey.record());
|
||||
Value::AutoPtr value = Value::create(type);
|
||||
Value::UniquePtr value = Value::create(type);
|
||||
value->read(data);
|
||||
|
||||
IptcData::iterator iter = iptcData.findKey(iptcKey);
|
||||
|
||||
@ -53,7 +53,7 @@ int main(int argc, char* const argv[])
|
||||
}
|
||||
|
||||
// Read metadata from file
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
|
||||
|
||||
@ -49,15 +49,15 @@ try {
|
||||
}
|
||||
|
||||
// Use MemIo to increase test coverage.
|
||||
Exiv2::BasicIo::AutoPtr fileIo(new Exiv2::FileIo(params.read_));
|
||||
Exiv2::BasicIo::AutoPtr memIo(new Exiv2::MemIo);
|
||||
Exiv2::BasicIo::UniquePtr fileIo(new Exiv2::FileIo(params.read_));
|
||||
Exiv2::BasicIo::UniquePtr memIo(new Exiv2::MemIo);
|
||||
memIo->transfer(*fileIo);
|
||||
|
||||
Exiv2::Image::AutoPtr readImg = Exiv2::ImageFactory::open(memIo);
|
||||
Exiv2::Image::UniquePtr readImg = Exiv2::ImageFactory::open(std::move(memIo));
|
||||
assert(readImg.get() != 0);
|
||||
readImg->readMetadata();
|
||||
|
||||
Exiv2::Image::AutoPtr writeImg = Exiv2::ImageFactory::open(params.write_);
|
||||
Exiv2::Image::UniquePtr writeImg = Exiv2::ImageFactory::open(params.write_);
|
||||
assert(writeImg.get() != 0);
|
||||
if (params.preserve_) writeImg->readMetadata();
|
||||
if (params.iptc_) {
|
||||
|
||||
@ -38,7 +38,7 @@ int main(int argc, char* const argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ try {
|
||||
}
|
||||
std::string filename(argv[1]);
|
||||
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(filename);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(filename);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
|
||||
|
||||
@ -58,19 +58,19 @@ try {
|
||||
exifData["Exif.Image.Make"] = "Canon"; // AsciiValue
|
||||
exifData["Exif.Canon.OwnerName"] = "Tuan"; // UShortValue
|
||||
exifData["Exif.CanonCs.LensType"] = uint16_t(65535); // LongValue
|
||||
Exiv2::Value::AutoPtr v = Exiv2::Value::create(Exiv2::asciiString);
|
||||
Exiv2::Value::UniquePtr v = Exiv2::Value::create(Exiv2::asciiString);
|
||||
v->read("2013:06:09 14:30:30");
|
||||
Exiv2::ExifKey key("Exif.Image.DateTime");
|
||||
exifData.add(key, v.get());
|
||||
|
||||
Exiv2::Image::AutoPtr writeTest = Exiv2::ImageFactory::open(file, useCurlFromExiv2TestApps);
|
||||
Exiv2::Image::UniquePtr writeTest = Exiv2::ImageFactory::open(file, useCurlFromExiv2TestApps);
|
||||
assert(writeTest.get() != 0);
|
||||
writeTest->setExifData(exifData);
|
||||
writeTest->writeMetadata();
|
||||
|
||||
// read the result to make sure everything fine
|
||||
std::cout << "Print out the new metadata ...\n";
|
||||
Exiv2::Image::AutoPtr readTest = Exiv2::ImageFactory::open(file, useCurlFromExiv2TestApps);
|
||||
Exiv2::Image::UniquePtr readTest = Exiv2::ImageFactory::open(file, useCurlFromExiv2TestApps);
|
||||
assert(readTest.get() != 0);
|
||||
readTest->readMetadata();
|
||||
Exiv2::ExifData &exifReadData = readTest->exifData();
|
||||
|
||||
@ -91,7 +91,7 @@ void mini1(const char* path)
|
||||
|
||||
void mini9(const char* path)
|
||||
{
|
||||
TiffImage tiffImage(BasicIo::AutoPtr(new FileIo(path)), false);
|
||||
TiffImage tiffImage(BasicIo::UniquePtr(new FileIo(path)), false);
|
||||
tiffImage.readMetadata();
|
||||
|
||||
std::cout << "MIME type: " << tiffImage.mimeType() << "\n";
|
||||
|
||||
@ -68,7 +68,7 @@ public:
|
||||
int help(std::ostream& os =std::cout) const;
|
||||
|
||||
//! copy metadata from one image to another.
|
||||
void copyMetadata(Exiv2::Image::AutoPtr& readImage,Exiv2::Image::AutoPtr& writeImage);
|
||||
void copyMetadata(Exiv2::Image::UniquePtr& readImage,Exiv2::Image::UniquePtr& writeImage);
|
||||
|
||||
}; // class Params
|
||||
|
||||
|
||||
@ -170,7 +170,7 @@ void testCase(const std::string& file1,
|
||||
ExifKey ek(key);
|
||||
|
||||
//Open first image
|
||||
Image::AutoPtr image1 = ImageFactory::open(file1);
|
||||
Image::UniquePtr image1 = ImageFactory::open(file1);
|
||||
assert(image1.get() != 0);
|
||||
|
||||
// Load existing metadata
|
||||
@ -186,7 +186,7 @@ void testCase(const std::string& file1,
|
||||
pos->setValue(value);
|
||||
|
||||
// Open second image
|
||||
Image::AutoPtr image2 = ImageFactory::open(file2);
|
||||
Image::UniquePtr image2 = ImageFactory::open(file2);
|
||||
assert(image2.get() != 0);
|
||||
|
||||
image2->setExifData(image1->exifData());
|
||||
|
||||
@ -48,19 +48,19 @@ int main(int argc, char* const argv[])
|
||||
Exiv2::ExifData ed1;
|
||||
ed1["Exif.Image.Model"] = "Test 1";
|
||||
|
||||
Exiv2::Value::AutoPtr v1 = Exiv2::Value::create(Exiv2::unsignedShort);
|
||||
Exiv2::Value::UniquePtr v1 = Exiv2::Value::create(Exiv2::unsignedShort);
|
||||
v1->read("160 161 162 163");
|
||||
ed1.add(Exiv2::ExifKey("Exif.Image.SamplesPerPixel"), v1.get());
|
||||
|
||||
Exiv2::Value::AutoPtr v2 = Exiv2::Value::create(Exiv2::signedLong);
|
||||
Exiv2::Value::UniquePtr v2 = Exiv2::Value::create(Exiv2::signedLong);
|
||||
v2->read("-2 -1 0 1");
|
||||
ed1.add(Exiv2::ExifKey("Exif.Image.XResolution"), v2.get());
|
||||
|
||||
Exiv2::Value::AutoPtr v3 = Exiv2::Value::create(Exiv2::signedRational);
|
||||
Exiv2::Value::UniquePtr 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::AutoPtr v4 = Exiv2::Value::create(Exiv2::undefined);
|
||||
Exiv2::Value::UniquePtr v4 = Exiv2::Value::create(Exiv2::undefined);
|
||||
v4->read("255 254 253 252");
|
||||
ed1.add(Exiv2::ExifKey("Exif.Image.WhitePoint"), v4.get());
|
||||
|
||||
@ -87,7 +87,7 @@ int main(int argc, char* const argv[])
|
||||
print(file);
|
||||
|
||||
std::cout <<"\n----- Non-intrusive writing of special Canon MakerNote tags\n";
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
|
||||
@ -203,7 +203,7 @@ int main(int argc, char* const argv[])
|
||||
std::cout <<"\n----- One IFD0 and one IFD1 tag\n";
|
||||
Exiv2::ExifData ed7;
|
||||
ed7["Exif.Thumbnail.Artist"] = "Test 7";
|
||||
Exiv2::Value::AutoPtr v5 = Exiv2::Value::create(Exiv2::unsignedShort);
|
||||
Exiv2::Value::UniquePtr v5 = Exiv2::Value::create(Exiv2::unsignedShort);
|
||||
v5->read("160 161 162 163");
|
||||
ed7.add(Exiv2::ExifKey("Exif.Image.SamplesPerPixel"), v5.get());
|
||||
write(file, ed7);
|
||||
@ -219,7 +219,7 @@ catch (Exiv2::AnyError& e) {
|
||||
|
||||
void write(const std::string& file, Exiv2::ExifData& ed)
|
||||
{
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert(image.get() != 0);
|
||||
|
||||
image->setExifData(ed);
|
||||
@ -228,7 +228,7 @@ void write(const std::string& file, Exiv2::ExifData& ed)
|
||||
|
||||
void print(const std::string& file)
|
||||
{
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ int main(int argc, char* const argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ int main(int argc, char** argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
|
||||
assert (image.get() != 0);
|
||||
image->readMetadata();
|
||||
|
||||
|
||||
@ -136,7 +136,7 @@ try {
|
||||
// properties and language alternatives.
|
||||
|
||||
// Add a simple XMP property in a known namespace
|
||||
Exiv2::Value::AutoPtr v = Exiv2::Value::create(Exiv2::xmpText);
|
||||
Exiv2::Value::UniquePtr v = Exiv2::Value::create(Exiv2::xmpText);
|
||||
v->read("image/jpeg");
|
||||
xmpData.add(Exiv2::XmpKey("Xmp.dc.format"), v.get());
|
||||
|
||||
|
||||
@ -52,7 +52,6 @@ add_library( exiv2lib
|
||||
crwimage.cpp ../include/exiv2/crwimage.hpp
|
||||
datasets.cpp ../include/exiv2/datasets.hpp
|
||||
easyaccess.cpp ../include/exiv2/easyaccess.hpp
|
||||
epsimage.cpp ../include/exiv2/epsimage.hpp
|
||||
error.cpp ../include/exiv2/error.hpp
|
||||
exif.cpp ../include/exiv2/exif.hpp
|
||||
futils.cpp ../include/exiv2/futils.hpp
|
||||
|
||||
110
src/actions.cpp
110
src/actions.cpp
@ -166,9 +166,9 @@ namespace Action {
|
||||
{
|
||||
}
|
||||
|
||||
Task::AutoPtr Task::clone() const
|
||||
Task::UniquePtr Task::clone() const
|
||||
{
|
||||
return AutoPtr(clone_());
|
||||
return UniquePtr(clone_());
|
||||
}
|
||||
|
||||
TaskFactory* TaskFactory::instance_ = 0;
|
||||
@ -193,7 +193,7 @@ namespace Action {
|
||||
}
|
||||
} //TaskFactory::cleanup
|
||||
|
||||
void TaskFactory::registerTask(TaskType type, Task::AutoPtr task)
|
||||
void TaskFactory::registerTask(TaskType type, Task::UniquePtr task)
|
||||
{
|
||||
Registry::iterator i = registry_.find(type);
|
||||
if (i != registry_.end()) {
|
||||
@ -205,25 +205,25 @@ namespace Action {
|
||||
TaskFactory::TaskFactory()
|
||||
{
|
||||
// Register a prototype of each known task
|
||||
registerTask(adjust, Task::AutoPtr(new Adjust));
|
||||
registerTask(print, Task::AutoPtr(new Print));
|
||||
registerTask(rename, Task::AutoPtr(new Rename));
|
||||
registerTask(erase, Task::AutoPtr(new Erase));
|
||||
registerTask(extract, Task::AutoPtr(new Extract));
|
||||
registerTask(insert, Task::AutoPtr(new Insert));
|
||||
registerTask(modify, Task::AutoPtr(new Modify));
|
||||
registerTask(fixiso, Task::AutoPtr(new FixIso));
|
||||
registerTask(fixcom, Task::AutoPtr(new FixCom));
|
||||
registerTask(adjust, Task::UniquePtr(new Adjust));
|
||||
registerTask(print, Task::UniquePtr(new Print));
|
||||
registerTask(rename, Task::UniquePtr(new Rename));
|
||||
registerTask(erase, Task::UniquePtr(new Erase));
|
||||
registerTask(extract, Task::UniquePtr(new Extract));
|
||||
registerTask(insert, Task::UniquePtr(new Insert));
|
||||
registerTask(modify, Task::UniquePtr(new Modify));
|
||||
registerTask(fixiso, Task::UniquePtr(new FixIso));
|
||||
registerTask(fixcom, Task::UniquePtr(new FixCom));
|
||||
} // TaskFactory c'tor
|
||||
|
||||
Task::AutoPtr TaskFactory::create(TaskType type)
|
||||
Task::UniquePtr TaskFactory::create(TaskType type)
|
||||
{
|
||||
Registry::const_iterator i = registry_.find(type);
|
||||
if (i != registry_.end() && i->second != 0) {
|
||||
Task* t = i->second;
|
||||
return t->clone();
|
||||
}
|
||||
return Task::AutoPtr(0);
|
||||
return nullptr;
|
||||
} // TaskFactory::create
|
||||
|
||||
Print::~Print()
|
||||
@ -305,7 +305,7 @@ namespace Action {
|
||||
<< _("Failed to open the file\n");
|
||||
return -1;
|
||||
}
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path_);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
Exiv2::ExifData& exifData = image->exifData();
|
||||
@ -441,7 +441,7 @@ namespace Action {
|
||||
<< ": " << _("Failed to open the file\n");
|
||||
return -1;
|
||||
}
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path_);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
// Set defaults for metadata types and data columns
|
||||
@ -661,7 +661,7 @@ namespace Action {
|
||||
<< ": " << _("Failed to open the file\n");
|
||||
return -1;
|
||||
}
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path_);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
if (Params::instance().verbose_) {
|
||||
@ -678,7 +678,7 @@ namespace Action {
|
||||
<< ": " << _("Failed to open the file\n");
|
||||
return -1;
|
||||
}
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path_);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
bool const manyFiles = Params::instance().files_.size() > 1;
|
||||
@ -701,9 +701,9 @@ namespace Action {
|
||||
return 0;
|
||||
} // Print::printPreviewList
|
||||
|
||||
Print::AutoPtr Print::clone() const
|
||||
Print::UniquePtr Print::clone() const
|
||||
{
|
||||
return AutoPtr(clone_());
|
||||
return UniquePtr(clone_());
|
||||
}
|
||||
|
||||
Print* Print::clone_() const
|
||||
@ -726,7 +726,7 @@ namespace Action {
|
||||
Timestamp ts;
|
||||
if (Params::instance().preserve_) ts.read(path);
|
||||
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
Exiv2::ExifData& exifData = image->exifData();
|
||||
@ -789,9 +789,9 @@ namespace Action {
|
||||
return 1;
|
||||
}} // Rename::run
|
||||
|
||||
Rename::AutoPtr Rename::clone() const
|
||||
Rename::UniquePtr Rename::clone() const
|
||||
{
|
||||
return AutoPtr(clone_());
|
||||
return UniquePtr(clone_());
|
||||
}
|
||||
|
||||
Rename* Rename::clone_() const
|
||||
@ -815,7 +815,7 @@ namespace Action {
|
||||
Timestamp ts;
|
||||
if (Params::instance().preserve_) ts.read(path);
|
||||
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path_);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
// Thumbnail must be before Exif
|
||||
@ -915,9 +915,9 @@ namespace Action {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Erase::AutoPtr Erase::clone() const
|
||||
Erase::UniquePtr Erase::clone() const
|
||||
{
|
||||
return AutoPtr(clone_());
|
||||
return UniquePtr(clone_());
|
||||
}
|
||||
|
||||
Erase* Erase::clone_() const
|
||||
@ -980,7 +980,7 @@ namespace Action {
|
||||
<< ": " << _("Failed to open the file\n");
|
||||
return -1;
|
||||
}
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path_);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
Exiv2::ExifData& exifData = image->exifData();
|
||||
@ -1022,7 +1022,7 @@ namespace Action {
|
||||
<< ": " << _("Failed to open the file\n");
|
||||
return -1;
|
||||
}
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path_);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
|
||||
@ -1060,7 +1060,7 @@ namespace Action {
|
||||
bool bStdout = target == "-" ;
|
||||
|
||||
if ( rc == 0 ) {
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path_);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
if ( !image->iccProfileDefined() ) {
|
||||
@ -1107,9 +1107,9 @@ namespace Action {
|
||||
}
|
||||
} // Extract::writePreviewFile
|
||||
|
||||
Extract::AutoPtr Extract::clone() const
|
||||
Extract::UniquePtr Extract::clone() const
|
||||
{
|
||||
return AutoPtr(clone_());
|
||||
return UniquePtr(clone_());
|
||||
}
|
||||
|
||||
Extract* Extract::clone_() const
|
||||
@ -1208,7 +1208,7 @@ namespace Action {
|
||||
for ( long i = 0 ; i < xmpBlob.size_ ; i++ ) {
|
||||
xmpPacket += (char) xmpBlob.pData_[i];
|
||||
}
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
image->clearXmpData();
|
||||
@ -1252,7 +1252,7 @@ namespace Action {
|
||||
|
||||
// read in the metadata
|
||||
if ( rc == 0 ) {
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
// clear existing profile, assign the blob and rewrite image
|
||||
@ -1279,7 +1279,7 @@ namespace Action {
|
||||
<< ": " << _("Failed to open the file\n");
|
||||
return -1;
|
||||
}
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
Exiv2::ExifThumb exifThumb(image->exifData());
|
||||
@ -1289,9 +1289,9 @@ namespace Action {
|
||||
return 0;
|
||||
} // Insert::insertThumbnail
|
||||
|
||||
Insert::AutoPtr Insert::clone() const
|
||||
Insert::UniquePtr Insert::clone() const
|
||||
{
|
||||
return AutoPtr(clone_());
|
||||
return UniquePtr(clone_());
|
||||
}
|
||||
|
||||
Insert* Insert::clone_() const
|
||||
@ -1314,7 +1314,7 @@ namespace Action {
|
||||
Timestamp ts;
|
||||
if (Params::instance().preserve_) ts.read(path);
|
||||
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
|
||||
@ -1388,7 +1388,7 @@ namespace Action {
|
||||
Exiv2::ExifData& exifData = pImage->exifData();
|
||||
Exiv2::IptcData& iptcData = pImage->iptcData();
|
||||
Exiv2::XmpData& xmpData = pImage->xmpData();
|
||||
Exiv2::Value::AutoPtr value = Exiv2::Value::create(modifyCmd.typeId_);
|
||||
Exiv2::Value::UniquePtr value = Exiv2::Value::create(modifyCmd.typeId_);
|
||||
int rc = value->read(modifyCmd.value_);
|
||||
if (0 == rc) {
|
||||
if (modifyCmd.metadataId_ == exif) {
|
||||
@ -1449,7 +1449,7 @@ namespace Action {
|
||||
// If a type was explicitly requested, use it; else
|
||||
// use the current type of the metadatum, if any;
|
||||
// or the default type
|
||||
Exiv2::Value::AutoPtr value;
|
||||
Exiv2::Value::UniquePtr value;
|
||||
if (metadatum) {
|
||||
value = metadatum->getValue();
|
||||
}
|
||||
@ -1526,9 +1526,9 @@ namespace Action {
|
||||
Exiv2::XmpProperties::registerNs(modifyCmd.value_, modifyCmd.key_);
|
||||
}
|
||||
|
||||
Modify::AutoPtr Modify::clone() const
|
||||
Modify::UniquePtr Modify::clone() const
|
||||
{
|
||||
return AutoPtr(clone_());
|
||||
return UniquePtr(clone_());
|
||||
}
|
||||
|
||||
Modify* Modify::clone_() const
|
||||
@ -1555,7 +1555,7 @@ namespace Action {
|
||||
Timestamp ts;
|
||||
if (Params::instance().preserve_) ts.read(path);
|
||||
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
Exiv2::ExifData& exifData = image->exifData();
|
||||
@ -1582,9 +1582,9 @@ namespace Action {
|
||||
return 1;
|
||||
} // Adjust::run
|
||||
|
||||
Adjust::AutoPtr Adjust::clone() const
|
||||
Adjust::UniquePtr Adjust::clone() const
|
||||
{
|
||||
return AutoPtr(clone_());
|
||||
return UniquePtr(clone_());
|
||||
}
|
||||
|
||||
Adjust* Adjust::clone_() const
|
||||
@ -1691,7 +1691,7 @@ namespace Action {
|
||||
Timestamp ts;
|
||||
if (Params::instance().preserve_) ts.read(path);
|
||||
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
Exiv2::ExifData& exifData = image->exifData();
|
||||
@ -1729,9 +1729,9 @@ namespace Action {
|
||||
}
|
||||
} // FixIso::run
|
||||
|
||||
FixIso::AutoPtr FixIso::clone() const
|
||||
FixIso::UniquePtr FixIso::clone() const
|
||||
{
|
||||
return AutoPtr(clone_());
|
||||
return UniquePtr(clone_());
|
||||
}
|
||||
|
||||
FixIso* FixIso::clone_() const
|
||||
@ -1754,7 +1754,7 @@ namespace Action {
|
||||
Timestamp ts;
|
||||
if (Params::instance().preserve_) ts.read(path);
|
||||
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path);
|
||||
assert(image.get() != 0);
|
||||
image->readMetadata();
|
||||
Exiv2::ExifData& exifData = image->exifData();
|
||||
@ -1770,7 +1770,7 @@ namespace Action {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Exiv2::Value::AutoPtr v = pos->getValue();
|
||||
Exiv2::Value::UniquePtr v = pos->getValue();
|
||||
const Exiv2::CommentValue* pcv = dynamic_cast<const Exiv2::CommentValue*>(v.get());
|
||||
if (!pcv) {
|
||||
if (Params::instance().verbose_) {
|
||||
@ -1805,9 +1805,9 @@ namespace Action {
|
||||
}
|
||||
} // FixCom::run
|
||||
|
||||
FixCom::AutoPtr FixCom::clone() const
|
||||
FixCom::UniquePtr FixCom::clone() const
|
||||
{
|
||||
return AutoPtr(clone_());
|
||||
return UniquePtr(clone_());
|
||||
}
|
||||
|
||||
FixCom* FixCom::clone_() const
|
||||
@ -1983,9 +1983,9 @@ namespace {
|
||||
|
||||
Exiv2::DataBuf stdIn;
|
||||
if ( bStdin ) Params::instance().getStdin(stdIn);
|
||||
Exiv2::BasicIo::AutoPtr ioStdin = Exiv2::BasicIo::AutoPtr(new Exiv2::MemIo(stdIn.pData_,stdIn.size_));
|
||||
Exiv2::BasicIo::UniquePtr ioStdin = Exiv2::BasicIo::UniquePtr(new Exiv2::MemIo(stdIn.pData_,stdIn.size_));
|
||||
|
||||
Exiv2::Image::AutoPtr sourceImage = bStdin ? Exiv2::ImageFactory::open(ioStdin) : Exiv2::ImageFactory::open(source);
|
||||
Exiv2::Image::UniquePtr sourceImage = bStdin ? Exiv2::ImageFactory::open(std::move(ioStdin)) : Exiv2::ImageFactory::open(source);
|
||||
assert(sourceImage.get() != 0);
|
||||
sourceImage->readMetadata();
|
||||
|
||||
@ -1995,7 +1995,7 @@ namespace {
|
||||
// Open or create the target file
|
||||
std::string target(bStdout ? temporaryPath() : tgt);
|
||||
|
||||
Exiv2::Image::AutoPtr targetImage;
|
||||
Exiv2::Image::UniquePtr targetImage;
|
||||
if (Exiv2::fileExists(target)) {
|
||||
targetImage = Exiv2::ImageFactory::open(target);
|
||||
assert(targetImage.get() != 0);
|
||||
@ -2252,7 +2252,7 @@ namespace {
|
||||
<< _("Failed to open the file\n");
|
||||
return -1;
|
||||
}
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path);
|
||||
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path);
|
||||
assert(image.get() != 0);
|
||||
image->printStructure(out,option);
|
||||
return 0;
|
||||
|
||||
@ -65,11 +65,11 @@ namespace Action {
|
||||
class Task {
|
||||
public:
|
||||
//! Shortcut for an auto pointer.
|
||||
typedef std::auto_ptr<Task> AutoPtr;
|
||||
typedef std::unique_ptr<Task> UniquePtr;
|
||||
//! Virtual destructor.
|
||||
virtual ~Task();
|
||||
//! Virtual copy construction.
|
||||
AutoPtr clone() const;
|
||||
UniquePtr clone() const;
|
||||
/*!
|
||||
@brief Application interface to perform a task.
|
||||
|
||||
@ -92,7 +92,7 @@ namespace Action {
|
||||
virtual Task* clone_() const =0;
|
||||
|
||||
//! copy binary_ from command-line params to task
|
||||
bool binary_ ;
|
||||
bool binary_ {false} ;
|
||||
|
||||
}; // class Task
|
||||
|
||||
@ -125,7 +125,7 @@ namespace Action {
|
||||
returned auto pointer and take appropriate action (e.g., throw
|
||||
an exception) if it is 0.
|
||||
*/
|
||||
Task::AutoPtr create(TaskType type);
|
||||
Task::UniquePtr create(TaskType type);
|
||||
|
||||
/*!
|
||||
@brief Register a task prototype together with its type.
|
||||
@ -139,7 +139,7 @@ namespace Action {
|
||||
@param task Pointer to the prototype. Ownership is transferred to the
|
||||
task factory. That's what the auto pointer indicates.
|
||||
*/
|
||||
void registerTask(TaskType type, Task::AutoPtr task);
|
||||
void registerTask(TaskType type, Task::UniquePtr task);
|
||||
|
||||
private:
|
||||
//! Prevent construction other than through instance().
|
||||
@ -161,8 +161,8 @@ namespace Action {
|
||||
public:
|
||||
virtual ~Print();
|
||||
virtual int run(const std::string& path);
|
||||
typedef std::auto_ptr<Print> AutoPtr;
|
||||
AutoPtr clone() const;
|
||||
typedef std::unique_ptr<Print> UniquePtr;
|
||||
UniquePtr clone() const;
|
||||
|
||||
//! Print the Jpeg comment
|
||||
int printComment();
|
||||
@ -206,7 +206,7 @@ namespace Action {
|
||||
virtual Print* clone_() const;
|
||||
|
||||
std::string path_;
|
||||
int align_; // for the alignment of the summary output
|
||||
int align_{0}; // for the alignment of the summary output
|
||||
}; // class Print
|
||||
|
||||
/*!
|
||||
@ -217,8 +217,8 @@ namespace Action {
|
||||
public:
|
||||
virtual ~Rename();
|
||||
virtual int run(const std::string& path);
|
||||
typedef std::auto_ptr<Rename> AutoPtr;
|
||||
AutoPtr clone() const;
|
||||
typedef std::unique_ptr<Rename> UniquePtr;
|
||||
UniquePtr clone() const;
|
||||
|
||||
private:
|
||||
virtual Rename* clone_() const;
|
||||
@ -229,8 +229,8 @@ namespace Action {
|
||||
public:
|
||||
virtual ~Adjust();
|
||||
virtual int run(const std::string& path);
|
||||
typedef std::auto_ptr<Adjust> AutoPtr;
|
||||
AutoPtr clone() const;
|
||||
typedef std::unique_ptr<Adjust> UniquePtr;
|
||||
UniquePtr clone() const;
|
||||
|
||||
private:
|
||||
virtual Adjust* clone_() const;
|
||||
@ -238,10 +238,10 @@ namespace Action {
|
||||
const std::string& key,
|
||||
const std::string& path) const;
|
||||
|
||||
long adjustment_;
|
||||
long yearAdjustment_;
|
||||
long monthAdjustment_;
|
||||
long dayAdjustment_;
|
||||
long adjustment_ {0};
|
||||
long yearAdjustment_ {0};
|
||||
long monthAdjustment_ {0};
|
||||
long dayAdjustment_ {0};
|
||||
|
||||
}; // class Adjust
|
||||
|
||||
@ -252,8 +252,8 @@ namespace Action {
|
||||
public:
|
||||
virtual ~Erase();
|
||||
virtual int run(const std::string& path);
|
||||
typedef std::auto_ptr<Erase> AutoPtr;
|
||||
AutoPtr clone() const;
|
||||
typedef std::unique_ptr<Erase> UniquePtr;
|
||||
UniquePtr clone() const;
|
||||
|
||||
/*!
|
||||
@brief Delete the thumbnail image, incl IFD1 metadata from the file.
|
||||
@ -294,8 +294,8 @@ namespace Action {
|
||||
public:
|
||||
virtual ~Extract();
|
||||
virtual int run(const std::string& path);
|
||||
typedef std::auto_ptr<Extract> AutoPtr;
|
||||
AutoPtr clone() const;
|
||||
typedef std::unique_ptr<Extract> UniquePtr;
|
||||
UniquePtr clone() const;
|
||||
|
||||
/*!
|
||||
@brief Write the thumbnail image to a file. The filename is composed by
|
||||
@ -333,8 +333,8 @@ namespace Action {
|
||||
public:
|
||||
virtual ~Insert();
|
||||
virtual int run(const std::string& path);
|
||||
typedef std::auto_ptr<Insert> AutoPtr;
|
||||
AutoPtr clone() const;
|
||||
typedef std::unique_ptr<Insert> UniquePtr;
|
||||
UniquePtr clone() const;
|
||||
|
||||
/*!
|
||||
@brief Insert a Jpeg thumbnail image from a file into file \em path.
|
||||
@ -374,15 +374,15 @@ namespace Action {
|
||||
public:
|
||||
virtual ~Modify();
|
||||
virtual int run(const std::string& path);
|
||||
typedef std::auto_ptr<Modify> AutoPtr;
|
||||
AutoPtr clone() const;
|
||||
typedef std::unique_ptr<Modify> UniquePtr;
|
||||
UniquePtr clone() const;
|
||||
Modify() {}
|
||||
//! Apply modification commands to the \em pImage, return 0 if successful.
|
||||
static int applyCommands(Exiv2::Image* pImage);
|
||||
|
||||
private:
|
||||
virtual Modify* clone_() const;
|
||||
//! Copy constructor needed because of AutoPtr member
|
||||
//! Copy constructor needed because of UniquePtr member
|
||||
Modify(const Modify& /*src*/) : Task() {}
|
||||
|
||||
//! Add a metadatum to \em pImage according to \em modifyCmd
|
||||
@ -407,8 +407,8 @@ namespace Action {
|
||||
public:
|
||||
virtual ~FixIso();
|
||||
virtual int run(const std::string& path);
|
||||
typedef std::auto_ptr<FixIso> AutoPtr;
|
||||
AutoPtr clone() const;
|
||||
typedef std::unique_ptr<FixIso> UniquePtr;
|
||||
UniquePtr clone() const;
|
||||
|
||||
private:
|
||||
virtual FixIso* clone_() const;
|
||||
@ -425,8 +425,8 @@ namespace Action {
|
||||
public:
|
||||
virtual ~FixCom();
|
||||
virtual int run(const std::string& path);
|
||||
typedef std::auto_ptr<FixCom> AutoPtr;
|
||||
AutoPtr clone() const;
|
||||
typedef std::unique_ptr<FixCom> UniquePtr;
|
||||
UniquePtr clone() const;
|
||||
|
||||
private:
|
||||
virtual FixCom* clone_() const;
|
||||
|
||||
@ -99,8 +99,8 @@ namespace Exiv2
|
||||
return Internal::stringFormat("ID = %u from,length = %u,%u", ID_, start_, length_);
|
||||
}
|
||||
|
||||
BmffImage::BmffImage(BasicIo::AutoPtr io, bool /* create */)
|
||||
: Image(ImageType::bmff, mdExif | mdIptc | mdXmp, io)
|
||||
BmffImage::BmffImage(BasicIo::UniquePtr io, bool /* create */)
|
||||
: Image(ImageType::bmff, mdExif | mdIptc | mdXmp, std::move(io))
|
||||
, endian_(Exiv2::bigEndian)
|
||||
{
|
||||
pixelWidth_ = 0;
|
||||
@ -597,9 +597,9 @@ namespace Exiv2
|
||||
|
||||
// *************************************************************************
|
||||
// free functions
|
||||
Image::AutoPtr newBmffInstance(BasicIo::AutoPtr io, bool create)
|
||||
Image::UniquePtr newBmffInstance(BasicIo::UniquePtr io, bool create)
|
||||
{
|
||||
Image::AutoPtr image(new BmffImage(io, create));
|
||||
Image::UniquePtr image(new BmffImage(std::move(io), create));
|
||||
if (!image->good()) {
|
||||
image.reset();
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
// class member definitions
|
||||
namespace Exiv2
|
||||
{
|
||||
BmpImage::BmpImage(BasicIo::AutoPtr io) : Image(ImageType::bmp, mdNone, io)
|
||||
BmpImage::BmpImage(BasicIo::UniquePtr io) : Image(ImageType::bmp, mdNone, std::move(io))
|
||||
{
|
||||
}
|
||||
|
||||
@ -120,9 +120,9 @@ namespace Exiv2
|
||||
|
||||
// *************************************************************************
|
||||
// free functions
|
||||
Image::AutoPtr newBmpInstance(BasicIo::AutoPtr io, bool /*create*/)
|
||||
Image::UniquePtr newBmpInstance(BasicIo::UniquePtr io, bool /*create*/)
|
||||
{
|
||||
Image::AutoPtr image(new BmpImage(io));
|
||||
Image::UniquePtr image(new BmpImage(std::move(io)));
|
||||
if (!image->good()) {
|
||||
image.reset();
|
||||
}
|
||||
|
||||
@ -46,8 +46,8 @@ namespace Exiv2 {
|
||||
|
||||
using namespace Internal;
|
||||
|
||||
Cr2Image::Cr2Image(BasicIo::AutoPtr io, bool /*create*/)
|
||||
: Image(ImageType::cr2, mdExif | mdIptc | mdXmp, io)
|
||||
Cr2Image::Cr2Image(BasicIo::UniquePtr io, bool /*create*/)
|
||||
: Image(ImageType::cr2, mdExif | mdIptc | mdXmp, std::move(io))
|
||||
{
|
||||
} // Cr2Image::Cr2Image
|
||||
|
||||
@ -183,7 +183,7 @@ namespace Exiv2 {
|
||||
ed.end());
|
||||
}
|
||||
|
||||
std::auto_ptr<TiffHeaderBase> header(new Cr2Header(byteOrder));
|
||||
std::unique_ptr<TiffHeaderBase> header(new Cr2Header(byteOrder));
|
||||
OffsetWriter offsetWriter;
|
||||
offsetWriter.setOrigin(OffsetWriter::cr2RawIfdOffset, Cr2Header::offset2addr(), byteOrder);
|
||||
return TiffParserWorker::encode(io,
|
||||
@ -200,9 +200,9 @@ namespace Exiv2 {
|
||||
|
||||
// *************************************************************************
|
||||
// free functions
|
||||
Image::AutoPtr newCr2Instance(BasicIo::AutoPtr io, bool create)
|
||||
Image::UniquePtr newCr2Instance(BasicIo::UniquePtr io, bool create)
|
||||
{
|
||||
Image::AutoPtr image(new Cr2Image(io, create));
|
||||
Image::UniquePtr image(new Cr2Image(std::move(io), create));
|
||||
if (!image->good()) {
|
||||
image.reset();
|
||||
}
|
||||
|
||||
@ -52,8 +52,8 @@ namespace Exiv2 {
|
||||
|
||||
using namespace Internal;
|
||||
|
||||
CrwImage::CrwImage(BasicIo::AutoPtr io, bool /*create*/)
|
||||
: Image(ImageType::crw, mdExif | mdComment, io)
|
||||
CrwImage::CrwImage(BasicIo::UniquePtr io, bool /*create*/)
|
||||
: Image(ImageType::crw, mdExif | mdComment, std::move(io))
|
||||
{
|
||||
} // CrwImage::CrwImage
|
||||
|
||||
@ -132,7 +132,7 @@ namespace Exiv2 {
|
||||
CrwParser::encode(blob, buf.pData_, buf.size_, this);
|
||||
|
||||
// Write new buffer to file
|
||||
MemIo::AutoPtr tempIo(new MemIo);
|
||||
MemIo::UniquePtr tempIo(new MemIo);
|
||||
assert(tempIo.get() != 0);
|
||||
tempIo->write((blob.size() > 0 ? &blob[0] : 0), static_cast<long>(blob.size()));
|
||||
io_->close();
|
||||
@ -146,7 +146,7 @@ namespace Exiv2 {
|
||||
assert(pData != 0);
|
||||
|
||||
// Parse the image, starting with a CIFF header component
|
||||
CiffHeader::AutoPtr head(new CiffHeader);
|
||||
CiffHeader::UniquePtr head(new CiffHeader);
|
||||
head->read(pData, size);
|
||||
#ifdef EXIV2_DEBUG_MESSAGES
|
||||
head->print(std::cerr);
|
||||
@ -169,7 +169,7 @@ namespace Exiv2 {
|
||||
)
|
||||
{
|
||||
// Parse image, starting with a CIFF header component
|
||||
CiffHeader::AutoPtr head(new CiffHeader);
|
||||
CiffHeader::UniquePtr head(new CiffHeader);
|
||||
if (size != 0) {
|
||||
head->read(pData, size);
|
||||
}
|
||||
@ -183,9 +183,9 @@ namespace Exiv2 {
|
||||
|
||||
// *************************************************************************
|
||||
// free functions
|
||||
Image::AutoPtr newCrwInstance(BasicIo::AutoPtr io, bool create)
|
||||
Image::UniquePtr newCrwInstance(BasicIo::UniquePtr io, bool create)
|
||||
{
|
||||
Image::AutoPtr image(new CrwImage(io, create));
|
||||
Image::UniquePtr image(new CrwImage(std::move(io), create));
|
||||
if (!image->good()) {
|
||||
image.reset();
|
||||
}
|
||||
|
||||
@ -199,17 +199,17 @@ namespace Exiv2 {
|
||||
}
|
||||
}
|
||||
|
||||
void CiffComponent::add(AutoPtr component)
|
||||
void CiffComponent::add(UniquePtr component)
|
||||
{
|
||||
doAdd(component);
|
||||
doAdd(std::move(component));
|
||||
}
|
||||
|
||||
void CiffEntry::doAdd(AutoPtr /*component*/)
|
||||
void CiffEntry::doAdd(UniquePtr /*component*/)
|
||||
{
|
||||
throw Error(kerFunctionNotSupported, "CiffEntry::add");
|
||||
} // CiffEntry::doAdd
|
||||
|
||||
void CiffDirectory::doAdd(AutoPtr component)
|
||||
void CiffDirectory::doAdd(UniquePtr component)
|
||||
{
|
||||
components_.push_back(component.release());
|
||||
} // CiffDirectory::doAdd
|
||||
@ -333,14 +333,14 @@ namespace Exiv2 {
|
||||
|
||||
for (uint16_t i = 0; i < count; ++i) {
|
||||
uint16_t tag = getUShort(pData + o, byteOrder);
|
||||
CiffComponent::AutoPtr m;
|
||||
CiffComponent::UniquePtr m;
|
||||
switch (CiffComponent::typeId(tag)) {
|
||||
case directory: m = CiffComponent::AutoPtr(new CiffDirectory); break;
|
||||
default: m = CiffComponent::AutoPtr(new CiffEntry); break;
|
||||
case directory: m = CiffComponent::UniquePtr(new CiffDirectory); break;
|
||||
default: m = CiffComponent::UniquePtr(new CiffEntry); break;
|
||||
}
|
||||
m->setDir(this->tag());
|
||||
m->read(pData, size, o, byteOrder);
|
||||
add(m);
|
||||
add(std::move(m));
|
||||
o += 10;
|
||||
}
|
||||
} // CiffDirectory::readDirectory
|
||||
@ -554,7 +554,7 @@ namespace Exiv2 {
|
||||
<< ", " << _("size") << " = " << std::dec << size_
|
||||
<< ", " << _("offset") << " = " << offset_ << "\n";
|
||||
|
||||
Value::AutoPtr value;
|
||||
Value::UniquePtr value;
|
||||
if (typeId() != directory) {
|
||||
value = Value::create(typeId());
|
||||
value->read(pData_, size_, byteOrder);
|
||||
@ -710,9 +710,9 @@ namespace Exiv2 {
|
||||
}
|
||||
if (cc_ == 0) {
|
||||
// Directory doesn't exist yet, add it
|
||||
m_ = AutoPtr(new CiffDirectory(csd.crwDir_, csd.parent_));
|
||||
m_ = UniquePtr(new CiffDirectory(csd.crwDir_, csd.parent_));
|
||||
cc_ = m_.get();
|
||||
add(m_);
|
||||
add(std::move(m_));
|
||||
}
|
||||
// Recursive call to next lower level directory
|
||||
cc_ = cc_->add(crwDirs, crwTagId);
|
||||
@ -727,9 +727,9 @@ namespace Exiv2 {
|
||||
}
|
||||
if (cc_ == 0) {
|
||||
// Tag doesn't exist yet, add it
|
||||
m_ = AutoPtr(new CiffEntry(crwTagId, tag()));
|
||||
m_ = UniquePtr(new CiffEntry(crwTagId, tag()));
|
||||
cc_ = m_.get();
|
||||
add(m_);
|
||||
add(std::move(m_));
|
||||
}
|
||||
}
|
||||
return cc_;
|
||||
@ -845,7 +845,7 @@ namespace Exiv2 {
|
||||
|
||||
// Make
|
||||
ExifKey key1("Exif.Image.Make");
|
||||
Value::AutoPtr value1 = Value::create(ciffComponent.typeId());
|
||||
Value::UniquePtr value1 = Value::create(ciffComponent.typeId());
|
||||
uint32_t i = 0;
|
||||
for (; i < ciffComponent.size()
|
||||
&& ciffComponent.pData()[i] != '\0'; ++i) {
|
||||
@ -856,7 +856,7 @@ namespace Exiv2 {
|
||||
|
||||
// Model
|
||||
ExifKey key2("Exif.Image.Model");
|
||||
Value::AutoPtr value2 = Value::create(ciffComponent.typeId());
|
||||
Value::UniquePtr value2 = Value::create(ciffComponent.typeId());
|
||||
uint32_t j = i;
|
||||
for (; i < ciffComponent.size()
|
||||
&& ciffComponent.pData()[i] != '\0'; ++i) {
|
||||
@ -985,7 +985,7 @@ namespace Exiv2 {
|
||||
assert(pCrwMapping != 0);
|
||||
// create a key and value pair
|
||||
ExifKey key(pCrwMapping->tag_, Internal::groupName(pCrwMapping->ifdId_));
|
||||
Value::AutoPtr value;
|
||||
Value::UniquePtr value;
|
||||
if (ciffComponent.typeId() != directory) {
|
||||
value = Value::create(ciffComponent.typeId());
|
||||
uint32_t size = 0;
|
||||
|
||||
@ -84,7 +84,7 @@ namespace Exiv2 {
|
||||
class CiffComponent {
|
||||
public:
|
||||
//! CiffComponent auto_ptr type
|
||||
typedef std::auto_ptr<CiffComponent> AutoPtr;
|
||||
typedef std::unique_ptr<CiffComponent> UniquePtr;
|
||||
//! Container type to hold all metadata
|
||||
typedef std::vector<CiffComponent*> Components;
|
||||
|
||||
@ -107,7 +107,7 @@ namespace Exiv2 {
|
||||
// Default assignment operator is fine
|
||||
|
||||
//! Add a component to the composition
|
||||
void add(AutoPtr component);
|
||||
void add(UniquePtr component);
|
||||
/*!
|
||||
@brief Add \em crwTagId to the parse tree, if it doesn't exist
|
||||
yet. \em crwDirs contains the path of subdirectories, starting
|
||||
@ -250,7 +250,7 @@ namespace Exiv2 {
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
//! Implements add()
|
||||
virtual void doAdd(AutoPtr component) =0;
|
||||
virtual void doAdd(UniquePtr component) =0;
|
||||
//! Implements add(). The default implementation does nothing.
|
||||
virtual CiffComponent* doAdd(CrwDirs& crwDirs, uint16_t crwTagId);
|
||||
//! Implements remove(). The default implementation does nothing.
|
||||
@ -321,7 +321,7 @@ namespace Exiv2 {
|
||||
//@{
|
||||
using CiffComponent::doAdd;
|
||||
// See base class comment
|
||||
virtual void doAdd(AutoPtr component);
|
||||
virtual void doAdd(UniquePtr component);
|
||||
/*!
|
||||
@brief Implements write(). Writes only the value data of the entry,
|
||||
using writeValueData().
|
||||
@ -373,7 +373,7 @@ namespace Exiv2 {
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
// See base class comment
|
||||
virtual void doAdd(AutoPtr component);
|
||||
virtual void doAdd(UniquePtr component);
|
||||
// See base class comment
|
||||
virtual CiffComponent* doAdd(CrwDirs& crwDirs, uint16_t crwTagId);
|
||||
// See base class comment
|
||||
@ -414,7 +414,7 @@ namespace Exiv2 {
|
||||
private:
|
||||
// DATA
|
||||
Components components_; //!< List of components in this dir
|
||||
AutoPtr m_; // used by recursive doAdd
|
||||
UniquePtr m_; // used by recursive doAdd
|
||||
CiffComponent* cc_;
|
||||
|
||||
}; // class CiffDirectory
|
||||
@ -428,7 +428,7 @@ namespace Exiv2 {
|
||||
class CiffHeader {
|
||||
public:
|
||||
//! CiffHeader auto_ptr type
|
||||
typedef std::auto_ptr<CiffHeader> AutoPtr;
|
||||
typedef std::unique_ptr<CiffHeader> UniquePtr;
|
||||
|
||||
//! @name Creators
|
||||
//@{
|
||||
|
||||
@ -656,9 +656,9 @@ namespace Exiv2 {
|
||||
return record_;
|
||||
}
|
||||
|
||||
IptcKey::AutoPtr IptcKey::clone() const
|
||||
IptcKey::UniquePtr IptcKey::clone() const
|
||||
{
|
||||
return AutoPtr(clone_());
|
||||
return UniquePtr(clone_());
|
||||
}
|
||||
|
||||
IptcKey* IptcKey::clone_() const
|
||||
|
||||
1188
src/epsimage.cpp
1188
src/epsimage.cpp
File diff suppressed because it is too large
Load Diff
42
src/exif.cpp
42
src/exif.cpp
@ -80,7 +80,7 @@ namespace {
|
||||
class Thumbnail {
|
||||
public:
|
||||
//! Shortcut for a %Thumbnail auto pointer.
|
||||
typedef std::auto_ptr<Thumbnail> AutoPtr;
|
||||
typedef std::unique_ptr<Thumbnail> UniquePtr;
|
||||
|
||||
//! @name Creators
|
||||
//@{
|
||||
@ -89,7 +89,7 @@ namespace {
|
||||
//@}
|
||||
|
||||
//! Factory function to create a thumbnail for the Exif metadata provided.
|
||||
static AutoPtr create(const Exiv2::ExifData& exifData);
|
||||
static UniquePtr create(const Exiv2::ExifData& exifData);
|
||||
|
||||
//! @name Accessors
|
||||
//@{
|
||||
@ -123,7 +123,7 @@ namespace {
|
||||
class TiffThumbnail : public Thumbnail {
|
||||
public:
|
||||
//! Shortcut for a %TiffThumbnail auto pointer.
|
||||
typedef std::auto_ptr<TiffThumbnail> AutoPtr;
|
||||
typedef std::unique_ptr<TiffThumbnail> UniquePtr;
|
||||
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
@ -147,7 +147,7 @@ namespace {
|
||||
class JpegThumbnail : public Thumbnail {
|
||||
public:
|
||||
//! Shortcut for a %JpegThumbnail auto pointer.
|
||||
typedef std::auto_ptr<JpegThumbnail> AutoPtr;
|
||||
typedef std::unique_ptr<JpegThumbnail> UniquePtr;
|
||||
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
@ -192,10 +192,10 @@ namespace Exiv2 {
|
||||
template<typename T>
|
||||
Exiv2::Exifdatum& setValue(Exiv2::Exifdatum& exifDatum, const T& value)
|
||||
{
|
||||
std::auto_ptr<Exiv2::ValueType<T> > v
|
||||
= std::auto_ptr<Exiv2::ValueType<T> >(new Exiv2::ValueType<T>);
|
||||
std::unique_ptr<Exiv2::ValueType<T> > v
|
||||
= std::unique_ptr<Exiv2::ValueType<T> >(new Exiv2::ValueType<T>);
|
||||
v->value_.push_back(value);
|
||||
exifDatum.value_ = v;
|
||||
exifDatum.value_ = std::move(v);
|
||||
return exifDatum;
|
||||
}
|
||||
|
||||
@ -416,9 +416,9 @@ namespace Exiv2 {
|
||||
return value_.get() == 0 ? Rational(-1, 1) : value_->toRational(n);
|
||||
}
|
||||
|
||||
Value::AutoPtr Exifdatum::getValue() const
|
||||
Value::UniquePtr Exifdatum::getValue() const
|
||||
{
|
||||
return value_.get() == 0 ? Value::AutoPtr(0) : value_->clone();
|
||||
return value_.get() == 0 ? nullptr : value_->clone();
|
||||
}
|
||||
|
||||
long Exifdatum::sizeDataArea() const
|
||||
@ -438,14 +438,14 @@ namespace Exiv2 {
|
||||
|
||||
DataBuf ExifThumbC::copy() const
|
||||
{
|
||||
Thumbnail::AutoPtr thumbnail = Thumbnail::create(exifData_);
|
||||
Thumbnail::UniquePtr thumbnail = Thumbnail::create(exifData_);
|
||||
if (thumbnail.get() == 0) return DataBuf();
|
||||
return thumbnail->copy(exifData_);
|
||||
}
|
||||
|
||||
long ExifThumbC::writeFile(const std::string& path) const
|
||||
{
|
||||
Thumbnail::AutoPtr thumbnail = Thumbnail::create(exifData_);
|
||||
Thumbnail::UniquePtr thumbnail = Thumbnail::create(exifData_);
|
||||
if (thumbnail.get() == 0) return 0;
|
||||
std::string name = path + thumbnail->extension();
|
||||
DataBuf buf(thumbnail->copy(exifData_));
|
||||
@ -456,7 +456,7 @@ namespace Exiv2 {
|
||||
#ifdef EXV_UNICODE_PATH
|
||||
long ExifThumbC::writeFile(const std::wstring& wpath) const
|
||||
{
|
||||
Thumbnail::AutoPtr thumbnail = Thumbnail::create(exifData_);
|
||||
Thumbnail::UniquePtr thumbnail = Thumbnail::create(exifData_);
|
||||
if (thumbnail.get() == 0) return 0;
|
||||
std::wstring name = wpath + thumbnail->wextension();
|
||||
DataBuf buf(thumbnail->copy(exifData_));
|
||||
@ -467,14 +467,14 @@ namespace Exiv2 {
|
||||
#endif
|
||||
const char* ExifThumbC::mimeType() const
|
||||
{
|
||||
Thumbnail::AutoPtr thumbnail = Thumbnail::create(exifData_);
|
||||
Thumbnail::UniquePtr thumbnail = Thumbnail::create(exifData_);
|
||||
if (thumbnail.get() == 0) return "";
|
||||
return thumbnail->mimeType();
|
||||
}
|
||||
|
||||
const char* ExifThumbC::extension() const
|
||||
{
|
||||
Thumbnail::AutoPtr thumbnail = Thumbnail::create(exifData_);
|
||||
Thumbnail::UniquePtr thumbnail = Thumbnail::create(exifData_);
|
||||
if (thumbnail.get() == 0) return "";
|
||||
return thumbnail->extension();
|
||||
}
|
||||
@ -482,7 +482,7 @@ namespace Exiv2 {
|
||||
#ifdef EXV_UNICODE_PATH
|
||||
const wchar_t* ExifThumbC::wextension() const
|
||||
{
|
||||
Thumbnail::AutoPtr thumbnail = Thumbnail::create(exifData_);
|
||||
Thumbnail::UniquePtr thumbnail = Thumbnail::create(exifData_);
|
||||
if (thumbnail.get() == 0) return EXV_WIDEN("");
|
||||
return thumbnail->wextension();
|
||||
}
|
||||
@ -726,7 +726,7 @@ namespace Exiv2 {
|
||||
|
||||
// Encode and check if the result fits into a JPEG Exif APP1 segment
|
||||
MemIo mio1;
|
||||
std::auto_ptr<TiffHeaderBase> header(new TiffHeader(byteOrder, 0x00000008, false));
|
||||
std::unique_ptr<TiffHeaderBase> header(new TiffHeader(byteOrder, 0x00000008, false));
|
||||
WriteMethod wm = TiffParserWorker::encode(mio1,
|
||||
pData,
|
||||
size,
|
||||
@ -860,26 +860,26 @@ namespace Exiv2 {
|
||||
namespace {
|
||||
|
||||
//! @cond IGNORE
|
||||
Thumbnail::AutoPtr Thumbnail::create(const Exiv2::ExifData& exifData)
|
||||
Thumbnail::UniquePtr Thumbnail::create(const Exiv2::ExifData& exifData)
|
||||
{
|
||||
Thumbnail::AutoPtr thumbnail;
|
||||
Thumbnail::UniquePtr thumbnail;
|
||||
const Exiv2::ExifKey k1("Exif.Thumbnail.Compression");
|
||||
Exiv2::ExifData::const_iterator pos = exifData.findKey(k1);
|
||||
if (pos != exifData.end()) {
|
||||
if (pos->count() == 0) return thumbnail;
|
||||
long compression = pos->toLong();
|
||||
if (compression == 6) {
|
||||
thumbnail = Thumbnail::AutoPtr(new JpegThumbnail);
|
||||
thumbnail = Thumbnail::UniquePtr(new JpegThumbnail);
|
||||
}
|
||||
else {
|
||||
thumbnail = Thumbnail::AutoPtr(new TiffThumbnail);
|
||||
thumbnail = Thumbnail::UniquePtr(new TiffThumbnail);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const Exiv2::ExifKey k2("Exif.Thumbnail.JPEGInterchangeFormat");
|
||||
pos = exifData.findKey(k2);
|
||||
if (pos != exifData.end()) {
|
||||
thumbnail = Thumbnail::AutoPtr(new JpegThumbnail);
|
||||
thumbnail = Thumbnail::UniquePtr(new JpegThumbnail);
|
||||
}
|
||||
}
|
||||
return thumbnail;
|
||||
|
||||
@ -151,7 +151,7 @@ int main(int argc, char* const argv[])
|
||||
try {
|
||||
// Create the required action class
|
||||
Action::TaskFactory& taskFactory = Action::TaskFactory::instance();
|
||||
Action::Task::AutoPtr task = taskFactory.create(Action::TaskType(params.action_));
|
||||
Action::Task::UniquePtr task = taskFactory.create(Action::TaskType(params.action_));
|
||||
assert(task.get());
|
||||
|
||||
// Process all files
|
||||
@ -1042,13 +1042,12 @@ int Params::getopt(int argc, char* const Argv[])
|
||||
longs["--years" ] = "-Y";
|
||||
|
||||
for ( int i = 0 ; i < argc ; i++ ) {
|
||||
std::string* arg = new std::string(Argv[i]);
|
||||
if (longs.find(*arg) != longs.end() ) {
|
||||
argv[i] = ::strdup(longs[*arg].c_str());
|
||||
std::string arg(Argv[i]);
|
||||
if (longs.find(arg) != longs.end() ) {
|
||||
argv[i] = ::strdup(longs[arg].c_str());
|
||||
} else {
|
||||
argv[i] = ::strdup(Argv[i]);
|
||||
}
|
||||
delete arg;
|
||||
}
|
||||
|
||||
int rc = Util::Getopt::getopt(argc, argv, optstring_);
|
||||
|
||||
@ -36,8 +36,8 @@
|
||||
// class member definitions
|
||||
namespace Exiv2 {
|
||||
|
||||
GifImage::GifImage(BasicIo::AutoPtr io)
|
||||
: Image(ImageType::gif, mdNone, io)
|
||||
GifImage::GifImage(BasicIo::UniquePtr io)
|
||||
: Image(ImageType::gif, mdNone, std::move(io))
|
||||
{
|
||||
} // GifImage::GifImage
|
||||
|
||||
@ -98,9 +98,9 @@ namespace Exiv2 {
|
||||
|
||||
// *************************************************************************
|
||||
// free functions
|
||||
Image::AutoPtr newGifInstance(BasicIo::AutoPtr io, bool /*create*/)
|
||||
Image::UniquePtr newGifInstance(BasicIo::UniquePtr io, bool /*create*/)
|
||||
{
|
||||
Image::AutoPtr image(new GifImage(io));
|
||||
Image::UniquePtr image(new GifImage(std::move(io)));
|
||||
if (!image->good())
|
||||
{
|
||||
image.reset();
|
||||
|
||||
@ -33,7 +33,6 @@
|
||||
#endif// EXV_ENABLE_BMFF
|
||||
#include "cr2image.hpp"
|
||||
#include "crwimage.hpp"
|
||||
#include "epsimage.hpp"
|
||||
#include "jpgimage.hpp"
|
||||
#include "mrwimage.hpp"
|
||||
#ifdef EXV_HAVE_LIBZ
|
||||
@ -124,7 +123,6 @@ namespace {
|
||||
#endif // EXV_HAVE_LIBZ
|
||||
{ ImageType::pgf, newPgfInstance, isPgfType, amReadWrite, amReadWrite, amReadWrite, amReadWrite },
|
||||
{ ImageType::raf, newRafInstance, isRafType, amRead, amRead, amRead, amNone },
|
||||
{ ImageType::eps, newEpsInstance, isEpsType, amNone, amNone, amReadWrite, amNone },
|
||||
{ ImageType::xmp, newXmpInstance, isXmpType, amReadWrite, amReadWrite, amReadWrite, amNone },
|
||||
{ ImageType::gif, newGifInstance, isGifType, amNone, amNone, amNone, amNone },
|
||||
{ ImageType::psd, newPsdInstance, isPsdType, amReadWrite, amReadWrite, amReadWrite, amNone },
|
||||
@ -152,8 +150,8 @@ namespace Exiv2 {
|
||||
|
||||
Image::Image(int imageType,
|
||||
uint16_t supportedMetadata,
|
||||
BasicIo::AutoPtr io)
|
||||
: io_(io),
|
||||
BasicIo::UniquePtr io)
|
||||
: io_(std::move(io)),
|
||||
pixelWidth_(0),
|
||||
pixelHeight_(0),
|
||||
imageType_(imageType),
|
||||
@ -848,143 +846,143 @@ namespace Exiv2 {
|
||||
return ImageType::none;
|
||||
} // ImageFactory::getType
|
||||
|
||||
BasicIo::AutoPtr ImageFactory::createIo(const std::string& path, bool useCurl)
|
||||
BasicIo::UniquePtr ImageFactory::createIo(const std::string& path, bool useCurl)
|
||||
{
|
||||
Protocol fProt = fileProtocol(path);
|
||||
|
||||
#ifdef EXV_USE_SSH
|
||||
if (fProt == pSsh || fProt == pSftp) {
|
||||
return BasicIo::AutoPtr(new SshIo(path)); // may throw
|
||||
return BasicIo::UniquePtr(new SshIo(path)); // may throw
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef EXV_USE_CURL
|
||||
if (useCurl && (fProt == pHttp || fProt == pHttps || fProt == pFtp)) {
|
||||
return BasicIo::AutoPtr(new CurlIo(path)); // may throw
|
||||
return BasicIo::UniquePtr(new CurlIo(path)); // may throw
|
||||
}
|
||||
#endif
|
||||
|
||||
if (fProt == pHttp)
|
||||
return BasicIo::AutoPtr(new HttpIo(path)); // may throw
|
||||
return BasicIo::UniquePtr(new HttpIo(path)); // may throw
|
||||
if (fProt == pFileUri)
|
||||
return BasicIo::AutoPtr(new FileIo(pathOfFileUrl(path)));
|
||||
return BasicIo::UniquePtr(new FileIo(pathOfFileUrl(path)));
|
||||
if (fProt == pStdin || fProt == pDataUri)
|
||||
return BasicIo::AutoPtr(new XPathIo(path)); // may throw
|
||||
return BasicIo::UniquePtr(new XPathIo(path)); // may throw
|
||||
|
||||
return BasicIo::AutoPtr(new FileIo(path));
|
||||
return BasicIo::UniquePtr(new FileIo(path));
|
||||
|
||||
(void)(useCurl);
|
||||
} // ImageFactory::createIo
|
||||
|
||||
#ifdef EXV_UNICODE_PATH
|
||||
BasicIo::AutoPtr ImageFactory::createIo(const std::wstring& wpath, bool useCurl)
|
||||
BasicIo::UniquePtr ImageFactory::createIo(const std::wstring& wpath, bool useCurl)
|
||||
{
|
||||
Protocol fProt = fileProtocol(wpath);
|
||||
#ifdef EXV_USE_SSH
|
||||
if (fProt == pSsh || fProt == pSftp) {
|
||||
return BasicIo::AutoPtr(new SshIo(wpath));
|
||||
return BasicIo::UniquePtr(new SshIo(wpath));
|
||||
}
|
||||
#endif
|
||||
#ifdef EXV_USE_CURL
|
||||
if (useCurl && (fProt == pHttp || fProt == pHttps || fProt == pFtp)) {
|
||||
return BasicIo::AutoPtr(new CurlIo(wpath));
|
||||
return BasicIo::UniquePtr(new CurlIo(wpath));
|
||||
}
|
||||
#endif
|
||||
if (fProt == pHttp)
|
||||
return BasicIo::AutoPtr(new HttpIo(wpath));
|
||||
return BasicIo::UniquePtr(new HttpIo(wpath));
|
||||
if (fProt == pFileUri)
|
||||
return BasicIo::AutoPtr(new FileIo(pathOfFileUrl(wpath)));
|
||||
return BasicIo::UniquePtr(new FileIo(pathOfFileUrl(wpath)));
|
||||
if (fProt == pStdin || fProt == pDataUri)
|
||||
return BasicIo::AutoPtr(new XPathIo(wpath)); // may throw
|
||||
return BasicIo::AutoPtr(new FileIo(wpath));
|
||||
return BasicIo::UniquePtr(new XPathIo(wpath)); // may throw
|
||||
return BasicIo::UniquePtr(new FileIo(wpath));
|
||||
} // ImageFactory::createIo
|
||||
#endif
|
||||
Image::AutoPtr ImageFactory::open(const std::string& path, bool useCurl)
|
||||
Image::UniquePtr ImageFactory::open(const std::string& path, bool useCurl)
|
||||
{
|
||||
Image::AutoPtr image = open(ImageFactory::createIo(path, useCurl)); // may throw
|
||||
Image::UniquePtr image = open(ImageFactory::createIo(path, useCurl)); // may throw
|
||||
if (image.get() == 0) throw Error(kerFileContainsUnknownImageType, path);
|
||||
return image;
|
||||
}
|
||||
|
||||
#ifdef EXV_UNICODE_PATH
|
||||
Image::AutoPtr ImageFactory::open(const std::wstring& wpath, bool useCurl)
|
||||
Image::UniquePtr ImageFactory::open(const std::wstring& wpath, bool useCurl)
|
||||
{
|
||||
Image::AutoPtr image = open(ImageFactory::createIo(wpath, useCurl)); // may throw
|
||||
Image::UniquePtr image = open(ImageFactory::createIo(wpath, useCurl)); // may throw
|
||||
if (image.get() == 0) throw WError(kerFileContainsUnknownImageType, wpath);
|
||||
return image;
|
||||
}
|
||||
|
||||
#endif
|
||||
Image::AutoPtr ImageFactory::open(const byte* data, long size)
|
||||
Image::UniquePtr ImageFactory::open(const byte* data, long size)
|
||||
{
|
||||
BasicIo::AutoPtr io(new MemIo(data, size));
|
||||
Image::AutoPtr image = open(io); // may throw
|
||||
BasicIo::UniquePtr io(new MemIo(data, size));
|
||||
Image::UniquePtr image = open(std::move(io)); // may throw
|
||||
if (image.get() == 0) throw Error(kerMemoryContainsUnknownImageType);
|
||||
return image;
|
||||
}
|
||||
|
||||
Image::AutoPtr ImageFactory::open(BasicIo::AutoPtr io)
|
||||
Image::UniquePtr ImageFactory::open(BasicIo::UniquePtr io)
|
||||
{
|
||||
if (io->open() != 0) {
|
||||
throw Error(kerDataSourceOpenFailed, io->path(), strError());
|
||||
}
|
||||
for (unsigned int i = 0; registry[i].imageType_ != ImageType::none; ++i) {
|
||||
if (registry[i].isThisType_(*io, false)) {
|
||||
return registry[i].newInstance_(io, false);
|
||||
return registry[i].newInstance_(std::move(io), false);
|
||||
}
|
||||
}
|
||||
return Image::AutoPtr();
|
||||
return Image::UniquePtr();
|
||||
} // ImageFactory::open
|
||||
|
||||
Image::AutoPtr ImageFactory::create(int type,
|
||||
Image::UniquePtr ImageFactory::create(int type,
|
||||
const std::string& path)
|
||||
{
|
||||
std::auto_ptr<FileIo> fileIo(new FileIo(path));
|
||||
std::unique_ptr<FileIo> fileIo(new FileIo(path));
|
||||
// Create or overwrite the file, then close it
|
||||
if (fileIo->open("w+b") != 0) {
|
||||
throw Error(kerFileOpenFailed, path, "w+b", strError());
|
||||
}
|
||||
fileIo->close();
|
||||
BasicIo::AutoPtr io(fileIo);
|
||||
Image::AutoPtr image = create(type, io);
|
||||
BasicIo::UniquePtr io(std::move(fileIo));
|
||||
Image::UniquePtr image = create(type, std::move(io));
|
||||
if (image.get() == 0) throw Error(kerUnsupportedImageType, type);
|
||||
return image;
|
||||
}
|
||||
|
||||
#ifdef EXV_UNICODE_PATH
|
||||
Image::AutoPtr ImageFactory::create(int type,
|
||||
Image::UniquePtr ImageFactory::create(int type,
|
||||
const std::wstring& wpath)
|
||||
{
|
||||
std::auto_ptr<FileIo> fileIo(new FileIo(wpath));
|
||||
std::unique_ptr<FileIo> fileIo(new FileIo(wpath));
|
||||
// Create or overwrite the file, then close it
|
||||
if (fileIo->open("w+b") != 0) {
|
||||
throw WError(kerFileOpenFailed, wpath, "w+b", strError().c_str());
|
||||
}
|
||||
fileIo->close();
|
||||
BasicIo::AutoPtr io(fileIo);
|
||||
Image::AutoPtr image = create(type, io);
|
||||
BasicIo::UniquePtr io(fileIo);
|
||||
Image::UniquePtr image = create(type, io);
|
||||
if (image.get() == 0) throw Error(kerUnsupportedImageType, type);
|
||||
return image;
|
||||
}
|
||||
|
||||
#endif
|
||||
Image::AutoPtr ImageFactory::create(int type)
|
||||
Image::UniquePtr ImageFactory::create(int type)
|
||||
{
|
||||
BasicIo::AutoPtr io(new MemIo);
|
||||
Image::AutoPtr image = create(type, io);
|
||||
BasicIo::UniquePtr io(new MemIo);
|
||||
Image::UniquePtr image = create(type, std::move(io));
|
||||
if (image.get() == 0) throw Error(kerUnsupportedImageType, type);
|
||||
return image;
|
||||
}
|
||||
|
||||
Image::AutoPtr ImageFactory::create(int type,
|
||||
BasicIo::AutoPtr io)
|
||||
Image::UniquePtr ImageFactory::create(int type,
|
||||
BasicIo::UniquePtr io)
|
||||
{
|
||||
// BasicIo instance does not need to be open
|
||||
const Registry* r = find(registry, type);
|
||||
if (0 != r) {
|
||||
return r->newInstance_(io, true);
|
||||
return r->newInstance_(std::move(io), true);
|
||||
}
|
||||
return Image::AutoPtr();
|
||||
return Image::UniquePtr();
|
||||
} // ImageFactory::create
|
||||
|
||||
// *****************************************************************************
|
||||
|
||||
10
src/iptc.cpp
10
src/iptc.cpp
@ -198,9 +198,9 @@ namespace Exiv2 {
|
||||
return value_.get() == 0 ? Rational(-1, 1) : value_->toRational(n);
|
||||
}
|
||||
|
||||
Value::AutoPtr Iptcdatum::getValue() const
|
||||
Value::UniquePtr Iptcdatum::getValue() const
|
||||
{
|
||||
return value_.get() == 0 ? Value::AutoPtr(0) : value_->clone();
|
||||
return value_.get() == 0 ? nullptr : value_->clone();
|
||||
}
|
||||
|
||||
const Value& Iptcdatum::value() const
|
||||
@ -225,9 +225,9 @@ namespace Exiv2 {
|
||||
|
||||
Iptcdatum& Iptcdatum::operator=(const uint16_t& value)
|
||||
{
|
||||
UShortValue::AutoPtr v(new UShortValue);
|
||||
UShortValue::UniquePtr v(new UShortValue);
|
||||
v->value_.push_back(value);
|
||||
value_ = v;
|
||||
value_ = std::move(v);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -553,7 +553,7 @@ namespace {
|
||||
uint32_t sizeData
|
||||
)
|
||||
{
|
||||
Exiv2::Value::AutoPtr value;
|
||||
Exiv2::Value::UniquePtr value;
|
||||
Exiv2::TypeId type = Exiv2::IptcDataSets::dataSetType(dataSet, record);
|
||||
value = Exiv2::Value::create(type);
|
||||
int rc = value->read(data, sizeData, Exiv2::bigEndian);
|
||||
|
||||
@ -132,8 +132,8 @@ struct Jp2UuidBox
|
||||
namespace Exiv2
|
||||
{
|
||||
|
||||
Jp2Image::Jp2Image(BasicIo::AutoPtr io, bool create)
|
||||
: Image(ImageType::jp2, mdExif | mdIptc | mdXmp, io)
|
||||
Jp2Image::Jp2Image(BasicIo::UniquePtr io, bool create)
|
||||
: Image(ImageType::jp2, mdExif | mdIptc | mdXmp, std::move(io))
|
||||
{
|
||||
if (create)
|
||||
{
|
||||
@ -592,7 +592,7 @@ static void boxes_check(size_t b,size_t m)
|
||||
if (bIsExif && bRecursive && rawData.size_ > 8) { // "II*\0long"
|
||||
if ((rawData.pData_[0] == rawData.pData_[1]) &&
|
||||
(rawData.pData_[0] == 'I' || rawData.pData_[0] == 'M')) {
|
||||
BasicIo::AutoPtr p = BasicIo::AutoPtr(new MemIo(rawData.pData_, rawData.size_));
|
||||
BasicIo::UniquePtr p = BasicIo::UniquePtr(new MemIo(rawData.pData_, rawData.size_));
|
||||
printTiffStructure(*p, out, option, depth);
|
||||
}
|
||||
}
|
||||
@ -628,7 +628,7 @@ static void boxes_check(size_t b,size_t m)
|
||||
throw Error(kerDataSourceOpenFailed, io_->path(), strError());
|
||||
}
|
||||
IoCloser closer(*io_);
|
||||
BasicIo::AutoPtr tempIo(new MemIo);
|
||||
BasicIo::UniquePtr tempIo(new MemIo);
|
||||
assert (tempIo.get() != 0);
|
||||
|
||||
doWriteMetadata(*tempIo); // may throw
|
||||
@ -949,9 +949,9 @@ static void boxes_check(size_t b,size_t m)
|
||||
|
||||
// *************************************************************************
|
||||
// free functions
|
||||
Image::AutoPtr newJp2Instance(BasicIo::AutoPtr io, bool create)
|
||||
Image::UniquePtr newJp2Instance(BasicIo::UniquePtr io, bool create)
|
||||
{
|
||||
Image::AutoPtr image(new Jp2Image(io, create));
|
||||
Image::UniquePtr image(new Jp2Image(std::move(io), create));
|
||||
if (!image->good())
|
||||
{
|
||||
image.reset();
|
||||
|
||||
@ -299,9 +299,9 @@ namespace Exiv2 {
|
||||
|
||||
} // Photoshop::setIptcIrb
|
||||
|
||||
JpegBase::JpegBase(int type, BasicIo::AutoPtr io, bool create,
|
||||
JpegBase::JpegBase(int type, BasicIo::UniquePtr io, bool create,
|
||||
const byte initData[], long dataSize)
|
||||
: Image(type, mdExif | mdIptc | mdXmp | mdComment, io)
|
||||
: Image(type, mdExif | mdIptc | mdXmp | mdComment, std::move(io))
|
||||
{
|
||||
if (create) {
|
||||
initImage(initData, dataSize);
|
||||
@ -791,7 +791,7 @@ namespace Exiv2 {
|
||||
IptcData::printStructure(out, makeSlice(exif, 0, size), depth);
|
||||
} else {
|
||||
// create a copy on write memio object with the data, then print the structure
|
||||
BasicIo::AutoPtr p = BasicIo::AutoPtr(new MemIo(exif + start, size - start));
|
||||
BasicIo::UniquePtr p = BasicIo::UniquePtr(new MemIo(exif + start, size - start));
|
||||
if (start < max)
|
||||
printTiffStructure(*p, out, option, depth);
|
||||
}
|
||||
@ -869,7 +869,7 @@ namespace Exiv2 {
|
||||
// exiv2 -pS E.jpg
|
||||
|
||||
// binary copy io_ to a temporary file
|
||||
BasicIo::AutoPtr tempIo(new MemIo);
|
||||
BasicIo::UniquePtr tempIo(new MemIo);
|
||||
|
||||
assert(tempIo.get() != 0);
|
||||
for (uint64_t i = 0; i < (count / 2) + 1; i++) {
|
||||
@ -902,7 +902,7 @@ namespace Exiv2 {
|
||||
throw Error(kerDataSourceOpenFailed, io_->path(), strError());
|
||||
}
|
||||
IoCloser closer(*io_);
|
||||
BasicIo::AutoPtr tempIo(new MemIo);
|
||||
BasicIo::UniquePtr tempIo(new MemIo);
|
||||
assert (tempIo.get() != 0);
|
||||
|
||||
doWriteMetadata(*tempIo); // may throw
|
||||
@ -1321,8 +1321,8 @@ namespace Exiv2 {
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xDA,0x00,0x0C,0x03,0x01,0x00,0x02,
|
||||
0x11,0x03,0x11,0x00,0x3F,0x00,0xA0,0x00,0x0F,0xFF,0xD9 };
|
||||
|
||||
JpegImage::JpegImage(BasicIo::AutoPtr io, bool create)
|
||||
: JpegBase(ImageType::jpeg, io, create, blank_, sizeof(blank_))
|
||||
JpegImage::JpegImage(BasicIo::UniquePtr io, bool create)
|
||||
: JpegBase(ImageType::jpeg, std::move(io), create, blank_, sizeof(blank_))
|
||||
{
|
||||
}
|
||||
|
||||
@ -1347,9 +1347,9 @@ namespace Exiv2 {
|
||||
return isJpegType(iIo, advance);
|
||||
}
|
||||
|
||||
Image::AutoPtr newJpegInstance(BasicIo::AutoPtr io, bool create)
|
||||
Image::UniquePtr newJpegInstance(BasicIo::UniquePtr io, bool create)
|
||||
{
|
||||
Image::AutoPtr image(new JpegImage(io, create));
|
||||
Image::UniquePtr image(new JpegImage(std::move(io), create));
|
||||
if (!image->good()) {
|
||||
image.reset();
|
||||
}
|
||||
@ -1373,8 +1373,8 @@ namespace Exiv2 {
|
||||
const char ExvImage::exiv2Id_[] = "Exiv2";
|
||||
const byte ExvImage::blank_[] = { 0xff,0x01,'E','x','i','v','2',0xff,0xd9 };
|
||||
|
||||
ExvImage::ExvImage(BasicIo::AutoPtr io, bool create)
|
||||
: JpegBase(ImageType::exv, io, create, blank_, sizeof(blank_))
|
||||
ExvImage::ExvImage(BasicIo::UniquePtr io, bool create)
|
||||
: JpegBase(ImageType::exv, std::move(io), create, blank_, sizeof(blank_))
|
||||
{
|
||||
}
|
||||
|
||||
@ -1400,10 +1400,10 @@ namespace Exiv2 {
|
||||
return isExvType(iIo, advance);
|
||||
}
|
||||
|
||||
Image::AutoPtr newExvInstance(BasicIo::AutoPtr io, bool create)
|
||||
Image::UniquePtr newExvInstance(BasicIo::UniquePtr io, bool create)
|
||||
{
|
||||
Image::AutoPtr image;
|
||||
image = Image::AutoPtr(new ExvImage(io, create));
|
||||
Image::UniquePtr image;
|
||||
image = Image::UniquePtr(new ExvImage(std::move(io), create));
|
||||
if (!image->good()) image.reset();
|
||||
return image;
|
||||
}
|
||||
|
||||
@ -34,9 +34,9 @@ namespace Exiv2 {
|
||||
{
|
||||
}
|
||||
|
||||
Key::AutoPtr Key::clone() const
|
||||
Key::UniquePtr Key::clone() const
|
||||
{
|
||||
return AutoPtr(clone_());
|
||||
return UniquePtr(clone_());
|
||||
}
|
||||
|
||||
Key& Key::operator=(const Key& /*rhs*/)
|
||||
|
||||
@ -39,8 +39,8 @@
|
||||
// class member definitions
|
||||
namespace Exiv2 {
|
||||
|
||||
MrwImage::MrwImage(BasicIo::AutoPtr io, bool /*create*/)
|
||||
: Image(ImageType::mrw, mdExif | mdIptc | mdXmp, io)
|
||||
MrwImage::MrwImage(BasicIo::UniquePtr io, bool /*create*/)
|
||||
: Image(ImageType::mrw, mdExif | mdIptc | mdXmp, std::move(io))
|
||||
{
|
||||
} // MrwImage::MrwImage
|
||||
|
||||
@ -153,9 +153,9 @@ namespace Exiv2 {
|
||||
|
||||
// *************************************************************************
|
||||
// free functions
|
||||
Image::AutoPtr newMrwInstance(BasicIo::AutoPtr io, bool create)
|
||||
Image::UniquePtr newMrwInstance(BasicIo::UniquePtr io, bool create)
|
||||
{
|
||||
Image::AutoPtr image(new MrwImage(io, create));
|
||||
Image::UniquePtr image(new MrwImage(std::move(io), create));
|
||||
if (!image->good()) {
|
||||
image.reset();
|
||||
}
|
||||
|
||||
@ -43,8 +43,8 @@ namespace Exiv2 {
|
||||
|
||||
using namespace Internal;
|
||||
|
||||
OrfImage::OrfImage(BasicIo::AutoPtr io, bool create)
|
||||
: TiffImage(/*ImageType::orf, mdExif | mdIptc | mdXmp,*/ io,create)
|
||||
OrfImage::OrfImage(BasicIo::UniquePtr io, bool create)
|
||||
: TiffImage(/*ImageType::orf, mdExif | mdIptc | mdXmp,*/ std::move(io),create)
|
||||
{
|
||||
setTypeSupported(ImageType::orf, mdExif | mdIptc | mdXmp);
|
||||
} // OrfImage::OrfImage
|
||||
@ -189,7 +189,7 @@ namespace Exiv2 {
|
||||
ed.end());
|
||||
}
|
||||
|
||||
std::auto_ptr<TiffHeaderBase> header(new OrfHeader(byteOrder));
|
||||
std::unique_ptr<TiffHeaderBase> header(new OrfHeader(byteOrder));
|
||||
return TiffParserWorker::encode(io,
|
||||
pData,
|
||||
size,
|
||||
@ -204,9 +204,9 @@ namespace Exiv2 {
|
||||
|
||||
// *************************************************************************
|
||||
// free functions
|
||||
Image::AutoPtr newOrfInstance(BasicIo::AutoPtr io, bool create)
|
||||
Image::UniquePtr newOrfInstance(BasicIo::UniquePtr io, bool create)
|
||||
{
|
||||
Image::AutoPtr image(new OrfImage(io, create));
|
||||
Image::UniquePtr image(new OrfImage(std::move(io), create));
|
||||
if (!image->good()) {
|
||||
image.reset();
|
||||
}
|
||||
|
||||
@ -76,8 +76,8 @@ namespace Exiv2 {
|
||||
return result;
|
||||
}
|
||||
|
||||
PgfImage::PgfImage(BasicIo::AutoPtr io, bool create)
|
||||
: Image(ImageType::pgf, mdExif | mdIptc| mdXmp | mdComment, io)
|
||||
PgfImage::PgfImage(BasicIo::UniquePtr io, bool create)
|
||||
: Image(ImageType::pgf, mdExif | mdIptc| mdXmp | mdComment, std::move(io))
|
||||
, bSwap_(isBigEndianPlatform())
|
||||
{
|
||||
if (create)
|
||||
@ -143,7 +143,7 @@ namespace Exiv2 {
|
||||
if (io_->error()) throw Error(kerFailedToReadImageData);
|
||||
if (bufRead != imgData.size_) throw Error(kerInputDataReadFailed);
|
||||
|
||||
Image::AutoPtr image = Exiv2::ImageFactory::open(imgData.pData_, imgData.size_);
|
||||
Image::UniquePtr image = Exiv2::ImageFactory::open(imgData.pData_, imgData.size_);
|
||||
image->readMetadata();
|
||||
exifData() = image->exifData();
|
||||
iptcData() = image->iptcData();
|
||||
@ -158,7 +158,7 @@ namespace Exiv2 {
|
||||
throw Error(kerDataSourceOpenFailed, io_->path(), strError());
|
||||
}
|
||||
IoCloser closer(*io_);
|
||||
BasicIo::AutoPtr tempIo(new MemIo);
|
||||
BasicIo::UniquePtr tempIo(new MemIo);
|
||||
assert (tempIo.get() != 0);
|
||||
|
||||
doWriteMetadata(*tempIo); // may throw
|
||||
@ -192,7 +192,7 @@ namespace Exiv2 {
|
||||
int w, h;
|
||||
DataBuf header = readPgfHeaderStructure(*io_, w, h);
|
||||
|
||||
Image::AutoPtr img = ImageFactory::create(ImageType::png);
|
||||
Image::UniquePtr img = ImageFactory::create(ImageType::png);
|
||||
|
||||
img->setExifData(exifData_);
|
||||
img->setIptcData(iptcData_);
|
||||
@ -314,9 +314,9 @@ namespace Exiv2 {
|
||||
|
||||
// *************************************************************************
|
||||
// free functions
|
||||
Image::AutoPtr newPgfInstance(BasicIo::AutoPtr io, bool create)
|
||||
Image::UniquePtr newPgfInstance(BasicIo::UniquePtr io, bool create)
|
||||
{
|
||||
Image::AutoPtr image(new PgfImage(io, create));
|
||||
Image::UniquePtr image(new PgfImage(std::move(io), create));
|
||||
if (!image->good())
|
||||
{
|
||||
image.reset();
|
||||
|
||||
@ -69,8 +69,8 @@ namespace Exiv2 {
|
||||
|
||||
using namespace Internal;
|
||||
|
||||
PngImage::PngImage(BasicIo::AutoPtr io, bool create)
|
||||
: Image(ImageType::png, mdExif | mdIptc | mdXmp | mdComment, io)
|
||||
PngImage::PngImage(BasicIo::UniquePtr io, bool create)
|
||||
: Image(ImageType::png, mdExif | mdIptc | mdXmp | mdComment, std::move(io))
|
||||
{
|
||||
if (create)
|
||||
{
|
||||
@ -356,7 +356,7 @@ namespace Exiv2 {
|
||||
if ( parsedBuf.size_ ) {
|
||||
if ( bExif ) {
|
||||
// create memio object with the data, then print the structure
|
||||
BasicIo::AutoPtr p = BasicIo::AutoPtr(new MemIo(parsedBuf.pData_+6,parsedBuf.size_-6));
|
||||
BasicIo::UniquePtr p = BasicIo::UniquePtr(new MemIo(parsedBuf.pData_+6,parsedBuf.size_-6));
|
||||
printTiffStructure(*p,out,option,depth);
|
||||
}
|
||||
if ( bIptc ) {
|
||||
@ -386,7 +386,7 @@ namespace Exiv2 {
|
||||
}
|
||||
if ( eXIf && option == kpsRecursive ) {
|
||||
// create memio object with the data, then print the structure
|
||||
BasicIo::AutoPtr p = BasicIo::AutoPtr(new MemIo(data,dataOffset));
|
||||
BasicIo::UniquePtr p = BasicIo::UniquePtr(new MemIo(data,dataOffset));
|
||||
printTiffStructure(*p,out,option,depth);
|
||||
}
|
||||
|
||||
@ -523,7 +523,7 @@ namespace Exiv2 {
|
||||
throw Error(kerDataSourceOpenFailed, io_->path(), strError());
|
||||
}
|
||||
IoCloser closer(*io_);
|
||||
BasicIo::AutoPtr tempIo(new MemIo);
|
||||
BasicIo::UniquePtr tempIo(new MemIo);
|
||||
assert (tempIo.get() != 0);
|
||||
|
||||
doWriteMetadata(*tempIo); // may throw
|
||||
@ -738,9 +738,9 @@ namespace Exiv2 {
|
||||
|
||||
// *************************************************************************
|
||||
// free functions
|
||||
Image::AutoPtr newPngInstance(BasicIo::AutoPtr io, bool create)
|
||||
Image::UniquePtr newPngInstance(BasicIo::UniquePtr io, bool create)
|
||||
{
|
||||
Image::AutoPtr image(new PngImage(io, create));
|
||||
Image::UniquePtr image(new PngImage(std::move(io), create));
|
||||
if (!image->good())
|
||||
{
|
||||
image.reset();
|
||||
|
||||
@ -88,10 +88,10 @@ namespace {
|
||||
virtual ~Loader() {}
|
||||
|
||||
//! Loader auto pointer
|
||||
typedef std::auto_ptr<Loader> AutoPtr;
|
||||
typedef std::unique_ptr<Loader> UniquePtr;
|
||||
|
||||
//! Create a Loader subclass for requested id
|
||||
static AutoPtr create(PreviewId id, const Image &image);
|
||||
static UniquePtr create(PreviewId id, const Image &image);
|
||||
|
||||
//! Check if a preview image with given params exists in the image
|
||||
virtual bool valid() const { return valid_; }
|
||||
@ -113,7 +113,7 @@ namespace {
|
||||
Loader(PreviewId id, const Image &image);
|
||||
|
||||
//! Functions that creates a loader from given parameters
|
||||
typedef AutoPtr (*CreateFunc)(PreviewId id, const Image &image, int parIdx);
|
||||
typedef UniquePtr (*CreateFunc)(PreviewId id, const Image &image, int parIdx);
|
||||
|
||||
//! Structure to list possible loaders
|
||||
struct LoaderList {
|
||||
@ -165,7 +165,7 @@ namespace {
|
||||
};
|
||||
|
||||
//! Function to create new LoaderNative
|
||||
Loader::AutoPtr createLoaderNative(PreviewId id, const Image &image, int parIdx);
|
||||
Loader::UniquePtr createLoaderNative(PreviewId id, const Image &image, int parIdx);
|
||||
|
||||
//! Loader for Jpeg previews that are not read into ExifData directly
|
||||
class LoaderExifJpeg : public Loader {
|
||||
@ -199,7 +199,7 @@ namespace {
|
||||
};
|
||||
|
||||
//! Function to create new LoaderExifJpeg
|
||||
Loader::AutoPtr createLoaderExifJpeg(PreviewId id, const Image &image, int parIdx);
|
||||
Loader::UniquePtr createLoaderExifJpeg(PreviewId id, const Image &image, int parIdx);
|
||||
|
||||
//! Loader for Jpeg previews that are read into ExifData
|
||||
class LoaderExifDataJpeg : public Loader {
|
||||
@ -232,7 +232,7 @@ namespace {
|
||||
};
|
||||
|
||||
//! Function to create new LoaderExifDataJpeg
|
||||
Loader::AutoPtr createLoaderExifDataJpeg(PreviewId id, const Image &image, int parIdx);
|
||||
Loader::UniquePtr createLoaderExifDataJpeg(PreviewId id, const Image &image, int parIdx);
|
||||
|
||||
//! Loader for Tiff previews - it can get image data from ExifData or image_.io() as needed
|
||||
class LoaderTiff : public Loader {
|
||||
@ -269,7 +269,7 @@ namespace {
|
||||
};
|
||||
|
||||
//! Function to create new LoaderTiff
|
||||
Loader::AutoPtr createLoaderTiff(PreviewId id, const Image &image, int parIdx);
|
||||
Loader::UniquePtr createLoaderTiff(PreviewId id, const Image &image, int parIdx);
|
||||
|
||||
//! Loader for JPEG previews stored in the XMP metadata
|
||||
class LoaderXmpJpeg : public Loader {
|
||||
@ -292,7 +292,7 @@ namespace {
|
||||
};
|
||||
|
||||
//! Function to create new LoaderXmpJpeg
|
||||
Loader::AutoPtr createLoaderXmpJpeg(PreviewId id, const Image &image, int parIdx);
|
||||
Loader::UniquePtr createLoaderXmpJpeg(PreviewId id, const Image &image, int parIdx);
|
||||
|
||||
// *****************************************************************************
|
||||
// class member definitions
|
||||
@ -372,16 +372,16 @@ namespace {
|
||||
{ "Image2", 0, 0 } // 7
|
||||
};
|
||||
|
||||
Loader::AutoPtr Loader::create(PreviewId id, const Image &image)
|
||||
Loader::UniquePtr Loader::create(PreviewId id, const Image &image)
|
||||
{
|
||||
if (id < 0 || id >= Loader::getNumLoaders())
|
||||
return AutoPtr();
|
||||
return UniquePtr();
|
||||
|
||||
if (loaderList_[id].imageMimeType_ &&
|
||||
std::string(loaderList_[id].imageMimeType_) != image.mimeType())
|
||||
return AutoPtr();
|
||||
return UniquePtr();
|
||||
|
||||
AutoPtr loader = loaderList_[id].create_(id, image, loaderList_[id].parIdx_);
|
||||
UniquePtr loader = loaderList_[id].create_(id, image, loaderList_[id].parIdx_);
|
||||
|
||||
if (loader.get() && !loader->valid()) loader.reset();
|
||||
return loader;
|
||||
@ -425,9 +425,9 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
Loader::AutoPtr createLoaderNative(PreviewId id, const Image &image, int parIdx)
|
||||
Loader::UniquePtr createLoaderNative(PreviewId id, const Image &image, int parIdx)
|
||||
{
|
||||
return Loader::AutoPtr(new LoaderNative(id, image, parIdx));
|
||||
return Loader::UniquePtr(new LoaderNative(id, image, parIdx));
|
||||
}
|
||||
|
||||
PreviewProperties LoaderNative::getProperties() const
|
||||
@ -501,7 +501,7 @@ namespace {
|
||||
const DataBuf data = getData();
|
||||
if (data.size_ == 0) return false;
|
||||
try {
|
||||
Image::AutoPtr image = ImageFactory::open(data.pData_, data.size_);
|
||||
Image::UniquePtr image = ImageFactory::open(data.pData_, data.size_);
|
||||
if (image.get() == 0) return false;
|
||||
image->readMetadata();
|
||||
|
||||
@ -547,9 +547,9 @@ namespace {
|
||||
valid_ = true;
|
||||
}
|
||||
|
||||
Loader::AutoPtr createLoaderExifJpeg(PreviewId id, const Image &image, int parIdx)
|
||||
Loader::UniquePtr createLoaderExifJpeg(PreviewId id, const Image &image, int parIdx)
|
||||
{
|
||||
return Loader::AutoPtr(new LoaderExifJpeg(id, image, parIdx));
|
||||
return Loader::UniquePtr(new LoaderExifJpeg(id, image, parIdx));
|
||||
}
|
||||
|
||||
PreviewProperties LoaderExifJpeg::getProperties() const
|
||||
@ -592,7 +592,7 @@ namespace {
|
||||
const Exiv2::byte* base = io.mmap();
|
||||
|
||||
try {
|
||||
Image::AutoPtr image = ImageFactory::open(base + offset_, size_);
|
||||
Image::UniquePtr image = ImageFactory::open(base + offset_, size_);
|
||||
if (image.get() == 0) return false;
|
||||
image->readMetadata();
|
||||
|
||||
@ -625,9 +625,9 @@ namespace {
|
||||
valid_ = true;
|
||||
}
|
||||
|
||||
Loader::AutoPtr createLoaderExifDataJpeg(PreviewId id, const Image &image, int parIdx)
|
||||
Loader::UniquePtr createLoaderExifDataJpeg(PreviewId id, const Image &image, int parIdx)
|
||||
{
|
||||
return Loader::AutoPtr(new LoaderExifDataJpeg(id, image, parIdx));
|
||||
return Loader::UniquePtr(new LoaderExifDataJpeg(id, image, parIdx));
|
||||
}
|
||||
|
||||
PreviewProperties LoaderExifDataJpeg::getProperties() const
|
||||
@ -669,7 +669,7 @@ namespace {
|
||||
if (buf.size_ == 0) return false;
|
||||
|
||||
try {
|
||||
Image::AutoPtr image = ImageFactory::open(buf.pData_, buf.size_);
|
||||
Image::UniquePtr image = ImageFactory::open(buf.pData_, buf.size_);
|
||||
if (image.get() == 0) return false;
|
||||
image->readMetadata();
|
||||
|
||||
@ -737,9 +737,9 @@ namespace {
|
||||
valid_ = true;
|
||||
}
|
||||
|
||||
Loader::AutoPtr createLoaderTiff(PreviewId id, const Image &image, int parIdx)
|
||||
Loader::UniquePtr createLoaderTiff(PreviewId id, const Image &image, int parIdx)
|
||||
{
|
||||
return Loader::AutoPtr(new LoaderTiff(id, image, parIdx));
|
||||
return Loader::UniquePtr(new LoaderTiff(id, image, parIdx));
|
||||
}
|
||||
|
||||
PreviewProperties LoaderTiff::getProperties() const
|
||||
@ -860,9 +860,9 @@ namespace {
|
||||
valid_ = true;
|
||||
}
|
||||
|
||||
Loader::AutoPtr createLoaderXmpJpeg(PreviewId id, const Image &image, int parIdx)
|
||||
Loader::UniquePtr createLoaderXmpJpeg(PreviewId id, const Image &image, int parIdx)
|
||||
{
|
||||
return Loader::AutoPtr(new LoaderXmpJpeg(id, image, parIdx));
|
||||
return Loader::UniquePtr(new LoaderXmpJpeg(id, image, parIdx));
|
||||
}
|
||||
|
||||
PreviewProperties LoaderXmpJpeg::getProperties() const
|
||||
@ -1141,7 +1141,7 @@ namespace Exiv2 {
|
||||
PreviewPropertiesList list;
|
||||
// go through the loader table and store all successfully created loaders in the list
|
||||
for (PreviewId id = 0; id < Loader::getNumLoaders(); ++id) {
|
||||
Loader::AutoPtr loader = Loader::create(id, image_);
|
||||
Loader::UniquePtr loader = Loader::create(id, image_);
|
||||
if (loader.get() && loader->readDimensions()) {
|
||||
PreviewProperties props = loader->getProperties();
|
||||
DataBuf buf = loader->getData(); // #16 getPreviewImage()
|
||||
@ -1155,7 +1155,7 @@ namespace Exiv2 {
|
||||
|
||||
PreviewImage PreviewManager::getPreviewImage(const PreviewProperties &properties) const
|
||||
{
|
||||
Loader::AutoPtr loader = Loader::create(properties.id_, image_);
|
||||
Loader::UniquePtr loader = Loader::create(properties.id_, image_);
|
||||
DataBuf buf;
|
||||
if (loader.get()) {
|
||||
buf = loader->getData();
|
||||
|
||||
@ -2749,9 +2749,9 @@ namespace Exiv2 {
|
||||
return *this;
|
||||
}
|
||||
|
||||
XmpKey::AutoPtr XmpKey::clone() const
|
||||
XmpKey::UniquePtr XmpKey::clone() const
|
||||
{
|
||||
return AutoPtr(clone_());
|
||||
return UniquePtr(clone_());
|
||||
}
|
||||
|
||||
XmpKey* XmpKey::clone_() const
|
||||
|
||||
@ -117,8 +117,8 @@ enum {
|
||||
// class member definitions
|
||||
namespace Exiv2 {
|
||||
|
||||
PsdImage::PsdImage(BasicIo::AutoPtr io)
|
||||
: Image(ImageType::psd, mdExif | mdIptc | mdXmp, io)
|
||||
PsdImage::PsdImage(BasicIo::UniquePtr io)
|
||||
: Image(ImageType::psd, mdExif | mdIptc | mdXmp, std::move(io))
|
||||
{
|
||||
} // PsdImage::PsdImage
|
||||
|
||||
@ -350,7 +350,7 @@ namespace Exiv2 {
|
||||
throw Error(kerDataSourceOpenFailed, io_->path(), strError());
|
||||
}
|
||||
IoCloser closer(*io_);
|
||||
BasicIo::AutoPtr tempIo(new MemIo);
|
||||
BasicIo::UniquePtr tempIo(new MemIo);
|
||||
assert (tempIo.get() != 0);
|
||||
|
||||
doWriteMetadata(*tempIo); // may throw
|
||||
@ -683,9 +683,9 @@ namespace Exiv2 {
|
||||
|
||||
// *************************************************************************
|
||||
// free functions
|
||||
Image::AutoPtr newPsdInstance(BasicIo::AutoPtr io, bool /*create*/)
|
||||
Image::UniquePtr newPsdInstance(BasicIo::UniquePtr io, bool /*create*/)
|
||||
{
|
||||
Image::AutoPtr image(new PsdImage(io));
|
||||
Image::UniquePtr image(new PsdImage(std::move(io)));
|
||||
if (!image->good())
|
||||
{
|
||||
image.reset();
|
||||
|
||||
@ -41,8 +41,8 @@
|
||||
// class member definitions
|
||||
namespace Exiv2 {
|
||||
|
||||
RafImage::RafImage(BasicIo::AutoPtr io, bool /*create*/)
|
||||
: Image(ImageType::raf, mdExif | mdIptc | mdXmp, io)
|
||||
RafImage::RafImage(BasicIo::UniquePtr io, bool /*create*/)
|
||||
: Image(ImageType::raf, mdExif | mdIptc | mdXmp, std::move(io))
|
||||
{
|
||||
} // RafImage::RafImage
|
||||
|
||||
@ -386,9 +386,9 @@ namespace Exiv2 {
|
||||
|
||||
// *************************************************************************
|
||||
// free functions
|
||||
Image::AutoPtr newRafInstance(BasicIo::AutoPtr io, bool create)
|
||||
Image::UniquePtr newRafInstance(BasicIo::UniquePtr io, bool create)
|
||||
{
|
||||
Image::AutoPtr image(new RafImage(io, create));
|
||||
Image::UniquePtr image(new RafImage(std::move(io), create));
|
||||
if (!image->good()) {
|
||||
image.reset();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user