Maps SDK for C++ 1.0.0
Loading...
Searching...
No Matches
gem::ImageDatabase Class Reference

ImageDatabase object. More...

Inheritance diagram for gem::ImageDatabase:
Collaboration diagram for gem::ImageDatabase:

Public Member Functions

 ImageDatabase (const ImageDatabase &)=delete
 Disable copy constructor.
 ImageDatabase (ImageDatabase &&)=default
 Default move constructor noexcept is deduced.
ImageDatabase & operator= (const ImageDatabase &img)=delete
 Delete copy assignment.
ImageDatabase & operator= (ImageDatabase &&img)=default
 Default move assignment noexcept is deduced.
Image getImageById (unsigned id) const noexcept
 Obtain the image by providing the ID.
Image getImageByIndex (int index) const noexcept
 Obtain the image by providing the image index.
int getImageCount () const noexcept
 Get the number of images.
Image import (DataBuffer const &data, int format) noexcept
 Import a new image from file.
int import (const String &path) noexcept
 Import icons from the given database path.
int remove (unsigned id) noexcept
 Remove an image from the database by providing the id.
template<typename TCollector>
bool iterateImages (TCollector collector) const noexcept
 Iterate all images in the database.

Detailed Description

ImageDatabase object.

Manager of the image database.

Implements share read/write Api object over IIconDatabase.

This behaves like a singleton, i.e. all instances are shared behind the same API interface

Member Function Documentation

◆ getImageById()

Image gem::ImageDatabase::getImageById ( unsigned id) const
inlinenoexcept

Obtain the image by providing the ID.

Parameters
[in]idThe image ID
Returns
The image object

◆ getImageByIndex()

Image gem::ImageDatabase::getImageByIndex ( int index) const
inlinenoexcept

Obtain the image by providing the image index.

Parameters
[in]indexThe image index
Returns
The image object

◆ getImageCount()

int gem::ImageDatabase::getImageCount ( ) const
inlinenoexcept

Get the number of images.

Returns
The number of images

◆ import() [1/2]

int gem::ImageDatabase::import ( const String & path)
inlinenoexcept

Import icons from the given database path.

Parameters
[in]pathThe database path

Only icons which do not already exist are imported.

Returns
On success, returns the number of imported icons. On error, returns a error value

◆ import() [2/2]

Image gem::ImageDatabase::import ( DataBuffer const & data,
int format )
inlinenoexcept

Import a new image from file.

Parameters
[in]dataThe image data
[in]formatThe image format, see EImageFileFormat
Returns
imported Image. User must keep the image id in order get the image using getImageById GEM_GET_API_ERROR will return error::kExist if image was already imported

◆ iterateImages()

template<typename TCollector>
bool gem::ImageDatabase::iterateImages ( TCollector collector) const
inlinenoexcept

Iterate all images in the database.

Collector should have the following signature bool( const ImageRef ) Collector must return true if iteration should continue and false if iteration should stop

Parameters
[in]collectorThe collector
Returns
True if all images were iterated, false if the iteration was stopped by the collector

◆ operator=() [1/2]

ImageDatabase & gem::ImageDatabase::operator= ( const ImageDatabase & img)
delete

Delete copy assignment.

Parameters
imgOther image
Returns
Reference to this object

◆ operator=() [2/2]

ImageDatabase & gem::ImageDatabase::operator= ( ImageDatabase && img)
default

Default move assignment noexcept is deduced.

Parameters
imgOther image
Returns
Reference to this object

◆ remove()

int gem::ImageDatabase::remove ( unsigned id)
inlinenoexcept

Remove an image from the database by providing the id.

Parameters
[in]idThe image id to be removed.
Note
Only images imported with Image::import function can be deleted
Returns
KNoError on success, KNotFound if the image was not found, KGeneral in case of any other error