Kanzi Connect  1.1.10
Kanzi Connect C++ API
kanzi::connect::LoadImageTask Class Reference

A resource loading task that can be used to retrieve an image from the network using HTTP or HTTPS. More...

#include <load_image_task.hpp>

Inheritance diagram for kanzi::connect::LoadImageTask:
kanzi::connect::LoadImageTaskHttp

Public Member Functions

virtual void finishFunction (const KzuResourceLoaderThreadContext *context) KZ_OVERRIDE
 A function that is called when the loading is finished. More...
 
virtual ResourceSharedPtr getResult () KZ_OVERRIDE
 A function that is called to retrieve the result of the loading. More...
 
virtual void loadFunction (const KzuResourceLoaderThreadContext *context) KZ_OVERRIDE
 A function that performs the actual resource loading. More...
 
 LoadImageTask (const string &url, Domain *domain)
 Constructor. More...
 
virtual ~LoadImageTask ()=default
 Desctructor. More...
 

Protected Types

enum  ImageType { ImageType::JPG, ImageType::PNG, ImageType::UNSUPPORTED }
 Specifies the supported file types. More...
 

Protected Member Functions

virtual void decodeKanziBitmap (const KzuResourceLoaderThreadContext *context)
 
 LoadImageTask (const LoadImageTask &other) KZ_DELETED_FUNCTION
 No copying. More...
 
LoadImageTaskoperator= (const LoadImageTask &other) KZ_DELETED_FUNCTION
 No assignment. More...
 

Static Protected Member Functions

static ImageType detectImageType (const unsigned char *buffer, size_t lenght)
 Detect image type based on buffer contents. More...
 
static bool isJpgImage (const unsigned char *buffer, size_t size)
 Check if the given buffer contains a valid signature for JPG file. More...
 
static bool isPngImage (const unsigned char *buffer, size_t size)
 Check if the given buffer contains a valid signature for PNG file. More...
 

Protected Attributes

Domain * m_domain
 
BitmapImageUniquePtr m_image
 
vector< char > m_imageData
 
int m_loadResult
 
KzcMemoryManager * m_memoryManager
 
bool m_statusReported
 
TextureSharedPtr m_texture
 
string m_url
 

Detailed Description

A resource loading task that can be used to retrieve an image from the network using HTTP or HTTPS.

Member Enumeration Documentation

◆ ImageType

Specifies the supported file types.

Enumerator
JPG 
PNG 
UNSUPPORTED 

Constructor & Destructor Documentation

◆ LoadImageTask() [1/2]

kanzi::connect::LoadImageTask::LoadImageTask ( const string &  url,
Domain *  domain 
)
explicit

Constructor.

Parameters
urlHTTP url of the resource.
domainKanzi UI Domain.

◆ ~LoadImageTask()

virtual kanzi::connect::LoadImageTask::~LoadImageTask ( )
virtualdefault

Desctructor.

◆ LoadImageTask() [2/2]

kanzi::connect::LoadImageTask::LoadImageTask ( const LoadImageTask other)
protected

No copying.

Member Function Documentation

◆ decodeKanziBitmap()

virtual void kanzi::connect::LoadImageTask::decodeKanziBitmap ( const KzuResourceLoaderThreadContext *  context)
protectedvirtual

◆ detectImageType()

static ImageType kanzi::connect::LoadImageTask::detectImageType ( const unsigned char *  buffer,
size_t  lenght 
)
staticprotected

Detect image type based on buffer contents.

Parameters
bufferContains the image

◆ finishFunction()

virtual void kanzi::connect::LoadImageTask::finishFunction ( const KzuResourceLoaderThreadContext *  context)
virtual

A function that is called when the loading is finished.

Parameters
contextThread context, unused

◆ getResult()

virtual ResourceSharedPtr kanzi::connect::LoadImageTask::getResult ( )
virtual

A function that is called to retrieve the result of the loading.

Returns
A shared pointer to the resource that was loaded.

◆ isJpgImage()

static bool kanzi::connect::LoadImageTask::isJpgImage ( const unsigned char *  buffer,
size_t  size 
)
staticprotected

Check if the given buffer contains a valid signature for JPG file.

Parameters
bufferContains the image

◆ isPngImage()

static bool kanzi::connect::LoadImageTask::isPngImage ( const unsigned char *  buffer,
size_t  size 
)
staticprotected

Check if the given buffer contains a valid signature for PNG file.

Parameters
bufferContains the image

◆ loadFunction()

virtual void kanzi::connect::LoadImageTask::loadFunction ( const KzuResourceLoaderThreadContext *  context)
virtual

A function that performs the actual resource loading.

Parameters
contextThread context, unused

Reimplemented in kanzi::connect::LoadImageTaskHttp.

◆ operator=()

LoadImageTask& kanzi::connect::LoadImageTask::operator= ( const LoadImageTask other)
protected

No assignment.

Member Data Documentation

◆ m_domain

Domain* kanzi::connect::LoadImageTask::m_domain
protected

◆ m_image

BitmapImageUniquePtr kanzi::connect::LoadImageTask::m_image
protected

◆ m_imageData

vector<char> kanzi::connect::LoadImageTask::m_imageData
protected

◆ m_loadResult

int kanzi::connect::LoadImageTask::m_loadResult
protected

◆ m_memoryManager

KzcMemoryManager* kanzi::connect::LoadImageTask::m_memoryManager
protected

◆ m_statusReported

bool kanzi::connect::LoadImageTask::m_statusReported
protected

◆ m_texture

TextureSharedPtr kanzi::connect::LoadImageTask::m_texture
protected

◆ m_url

string kanzi::connect::LoadImageTask::m_url
protected

The documentation for this class was generated from the following file: