#include <makernote.hpp>
Static Public Member Functions | |
static void | cleanup () |
Destructor. | |
static void | registerMakerNote (const std::string &make, const std::string &model, CreateFct createMakerNote) |
Register a MakerNote create function for a camera make and model. | |
static void | registerMakerNote (IfdId ifdId, MakerNote::AutoPtr makerNote) |
Register a MakerNote prototype in the IFD id registry. | |
static MakerNote::AutoPtr | create (const std::string &make, const std::string &model, bool alloc, const byte *buf, long len, ByteOrder byteOrder, long offset) |
Create the appropriate MakerNote based on camera make and model and possibly the contents of the makernote itself, return an auto-pointer to the newly created MakerNote instance. Return 0 if no MakerNote is defined for the camera model. | |
static MakerNote::AutoPtr | create (IfdId ifdId, bool alloc=true) |
Create a MakerNote for an IFD id. | |
static int | match (const std::string ®Entry, const std::string &key) |
Match a registry entry with a key (used for make and model). | |
Classes | |
class | Init |
Class Init is used to execute initialisation and termination code exactly once, at the begin and end of the program. More... |
Maintains an associative list (tree) of camera makes/models and corresponding MakerNote create functions. Creates an instance of the MakerNote for one camera make/model. The factory is implemented as a static class.
static void Exiv2::MakerNoteFactory::registerMakerNote | ( | const std::string & | make, | |
const std::string & | model, | |||
CreateFct | createMakerNote | |||
) | [static] |
Register a MakerNote create function for a camera make and model.
Registers a create function for a MakerNote for a given make and model combination with the factory. Both the make and model strings may contain wildcards ('*', e.g., "Canon*"). If the make already exists in the registry, then a new branch for the model is added. If the model also already exists, then the new create function replaces the old one.
make | Camera manufacturer. (Typically the string from the Exif make tag.) | |
model | Camera model. (Typically the string from the Exif model tag.) | |
createMakerNote | Pointer to a function to create a new MakerNote of a particular type. |
static MakerNote::AutoPtr Exiv2::MakerNoteFactory::create | ( | const std::string & | make, | |
const std::string & | model, | |||
bool | alloc, | |||
const byte * | buf, | |||
long | len, | |||
ByteOrder | byteOrder, | |||
long | offset | |||
) | [static] |
Create the appropriate MakerNote based on camera make and model and possibly the contents of the makernote itself, return an auto-pointer to the newly created MakerNote instance. Return 0 if no MakerNote is defined for the camera model.
The method searches the make-model tree for a make and model combination in the registry that matches the search key. The search is case insensitive (Todo: implement case-insensitive comparisons) and wildcards in the registry entries are supported. First the best matching make is searched, then the best matching model for this make is searched. If there is no matching make or no matching model within the models registered for the best matching make, then no makernote is created and the function returns 0. If a match is found, the function invokes the registered create function and returns an auto-pointer to the newly created MakerNote. The makernote pointed to is owned by the caller of the function and the auto-pointer ensures that it is deleted. The best match is an exact match, then a match is rated according to the number of matching characters. The makernote buffer is passed on to the create function, which can based on its content, automatically determine the correct version or flavour of the makernote required. This is used, e.g., to determine which of the three Nikon makernotes to create.
make | Camera manufacturer. (Typically the string from the Exif make tag.) | |
model | Camera model. (Typically the string from the Exif model tag.) | |
alloc | Memory management model for the new MakerNote. Determines if memory required to store data should be allocated and deallocated (true) or not (false). If false, only pointers to the buffer provided to read() will be kept. See Ifd for more background on this concept. | |
buf | Pointer to the makernote character buffer. | |
len | Length of the makernote character buffer. | |
byteOrder | Byte order in which the Exif data (and possibly the makernote) is encoded. | |
offset | Offset from the start of the TIFF header of the makernote buffer. |
static int Exiv2::MakerNoteFactory::match | ( | const std::string & | regEntry, | |
const std::string & | key | |||
) | [static] |
Match a registry entry with a key (used for make and model).
The matching algorithm is case insensitive and wildcards ('*') in the registry entry are supported. The best match is an exact match, then a match is rated according to the number of matching characters.