Blame include/exiv2/convert.hpp

Packit 01d647
// ***************************************************************** -*- C++ -*-
Packit 01d647
/*
Packit 01d647
 * Copyright (C) 2004-2018 Exiv2 authors
Packit 01d647
 * This program is part of the Exiv2 distribution.
Packit 01d647
 *
Packit 01d647
 * This program is free software; you can redistribute it and/or
Packit 01d647
 * modify it under the terms of the GNU General Public License
Packit 01d647
 * as published by the Free Software Foundation; either version 2
Packit 01d647
 * of the License, or (at your option) any later version.
Packit 01d647
 *
Packit 01d647
 * This program is distributed in the hope that it will be useful,
Packit 01d647
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 01d647
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 01d647
 * GNU General Public License for more details.
Packit 01d647
 *
Packit 01d647
 * You should have received a copy of the GNU General Public License
Packit 01d647
 * along with this program; if not, write to the Free Software
Packit 01d647
 * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
Packit 01d647
 */
Packit 01d647
/*!
Packit 01d647
  @file    convert.hpp
Packit 01d647
  @brief   Exif and IPTC conversions to and from XMP
Packit 01d647
  @author  Andreas Huggel (ahu)
Packit 01d647
           ahuggel@gmx.net
Packit 01d647
           Vladimir Nadvornik (vn)
Packit 01d647
           nadvornik@suse.cz
Packit 01d647
  @date    17-Mar-08, ahu: created basic converter framework
Packit 01d647
           20-May-08, vn:  added actual conversion logic
Packit 01d647
 */
Packit 01d647
#ifndef CONVERT_HPP_
Packit 01d647
#define CONVERT_HPP_
Packit 01d647
Packit 01d647
#include "exiv2lib_export.h"
Packit 01d647
Packit 01d647
// included header files
Packit 01d647
#include "config.h"
Packit 01d647
Packit 01d647
// + standard includes
Packit 01d647
#include <string>
Packit 01d647
Packit 01d647
// *****************************************************************************
Packit 01d647
// namespace extensions
Packit 01d647
namespace Exiv2 {
Packit 01d647
Packit 01d647
// *****************************************************************************
Packit 01d647
// class declarations
Packit 01d647
    class ExifData;
Packit 01d647
    class IptcData;
Packit 01d647
    class XmpData;
Packit 01d647
Packit 01d647
// *****************************************************************************
Packit 01d647
// free functions, template and inline definitions
Packit 01d647
Packit 01d647
    //! Convert (copy) Exif tags to XMP properties.
Packit 01d647
    EXIV2API void copyExifToXmp(const ExifData& exifData, XmpData& xmpData);
Packit 01d647
    //! Convert (move) Exif tags to XMP properties, remove converted Exif tags.
Packit 01d647
    EXIV2API void moveExifToXmp(ExifData& exifData, XmpData& xmpData);
Packit 01d647
Packit 01d647
    //! Convert (copy) XMP properties to Exif tags.
Packit 01d647
    EXIV2API void copyXmpToExif(const XmpData& xmpData, ExifData& exifData);
Packit 01d647
    //! Convert (move) XMP properties to Exif tags, remove converted XMP properties.
Packit 01d647
    EXIV2API void moveXmpToExif(XmpData& xmpData, ExifData& exifData);
Packit 01d647
Packit 01d647
    //! Detect which metadata are newer and perform a copy in appropriate direction.
Packit 01d647
    EXIV2API void syncExifWithXmp(ExifData& exifData, XmpData& xmpData);
Packit 01d647
Packit 01d647
    //! Convert (copy) IPTC datasets to XMP properties.
Packit 01d647
    EXIV2API void copyIptcToXmp(const IptcData& iptcData, XmpData& xmpData, const char *iptcCharset = 0);
Packit 01d647
    //! Convert (move) IPTC datasets to XMP properties, remove converted IPTC datasets.
Packit 01d647
    EXIV2API void moveIptcToXmp(IptcData& iptcData, XmpData& xmpData, const char *iptcCharset = 0);
Packit 01d647
Packit 01d647
    //! Convert (copy) XMP properties to IPTC datasets.
Packit 01d647
    EXIV2API void copyXmpToIptc(const XmpData& xmpData, IptcData& iptcData);
Packit 01d647
    //! Convert (move) XMP properties to IPTC tags, remove converted XMP properties.
Packit 01d647
    EXIV2API void moveXmpToIptc(XmpData& xmpData, IptcData& iptcData);
Packit 01d647
Packit 01d647
    /*!
Packit 01d647
      @brief Convert character encoding of \em str from \em from to \em to.
Packit 01d647
             If the function succeeds, \em str contains the result string.
Packit 01d647
Packit 01d647
      This function uses the iconv library, if the %Exiv2 library was compiled
Packit 01d647
      with iconv support.  Otherwise, on Windows, it uses Windows functions to
Packit 01d647
      support a limited number of conversions and fails with a warning if an
Packit 01d647
      unsupported conversion is attempted.  If the function is called but %Exiv2
Packit 01d647
      was not compiled with iconv support and can't use Windows functions, it
Packit 01d647
      fails with a warning.
Packit 01d647
Packit 01d647
      The conversions supported on Windows without iconv are:
Packit 01d647
Packit 01d647
      
Packit 01d647
      fromto
Packit 01d647
      UTF-8     UCS-2BE
Packit 01d647
      UTF-8     UCS-2LE
Packit 01d647
      UCS-2BE   UTF-8
Packit 01d647
      UCS-2BE   UCS-2LE
Packit 01d647
      UCS-2LE   UTF-8
Packit 01d647
      UCS-2LE   UCS-2BE
Packit 01d647
      ISO-8859-1UTF-8
Packit 01d647
      ASCII     UTF-8
Packit 01d647
      
Packit 01d647
Packit 01d647
      @param str  The string to convert. It is updated to the converted string,
Packit 01d647
                  which may have a different size. If the function call fails,
Packit 01d647
                  the string is not modified.
Packit 01d647
      @param from Charset in which the input string is encoded as a name
Packit 01d647
                  understood by \c iconv_open(3).
Packit 01d647
      @param to   Charset to convert the string to as a name
Packit 01d647
                  understood by \c iconv_open(3).
Packit 01d647
      @return Return \c true if the conversion was successful, else \c false.
Packit 01d647
     */
Packit 01d647
    EXIV2API bool convertStringCharset(std::string& str, const char* from, const char* to);
Packit 01d647
Packit 01d647
}                                       // namespace Exiv2
Packit 01d647
Packit 01d647
#endif                                  // #ifndef CONVERT_HPP_