Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Examples

Exiv2::ImageFactory Class Reference

Image factory. More...

#include <image.hpp>

Collaboration diagram for Exiv2::ImageFactory:

Collaboration graph
[legend]
List of all members.

Public Member Functions

Manipulators
void registerImage (Image::Type type, NewInstanceFct newInst, IsThisTypeFct isType)
 Register image type together with its function pointers.
Accessors
Imageopen (const std::string &path) const
 Create an Image of the appropriate type by opening the specified file. File type is derived from the contents of the file.
Imagecreate (Image::Type type, const std::string &path) const
 Create an Image of the requested type by creating a new file. If the file already exists, it will be overwritten.
Image::Type getType (const std::string &path) const
 Returns the image type of the provided file.

Static Public Member Functions

ImageFactoryinstance ()
 Get access to the image factory.

Detailed Description

Image factory.

Creates an instance of the image of the requested type. The factory is implemented as a singleton, which can be accessed only through the static member function instance().


Member Function Documentation

Image * Exiv2::ImageFactory::create Image::Type  type,
const std::string &  path
const
 

Create an Image of the requested type by creating a new file. If the file already exists, it will be overwritten.

Parameters:
type Type of the image to be created.
path Image file. The contents of the file are tested to determine the image type to open. File extension is ignored.
Returns:
A pointer that owns an Image of the requested type. Caller must delete the returned object. If the image type is not supported, the pointer is 0.

Image::Type Exiv2::ImageFactory::getType const std::string &  path  )  const
 

Returns the image type of the provided file.

Parameters:
path Image file. The contents of the file are tested to determine the image type. File extension is ignored.
Returns:
Image type of Image::none if the type is not recognized.

ImageFactory & Exiv2::ImageFactory::instance  )  [static]
 

Get access to the image factory.

Clients access the image factory exclusively through this method.

Image * Exiv2::ImageFactory::open const std::string &  path  )  const
 

Create an Image of the appropriate type by opening the specified file. File type is derived from the contents of the file.

Parameters:
path Image file. The contents of the file are tested to determine the image type to open. File extension is ignored.
Returns:
A pointer that owns an Image of the type derived from the file. Caller must delete the returned object. If no image type could be determined, the pointer is 0.

void Exiv2::ImageFactory::registerImage Image::Type  type,
NewInstanceFct  newInst,
IsThisTypeFct  isType
 

Register image type together with its function pointers.

The image factory creates new images calling their associated function pointer. Additional images can be added by registering new type and function pointers. If called for a type that already exists in the list, the corresponding prototype is replaced.

Parameters:
type Image type.
newInst Function pointer for creating image instances.
isType Function pointer to test for matching image types.


The documentation for this class was generated from the following files:
Generated on Mon Sep 13 22:01:43 2004 for Exiv2 by doxygen 1.3.8