{
ImageFeatureInfo::ImageFeatureInfo()
- : __pImageFeatureInfoImpl(new _ImageFeatureInfoImpl)
+ : __pImageFeatureInfoImpl(0)
{
+ std::unique_ptr<_ImageFeatureInfoImpl> pImageFeatureInfoImpl (new (std::nothrow) _ImageFeatureInfoImpl());
+ __pImageFeatureInfoImpl = pImageFeatureInfoImpl.release();
}
ImageFeatureInfo::~ImageFeatureInfo()
{
- delete __pImageFeatureInfoImpl;
}
Tizen::Base::String
//get true length of path to allocate memory
length = __pImageFeatureInfoImpl->GetDescription(&ch, 1);
if (!length)
+ {
return Tizen::Base::String("");
+ }
char* pName = new char[length + 1];
int bufWidth = __pImageFeatureInfoImpl->GetThumbnailWidth();
int bufHeight = __pImageFeatureInfoImpl->GetThumbnailHeight();
- if ((bufWidth > 0) && (bufHeight > 0))
+ while ((bufWidth > 0) && (bufHeight > 0))
{
result res = E_FAILURE;
Tizen::Base::ByteBuffer* outBuffer = new Tizen::Base::ByteBuffer();
if (outBuffer == null)
{
- return null;
+ break;
}
res = outBuffer->Construct(bufWidth * bufHeight);
- if(IsFailed(res))
+ if (IsFailed(res))
{
- return null;
+ break;
}
if (__pImageFeatureInfoImpl->GetThumbnail((char*)outBuffer->GetPointer(), bufWidth, bufHeight, false))
{
return outBuffer;
}
- else
- {
- return null;
- }
- }
- else
- {
- return null;
+ break;
}
+ return null;
}
bool
ImageFeatureManager::~ImageFeatureManager(void)
{
- delete __pImageFeatureManagerImpl;
}
result
SysAssertf(__pImageFeatureManagerImpl == null, "Already constructed! ",
"Calling Construct() twice or more on a same instance is not allowed for this class.");
- __pImageFeatureManagerImpl = new (std::nothrow) _ImageFeatureManagerImpl;
- SysTryReturnResult(NID_UIX, __pImageFeatureManagerImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
+ std::unique_ptr<_ImageFeatureManagerImpl> pImageFeatureManagerImpl (new (std::nothrow) _ImageFeatureManagerImpl());
+ SysTryReturn(NID_UIX, pImageFeatureManagerImpl != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ __pImageFeatureManagerImpl = pImageFeatureManagerImpl.release();
__pImageFeatureManagerImpl->InitDB();
return E_SUCCESS;
}
{
SysAssertf(__pImageFeatureManagerImpl != null, "Not yet constructed! Consruct() should be called before use.");
- return __pImageFeatureManagerImpl->SaveDB(true, featureSetFilePath);
+ return __pImageFeatureManagerImpl->SaveDB(true, featureSetFilePath);
}
result
{
ImageObject::ImageObject()
-: __pImageObjectImpl(new _ImageObjectImpl)
+ : __pImageObjectImpl(0)
{
+ std::unique_ptr<_ImageObjectImpl> pImageObjectImpl (new (std::nothrow) _ImageObjectImpl);
+ __pImageObjectImpl = pImageObjectImpl.release();
}
ImageObject::~ImageObject()
{
- delete __pImageObjectImpl;
}
int
ImageObject::GetId(void) const
{
if (__pImageObjectImpl)
+ {
return __pImageObjectImpl->GetId();
+ }
else
+ {
return -1;
+ }
}
int
ImageObject::GetFeatureId(void) const
{
if (__pImageObjectImpl)
+ {
return __pImageObjectImpl->GetFeatureId();
+ }
else
+ {
return -1;
+ }
}
const Tizen::Graphics::FloatMatrix4*
ImageRecognizer::~ImageRecognizer(void)
{
- delete __pImageRecognizerImpl;
}
result
SysAssertf(__pImageRecognizerImpl == null, "Already constructed! ",
"Calling Construct() twice or more on a same instance is not allowed for this class.");
- __pImageRecognizerImpl = new (std::nothrow) _ImageRecognizerImpl;
- SysTryReturnResult(NID_UIX, __pImageRecognizerImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
+ std::unique_ptr<_ImageRecognizerImpl> pImageRecognizerImpl (new (std::nothrow) _ImageRecognizerImpl);
+ SysTryReturn(NID_UIX, pImageRecognizerImpl != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ __pImageRecognizerImpl = pImageRecognizerImpl.release();
+
return E_SUCCESS;
}
QrCodeGenerator::~QrCodeGenerator(void)
{
- delete __pQrCodeGeneratorImpl;
}
result
SysAssertf(__pQrCodeGeneratorImpl == null, "Already constructed! ",
"Calling Construct() twice or more on a same instance is not allowed for this class.");
- __pQrCodeGeneratorImpl = new (std::nothrow) _QrCodeGeneratorImpl;
- SysTryReturnResult(NID_UIX, __pQrCodeGeneratorImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
+ std::unique_ptr<_QrCodeGeneratorImpl> pQrCodeGeneratorImpl(new (std::nothrow) _QrCodeGeneratorImpl());
+ SysTryReturn(NID_UIX, pQrCodeGeneratorImpl != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ __pQrCodeGeneratorImpl = pQrCodeGeneratorImpl.release();
+
return E_SUCCESS;
}
Tizen::Text::Utf8Encoding utf8;
__pQrCodeGeneratorImpl->Encode((char*) utf8.GetBytesN(message)->GetPointer(), mode, error_level, compatibility);
-
__pQrCodeGeneratorImpl->GetSize(width, height);
Tizen::Base::ByteBuffer* buffer = new Tizen::Base::ByteBuffer;
if (__pQrCodeGeneratorImpl->SaveToBuffer((unsigned char*) buffer->GetPointer()))
{
return buffer;
- } else {
+ }
+ else
+ {
delete buffer;
return null;
}
{
QrCodeObject::QrCodeObject(void)
- : __pQrCodeObjectImpl(new _QrCodeObjectImpl)
+ : __pQrCodeObjectImpl(0)
{
+ std::unique_ptr<_QrCodeObjectImpl> pQrCodeObjectImpl(new (std::nothrow) _QrCodeObjectImpl());
+ __pQrCodeObjectImpl = pQrCodeObjectImpl.release();
}
QrCodeObject::~QrCodeObject(void)
{
- delete __pQrCodeObjectImpl;
}
int
QrCodeRecognizer::~QrCodeRecognizer(void)
{
- if(__pQrCodeRecognizerImpl != NULL)
- {
- __pQrCodeRecognizerImpl->Destroy();
- }
-
- delete __pQrCodeRecognizerImpl;
- __pQrCodeRecognizerImpl = null;
}
result
SysAssertf(__pQrCodeRecognizerImpl == null, "Already constructed! ",
"Calling Construct() twice or more on a same instance is not allowed for this class.");
- __pQrCodeRecognizerImpl = new (std::nothrow) _QrCodeRecognizerImpl;
- SysTryReturnResult(NID_UIX, __pQrCodeRecognizerImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
+ std::unique_ptr<_QrCodeRecognizerImpl> pQrCodeRecognizerImpl(new (std::nothrow) _QrCodeRecognizerImpl());
+ SysTryReturn(NID_UIX, pQrCodeRecognizerImpl != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ __pQrCodeRecognizerImpl = pQrCodeRecognizerImpl.release();
return __pQrCodeRecognizerImpl->Init() ? E_SUCCESS : E_FAILURE;
}
static float array[4] = {0.f};
result r = __pQrCodeRecognizerImpl->GetROI(array) ? E_SUCCESS : E_FAILURE;
- if(r == E_SUCCESS)
+ if (r == E_SUCCESS)
{
- roi.SetBounds(array[0],array[1],array[2]-array[0],array[3]-array[1]);
+ roi.SetBounds(array[0], array[1], array[2] - array[0], array[3] - array[1]);
}
return r;
}
{
__indices.RemoveAll();
- if(!__imageFeatureManager)
+ if (!__imageFeatureManager)
return;
int total = __imageFeatureManager->totalNumberOfImages();
- for(int i = 0; i < total; i++)
+ for (int i = 0; i < total; i++)
{
- if(0 != sari2::ImageFeatureInfo(__imageFeatureManager, i).imageWidth())
+ if (sari2::ImageFeatureInfo(__imageFeatureManager, i).isActive())
{
__indices.Add(i);
}
/// \return Path size.
unsigned int imagePath(char* path, unsigned int length) const;
+
+ /// \brief valuate if the object is available for query.
+ /// \return true if object is available
+ bool isActive(void) const;
+
/// \brief Width of image of corresponding object from the database.
/// \return Image width.
int imageWidth(void) const;