types.hpp File Reference

Type definitions for Exiv2 and related functionality. More...

#include "config.h"
#include "version.hpp"
#include <string>
#include <vector>
#include <iosfwd>
#include <utility>
#include <algorithm>
#include <sstream>
#include <stdint.h>

Classes

class  Exiv2::TypeInfo
 Type information lookup functions. Implemented as a static class. More...
 
struct  Exiv2::DataBufRef
 Auxiliary type to enable copies and assignments, similar to std::auto_ptr_ref. See http://www.josuttis.com/libbook/auto_ptr.html for a discussion. More...
 
class  Exiv2::DataBuf
 Utility class containing a character array. All it does is to take care of memory allocation and deletion. Its primary use is meant to be as a stack variable in functions that need a temporary data buffer. More...
 

Namespaces

 Exiv2
 Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of the objects of this namespace.
 

Macros

#define EXV_CALL_MEMBER_FN(object, ptrToMember)   ((object).*(ptrToMember))
 Macro to make calls to member functions through a pointer more readable. See the C++ FAQ LITE, item [33.5] How can I avoid syntax errors when calling a member function using a pointer-to-member-function?.
 
#define EXV_MIN(a, b)   ((a) < (b) ? (a) : (b))
 Simple common min macro.
 
#define EXV_MAX(a, b)   ((a) > (b) ? (a) : (b))
 Simple common max macro.
 
#define EXV_COUNTOF(a)   (sizeof(Exiv2::sizer(a)))
 Macro to determine the size of an array.
 

Typedefs

typedef uint8_t Exiv2::byte
 1 byte unsigned integer type.
 
typedef std::pair< uint32_t, uint32_t > Exiv2::URational
 8 byte unsigned rational type.
 
typedef std::pair< int32_t, int32_t > Exiv2::Rational
 8 byte signed rational type.
 
typedef std::vector< byte > Exiv2::Blob
 Container for binary data.
 

Enumerations

enum  Exiv2::ByteOrder { invalidByteOrder, littleEndian, bigEndian }
 Type to express the byte order (little or big endian)
 
enum  Exiv2::WriteMethod { wmIntrusive, wmNonIntrusive }
 Type to indicate write method used by TIFF parsers.
 
enum  Exiv2::MetadataId {
  mdNone =0, mdExif =1, mdIptc =2, mdComment =4,
  mdXmp =8, mdIccProfile =16
}
 An identifier for each type of metadata.
 
enum  Exiv2::AccessMode { amNone =0, amRead =1, amWrite =2, amReadWrite =3 }
 An identifier for each mode of metadata support.
 
enum  Exiv2::TypeId {
  Exiv2::unsignedByte = 1, Exiv2::asciiString = 2, Exiv2::unsignedShort = 3, Exiv2::unsignedLong = 4,
  Exiv2::unsignedRational = 5, Exiv2::signedByte = 6, Exiv2::undefined = 7, Exiv2::signedShort = 8,
  Exiv2::signedLong = 9, Exiv2::signedRational =10, Exiv2::tiffFloat =11, Exiv2::tiffDouble =12,
  Exiv2::tiffIfd =13, Exiv2::string =0x10000, Exiv2::date =0x10001, Exiv2::time =0x10002,
  Exiv2::comment =0x10003, Exiv2::directory =0x10004, Exiv2::xmpText =0x10005, Exiv2::xmpAlt =0x10006,
  Exiv2::xmpBag =0x10007, Exiv2::xmpSeq =0x10008, Exiv2::langAlt =0x10009, Exiv2::invalidTypeId =0x1fffe,
  Exiv2::lastTypeId =0x1ffff
}
 Exiv2 value type identifiers. More...
 

Functions

EXIV2API uint16_t Exiv2::getUShort (const byte *buf, ByteOrder byteOrder)
 Read a 2 byte unsigned short value from the data buffer.
 
EXIV2API uint32_t Exiv2::getULong (const byte *buf, ByteOrder byteOrder)
 Read a 4 byte unsigned long value from the data buffer.
 
EXIV2API URational Exiv2::getURational (const byte *buf, ByteOrder byteOrder)
 Read an 8 byte unsigned rational value from the data buffer.
 
EXIV2API int16_t Exiv2::getShort (const byte *buf, ByteOrder byteOrder)
 Read a 2 byte signed short value from the data buffer.
 
EXIV2API int32_t Exiv2::getLong (const byte *buf, ByteOrder byteOrder)
 Read a 4 byte signed long value from the data buffer.
 
EXIV2API Rational Exiv2::getRational (const byte *buf, ByteOrder byteOrder)
 Read an 8 byte signed rational value from the data buffer.
 
EXIV2API float Exiv2::getFloat (const byte *buf, ByteOrder byteOrder)
 Read a 4 byte single precision floating point value (IEEE 754 binary32) from the data buffer.
 
EXIV2API double Exiv2::getDouble (const byte *buf, ByteOrder byteOrder)
 Read an 8 byte double precision floating point value (IEEE 754 binary64) from the data buffer.
 
EXIV2API std::ostream & Exiv2::operator<< (std::ostream &os, const Rational &r)
 Output operator for our fake rational.
 
EXIV2API std::istream & Exiv2::operator>> (std::istream &is, Rational &r)
 Input operator for our fake rational.
 
EXIV2API std::ostream & Exiv2::operator<< (std::ostream &os, const URational &r)
 Output operator for our fake unsigned rational.
 
EXIV2API std::istream & Exiv2::operator>> (std::istream &is, URational &r)
 Input operator for our fake unsigned rational.
 
EXIV2API long Exiv2::us2Data (byte *buf, uint16_t s, ByteOrder byteOrder)
 Convert an unsigned short to data, write the data to the buffer, return number of bytes written.
 
EXIV2API long Exiv2::ul2Data (byte *buf, uint32_t l, ByteOrder byteOrder)
 Convert an unsigned long to data, write the data to the buffer, return number of bytes written.
 
EXIV2API long Exiv2::ur2Data (byte *buf, URational l, ByteOrder byteOrder)
 Convert an unsigned rational to data, write the data to the buffer, return number of bytes written.
 
EXIV2API long Exiv2::s2Data (byte *buf, int16_t s, ByteOrder byteOrder)
 Convert a signed short to data, write the data to the buffer, return number of bytes written.
 
EXIV2API long Exiv2::l2Data (byte *buf, int32_t l, ByteOrder byteOrder)
 Convert a signed long to data, write the data to the buffer, return number of bytes written.
 
EXIV2API long Exiv2::r2Data (byte *buf, Rational l, ByteOrder byteOrder)
 Convert a signed rational to data, write the data to the buffer, return number of bytes written.
 
EXIV2API long Exiv2::f2Data (byte *buf, float f, ByteOrder byteOrder)
 Convert a single precision floating point (IEEE 754 binary32) float to data, write the data to the buffer, return number of bytes written.
 
EXIV2API long Exiv2::d2Data (byte *buf, double d, ByteOrder byteOrder)
 Convert a double precision floating point (IEEE 754 binary64) double to data, write the data to the buffer, return number of bytes written.
 
EXIV2API void Exiv2::hexdump (std::ostream &os, const byte *buf, long len, long offset=0)
 Print len bytes from buf in hex and ASCII format to the given stream, prefixed with the position in the buffer adjusted by offset.
 
EXIV2API bool Exiv2::isHex (const std::string &str, size_t size=0, const std::string &prefix="")
 Return true if str is a hex number starting with prefix followed by size hex digits, false otherwise. If size is 0, any number of digits is allowed and all are checked.
 
EXIV2API int Exiv2::exifTime (const char *buf, struct tm *tm)
 Converts a string in the form "%Y:%m:%d %H:%M:%S", e.g., "2007:05:24 12:31:55" to broken down time format, returns 0 if successful, else 1.
 
EXIV2API const char * Exiv2::exvGettext (const char *str)
 Translate a string using the gettext framework. This wrapper hides all the implementation details from the interface.
 
EXIV2API long Exiv2::parseLong (const std::string &s, bool &ok)
 Return a long set to the value represented by s. More...
 
EXIV2API float Exiv2::parseFloat (const std::string &s, bool &ok)
 Return a float set to the value represented by s. More...
 
EXIV2API Rational Exiv2::parseRational (const std::string &s, bool &ok)
 Return a Rational set to the value represented by s. More...
 
EXIV2API Rational Exiv2::floatToRationalCast (float f)
 Very simple conversion of a float to a Rational. More...
 
template<typename T , typename K , int N>
const T * Exiv2::find (T(&src)[N], const K &key)
 Find an element that matches key in the array src. More...
 
template<typename T , int N>
char(& Exiv2::sizer (T(&)[N]))[N]
 Template used in the COUNTOF macro to determine the size of an array.
 
template<typename T >
std::string Exiv2::toString (const T &arg)
 Utility function to convert the argument of any type to a string.
 
template<typename T >
Exiv2::stringTo (const std::string &s, bool &ok)
 Utility function to convert a string to a value of type T. More...
 
template<>
bool Exiv2::stringTo< bool > (const std::string &s, bool &ok)
 Specialization of stringTo(const std::string& s, bool& ok) for bool. More...
 
template<typename IntType >
IntType Exiv2::gcd (IntType n, IntType m)
 Return the greatest common denominator of n and m. (Implementation from Boost rational.hpp) More...
 

Detailed Description

Type definitions for Exiv2 and related functionality.

Version
Rev
3090
Author
Andreas Huggel (ahu) ahuggel@gmx.net
Date
09-Jan-04, ahu: created
11-Feb-04, ahu: isolated as a component
31-Jul-04, brad: added Time, Data and String values