* @file FBaseBool.cpp
* @brief This is the implementation file for Boolean class.
*/
-
#include <FBaseBoolean.h>
#include <FBaseResult.h>
-
namespace Tizen { namespace Base
{
bool
Boolean::Equals(const Object& obj) const
{
- const Boolean* pOther = dynamic_cast <const Boolean*>(&obj);
+ const Boolean* pOther = dynamic_cast< const Boolean* >(&obj);
if (pOther == null)
{
return false;
int
Boolean::GetHashCode(void) const
{
- return static_cast<int> (value);
+ return static_cast< int >(value);
}
bool
* @file FBaseBufferBase.cpp
* @brief This is the implementation for BufferBase class.
*/
-
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <FBaseBufferBase.h>
#include <FBaseSysLog.h>
-
namespace Tizen { namespace Base
{
void* pTemp = null;
// check whether the size of memory is larger than the maximum of unsigned int
- unsigned long long size = static_cast <unsigned long long>(sizeof(_BufferData)) +
- static_cast <unsigned long long>(capacity) * static_cast <unsigned long long>(GetTypeSize());
- SysTryReturnResult(NID_BASE, size <= static_cast <unsigned long long>((unsigned int) -1), E_OUT_OF_MEMORY,
+ unsigned long long size = static_cast< unsigned long long >(sizeof(_BufferData)) +
+ static_cast< unsigned long long >(capacity) * static_cast< unsigned long long >(GetTypeSize());
+ SysTryReturnResult(NID_BASE, size <= static_cast< unsigned long long >((unsigned int) -1), E_OUT_OF_MEMORY,
"[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- pTemp = malloc(static_cast <unsigned int>(size));
+ pTemp = malloc(static_cast< unsigned int >(size));
SysTryReturnResult(NID_BASE, 0 != pTemp, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
- memset(pTemp, 0, static_cast <unsigned int>(size));
+ memset(pTemp, 0, static_cast< unsigned int >(size));
- _pData = static_cast <_BufferData*>(pTemp);
+ _pData = static_cast< _BufferData* >(pTemp);
_pData->refCount = 1;
_pData->capacityInByte = capacity * GetTypeSize();
"The capacity is less than the current capacity.");
// check whether the size of memory is larger than the maximum of unsigned int
- unsigned long long size = static_cast <unsigned long long>(sizeof(_BufferData)) +
- static_cast <unsigned long long>(newCapacity) * static_cast <unsigned long long>(GetTypeSize());
+ unsigned long long size = static_cast< unsigned long long >(sizeof(_BufferData)) +
+ static_cast< unsigned long long >(newCapacity) * static_cast< unsigned long long >(GetTypeSize());
- SysTryReturnResult(NID_BASE, size <= static_cast <unsigned long long>((unsigned int) -1), E_OUT_OF_MEMORY,
+ SysTryReturnResult(NID_BASE, size <= static_cast< unsigned long long >((unsigned int) -1), E_OUT_OF_MEMORY,
"Memory allocation failed.");
- _pData = static_cast<_BufferData*>(realloc(_pData, static_cast<unsigned int>(size)));
+ _pData = static_cast< _BufferData* >(realloc(_pData, static_cast< unsigned int >(size)));
SysTryReturnResult(NID_BASE, 0 != _pData, E_OUT_OF_MEMORY, "Memory allocation failed.");
_capacity = newCapacity;
}
BufferBase::_BufferData::_BufferData()
- :capacityInByte(0)
- ,refCount(0)
+ : capacityInByte(0)
+ , refCount(0)
{
}
byte*
BufferBase::_BufferData::GetArray(void)
{
- return reinterpret_cast <byte*>(this + 1);
+ return reinterpret_cast< byte* >(this + 1);
}
}} // Tizen::Base
* @file FBaseByteBuffer.cpp
* @brief This is the implementation for ByteBuffer class.
*/
-
#include <new>
#include <FBaseByteBuffer.h>
#include <FBaseSysLog.h>
#include <unique_ptr.h>
-
static const byte DOUBLE_SIZE = sizeof(double);
static const byte FLOAT_SIZE = sizeof(float);
static const byte INT_SIZE = sizeof(int);
}
result
-ByteBuffer::Construct(const byte *pBuffer, int index, int length, int capacity)
+ByteBuffer::Construct(const byte* pBuffer, int index, int length, int capacity)
{
SysTryReturn(NID_BASE, pBuffer != null, E_INVALID_ARG, E_INVALID_ARG, "[%s] The pBuffer is null.",
GetErrorMessage(E_INVALID_ARG));
void* pTemp = null;
int sizeofBufferData = sizeof(_BufferData);
- __pArrayStart = const_cast<byte *> (pBuffer + index);
+ __pArrayStart = const_cast< byte* >(pBuffer + index);
pTemp = malloc(sizeofBufferData);
SysTryReturn(NID_BASE, pTemp != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s]", GetErrorMessage(E_OUT_OF_MEMORY));
memset(pTemp, 0, sizeofBufferData);
- _pData = static_cast <_BufferData*>(pTemp);
+ _pData = static_cast< _BufferData* >(pTemp);
_pData->refCount = 1;
_pData->capacityInByte = capacity;
byte
ByteBuffer::operator [](int index) const
{
- return const_cast<ByteBuffer&>(*this)[index];
+ return const_cast< ByteBuffer& >(*this)[index];
}
bool
DoubleBuffer*
ByteBuffer::AsDoubleBufferN(void) const
{
- std::unique_ptr<DoubleBuffer> pBuffer(new (std::nothrow) DoubleBuffer());
+ std::unique_ptr< DoubleBuffer > pBuffer(new (std::nothrow) DoubleBuffer());
pBuffer->_pData = _pData;
AddRef();
pBuffer->_capacity = GetRemaining() / DOUBLE_SIZE;
FloatBuffer*
ByteBuffer::AsFloatBufferN(void) const
{
- std::unique_ptr<FloatBuffer> pBuffer(new (std::nothrow) FloatBuffer());
+ std::unique_ptr< FloatBuffer > pBuffer(new (std::nothrow) FloatBuffer());
pBuffer->_pData = _pData;
AddRef();
pBuffer->_capacity = GetRemaining() / FLOAT_SIZE;
IntBuffer*
ByteBuffer::AsIntBufferN(void) const
{
- std::unique_ptr<IntBuffer> pBuffer(new (std::nothrow) IntBuffer());
+ std::unique_ptr< IntBuffer > pBuffer(new (std::nothrow) IntBuffer());
pBuffer->_pData = _pData;
AddRef();
pBuffer->_capacity = GetRemaining() / INT_SIZE;
LongBuffer*
ByteBuffer::AsLongBufferN(void) const
{
- std::unique_ptr<LongBuffer> pBuffer(new (std::nothrow) LongBuffer());
+ std::unique_ptr< LongBuffer > pBuffer(new (std::nothrow) LongBuffer());
pBuffer->_pData = _pData;
AddRef();
pBuffer->_capacity = GetRemaining() / LONG_SIZE;
LongLongBuffer*
ByteBuffer::AsLongLongBufferN(void) const
{
- std::unique_ptr<LongLongBuffer> pBuffer(new (std::nothrow) LongLongBuffer());
+ std::unique_ptr< LongLongBuffer > pBuffer(new (std::nothrow) LongLongBuffer());
pBuffer->_pData = _pData;
AddRef();
pBuffer->_capacity = GetRemaining() / LONGLONG_SIZE;
McharBuffer*
ByteBuffer::AsMcharBufferN(void) const
{
- std::unique_ptr<McharBuffer> pBuffer(new (std::nothrow) McharBuffer());
+ std::unique_ptr< McharBuffer > pBuffer(new (std::nothrow) McharBuffer());
pBuffer->_pData = _pData;
AddRef();
pBuffer->_capacity = GetRemaining() / MCHAR_SIZE;
WcharBuffer*
ByteBuffer::AsWcharBufferN(void) const
{
- std::unique_ptr<WcharBuffer> pBuffer(new (std::nothrow) WcharBuffer());
+ std::unique_ptr< WcharBuffer > pBuffer(new (std::nothrow) WcharBuffer());
pBuffer->_pData = _pData;
AddRef();
pBuffer->_capacity = GetRemaining() / MCHAR_SIZE;
ShortBuffer*
ByteBuffer::AsShortBufferN(void) const
{
- std::unique_ptr<ShortBuffer> pBuffer(new (std::nothrow) ShortBuffer());
+ std::unique_ptr< ShortBuffer > pBuffer(new (std::nothrow) ShortBuffer());
pBuffer->_pData = _pData;
AddRef();
pBuffer->_capacity = GetRemaining() / SHORT_SIZE;
result
ByteBuffer::CopyFrom(ByteBuffer& buffer)
{
- SysTryReturn(NID_BASE, this != static_cast <void*>(&buffer), E_INVALID_ARG, E_INVALID_ARG,
+ SysTryReturn(NID_BASE, this != static_cast< void* >(&buffer), E_INVALID_ARG, E_INVALID_ARG,
"[%s] The source and target buffers are identical.", GetErrorMessage(E_INVALID_ARG));
int copyLength = buffer.GetRemaining();
SysTryReturn(NID_BASE,
GetRemaining() >= DOUBLE_SIZE, E_UNDERFLOW, E_UNDERFLOW,
"[%s] The remaining bytes of this buffer are smaller than the size of double", GetErrorMessage(E_UNDERFLOW));
- value = *reinterpret_cast <double*>(&__pArrayStart[_position]);
+ value = *reinterpret_cast< double* >(&__pArrayStart[_position]);
_position += DOUBLE_SIZE;
return E_SUCCESS;
"[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of double(%d)'.",
GetErrorMessage(E_OUT_OF_RANGE), index, _limit, DOUBLE_SIZE);
- value = *reinterpret_cast <double*>(&__pArrayStart[index]);
+ value = *reinterpret_cast< double* >(&__pArrayStart[index]);
return E_SUCCESS;
}
GetRemaining() >= FLOAT_SIZE, E_UNDERFLOW, E_UNDERFLOW,
"[%s] The remaining bytes of this buffer are smaller than the size of float.", GetErrorMessage(E_UNDERFLOW));
- value = *reinterpret_cast <float*>(&__pArrayStart[_position]);
+ value = *reinterpret_cast< float* >(&__pArrayStart[_position]);
_position += FLOAT_SIZE;
return E_SUCCESS;
"[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of float(%d)'.",
GetErrorMessage(E_OUT_OF_RANGE), index, _limit, FLOAT_SIZE);
- value = *reinterpret_cast <float*>(&__pArrayStart[index]);
+ value = *reinterpret_cast< float* >(&__pArrayStart[index]);
return E_SUCCESS;
}
GetRemaining() >= INT_SIZE, E_UNDERFLOW, E_UNDERFLOW,
"[%s] The remaining bytes of this buffer are smaller than the size of int.", GetErrorMessage(E_UNDERFLOW));
- value = *reinterpret_cast <int*>(&__pArrayStart[_position]);
+ value = *reinterpret_cast< int* >(&__pArrayStart[_position]);
_position += INT_SIZE;
return E_SUCCESS;
"[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of int(%d)'.",
GetErrorMessage(E_OUT_OF_RANGE), index, _limit, INT_SIZE);
- value = *reinterpret_cast <int*>(&__pArrayStart[index]);
+ value = *reinterpret_cast< int* >(&__pArrayStart[index]);
return E_SUCCESS;
}
GetRemaining() >= LONG_SIZE, E_UNDERFLOW, E_UNDERFLOW,
"[%s] The remaining bytes of this buffer are smaller than the size of long.", GetErrorMessage(E_UNDERFLOW));
- value = *reinterpret_cast <long*>(&__pArrayStart[_position]);
+ value = *reinterpret_cast< long* >(&__pArrayStart[_position]);
_position += LONG_SIZE;
return E_SUCCESS;
"[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of long(%d)'.",
GetErrorMessage(E_OUT_OF_RANGE), index, _limit, LONG_SIZE);
- value = *reinterpret_cast <long*>(&__pArrayStart[index]);
+ value = *reinterpret_cast< long* >(&__pArrayStart[index]);
return E_SUCCESS;
}
GetRemaining() >= LONGLONG_SIZE, E_UNDERFLOW, E_UNDERFLOW,
"[%s] The remaining bytes of this buffer are smaller than the size of long long.", GetErrorMessage(E_UNDERFLOW));
- value = *reinterpret_cast <long long*>(&__pArrayStart[_position]);
+ value = *reinterpret_cast< long long* >(&__pArrayStart[_position]);
_position += LONGLONG_SIZE;
return E_SUCCESS;
"[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of long long(%d)'.",
GetErrorMessage(E_OUT_OF_RANGE), index, _limit, LONGLONG_SIZE);
- value = *reinterpret_cast <long long*>(&__pArrayStart[index]);
+ value = *reinterpret_cast< long long* >(&__pArrayStart[index]);
return E_SUCCESS;
}
GetRemaining() >= MCHAR_SIZE, E_UNDERFLOW, E_UNDERFLOW,
"[%s] The remaining bytes of this buffer are smaller than the size of wchar_t.", GetErrorMessage(E_UNDERFLOW));
- value = *reinterpret_cast <wchar_t*>(&__pArrayStart[_position]);
+ value = *reinterpret_cast< wchar_t* >(&__pArrayStart[_position]);
_position += MCHAR_SIZE;
return E_SUCCESS;
GetRemaining() >= MCHAR_SIZE, E_UNDERFLOW, E_UNDERFLOW,
"[%s] The remaining bytes of this buffer are smaller than the size of wchar_t.", GetErrorMessage(E_UNDERFLOW));
- value = *reinterpret_cast <wchar_t*>(&__pArrayStart[_position]);
+ value = *reinterpret_cast< wchar_t* >(&__pArrayStart[_position]);
_position += MCHAR_SIZE;
return E_SUCCESS;
"[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of wchar_t(%d)'.",
GetErrorMessage(E_OUT_OF_RANGE), index, _limit, MCHAR_SIZE);
- value = *reinterpret_cast <wchar_t*>(&__pArrayStart[index]);
+ value = *reinterpret_cast< wchar_t* >(&__pArrayStart[index]);
return E_SUCCESS;
}
"[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of wchar_t(%d)'.",
GetErrorMessage(E_OUT_OF_RANGE), index, _limit, MCHAR_SIZE);
- value = *reinterpret_cast <wchar_t*>(&__pArrayStart[index]);
+ value = *reinterpret_cast< wchar_t* >(&__pArrayStart[index]);
return E_SUCCESS;
}
GetRemaining() >= SHORT_SIZE, E_UNDERFLOW, E_UNDERFLOW,
"[%s] The remaining bytes of this buffer are smaller than the size of short.", GetErrorMessage(E_UNDERFLOW));
- value = *reinterpret_cast <short*>(&__pArrayStart[_position]);
+ value = *reinterpret_cast< short* >(&__pArrayStart[_position]);
_position += SHORT_SIZE;
return E_SUCCESS;
"[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of short(%d)'.",
GetErrorMessage(E_OUT_OF_RANGE), index, _limit, SHORT_SIZE);
- value = *reinterpret_cast <short*>(&__pArrayStart[index]);
+ value = *reinterpret_cast< short* >(&__pArrayStart[index]);
return E_SUCCESS;
}
result
ByteBuffer::ReadFrom(ByteBuffer& buffer)
{
- SysTryReturn(NID_BASE, this != static_cast <void*>(&buffer), E_INVALID_ARG, E_INVALID_ARG,
+ SysTryReturn(NID_BASE, this != static_cast< void* >(&buffer), E_INVALID_ARG, E_INVALID_ARG,
"[%s] The source and target buffers are identical.", GetErrorMessage(E_INVALID_ARG));
int copyLength = (GetRemaining() < buffer.GetRemaining()) ? GetRemaining() : buffer.GetRemaining();
GetRemaining() >= DOUBLE_SIZE, E_OVERFLOW, E_OVERFLOW,
"[%s] The remaining bytes of this buffer are smaller than size of double.", GetErrorMessage(E_OVERFLOW));
- *reinterpret_cast <double*>(&__pArrayStart[_position]) = value;
+ *reinterpret_cast< double* >(&__pArrayStart[_position]) = value;
_position += DOUBLE_SIZE;
return E_SUCCESS;
"[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of double(%d)'.",
GetErrorMessage(E_OUT_OF_RANGE), index, _limit, DOUBLE_SIZE);
- *reinterpret_cast <double*>(&__pArrayStart[index]) = value;
+ *reinterpret_cast< double* >(&__pArrayStart[index]) = value;
return E_SUCCESS;
}
GetRemaining() >= FLOAT_SIZE, E_OVERFLOW, E_OVERFLOW,
"[%s] The remaining bytes of this buffer are smaller than size of float.", GetErrorMessage(E_OVERFLOW));
- *reinterpret_cast <float*>(&__pArrayStart[_position]) = value;
+ *reinterpret_cast< float* >(&__pArrayStart[_position]) = value;
_position += FLOAT_SIZE;
return E_SUCCESS;
"[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of float(%d)'.",
GetErrorMessage(E_OUT_OF_RANGE), index, _limit, FLOAT_SIZE);
- *reinterpret_cast <float*>(&__pArrayStart[index]) = value;
+ *reinterpret_cast< float* >(&__pArrayStart[index]) = value;
return E_SUCCESS;
}
GetRemaining() >= INT_SIZE, E_OVERFLOW, E_OVERFLOW,
"[%s] The remaining bytes of this buffer are smaller than size of int.", GetErrorMessage(E_OVERFLOW));
- *reinterpret_cast <int*>(&__pArrayStart[_position]) = value;
+ *reinterpret_cast< int* >(&__pArrayStart[_position]) = value;
_position += INT_SIZE;
return E_SUCCESS;
"[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of int(%d)'.",
GetErrorMessage(E_OUT_OF_RANGE), index, _limit, INT_SIZE);
- *reinterpret_cast <int*>(&__pArrayStart[index]) = value;
+ *reinterpret_cast< int* >(&__pArrayStart[index]) = value;
return E_SUCCESS;
}
GetRemaining() >= LONG_SIZE, E_OVERFLOW, E_OVERFLOW,
"[%s] The remaining bytes of this buffer are smaller than size of long.", GetErrorMessage(E_OVERFLOW));
- *reinterpret_cast <long*>(&__pArrayStart[_position]) = value;
+ *reinterpret_cast< long* >(&__pArrayStart[_position]) = value;
_position += LONG_SIZE;
return E_SUCCESS;
"[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of long(%d)'.",
GetErrorMessage(E_OUT_OF_RANGE), index, _limit, LONG_SIZE);
- *reinterpret_cast <long*>(&__pArrayStart[index]) = value;
+ *reinterpret_cast< long* >(&__pArrayStart[index]) = value;
return E_SUCCESS;
}
GetRemaining() >= LONGLONG_SIZE, E_OVERFLOW, E_OVERFLOW,
"[%s] The remaining bytes of this buffer are smaller than size of long long.", GetErrorMessage(E_OVERFLOW));
- *reinterpret_cast <long long*>(&__pArrayStart[_position]) = value;
+ *reinterpret_cast< long long* >(&__pArrayStart[_position]) = value;
_position += LONGLONG_SIZE;
return E_SUCCESS;
"[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of long long(%d)'.",
GetErrorMessage(E_OUT_OF_RANGE), index, _limit, LONGLONG_SIZE);
- *reinterpret_cast <long long*>(&__pArrayStart[index]) = value;
+ *reinterpret_cast< long long* >(&__pArrayStart[index]) = value;
return E_SUCCESS;
}
GetRemaining() >= MCHAR_SIZE, E_OVERFLOW, E_OVERFLOW,
"[%s] The remaining bytes of this buffer are smaller than size of wchar_t.", GetErrorMessage(E_OVERFLOW));
- *reinterpret_cast <wchar_t*>(&__pArrayStart[_position]) = value;
+ *reinterpret_cast< wchar_t* >(&__pArrayStart[_position]) = value;
_position += MCHAR_SIZE;
return E_SUCCESS;
GetRemaining() >= MCHAR_SIZE, E_OVERFLOW, E_OVERFLOW,
"[%s] The remaining bytes of this buffer are smaller than size of wchar_t.", GetErrorMessage(E_OVERFLOW));
- *reinterpret_cast <wchar_t*>(&__pArrayStart[_position]) = value;
+ *reinterpret_cast< wchar_t* >(&__pArrayStart[_position]) = value;
_position += MCHAR_SIZE;
return E_SUCCESS;
"[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of wchar_t(%d)'.",
GetErrorMessage(E_OUT_OF_RANGE), index, _limit, MCHAR_SIZE);
- *reinterpret_cast <wchar_t*>(&__pArrayStart[index]) = value;
+ *reinterpret_cast< wchar_t* >(&__pArrayStart[index]) = value;
return E_SUCCESS;
}
"[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of wchar_t(%d)'.",
GetErrorMessage(E_OUT_OF_RANGE), index, _limit, MCHAR_SIZE);
- *reinterpret_cast <wchar_t*>(&__pArrayStart[index]) = value;
+ *reinterpret_cast< wchar_t* >(&__pArrayStart[index]) = value;
return E_SUCCESS;
}
GetRemaining() >= SHORT_SIZE, E_OVERFLOW, E_OVERFLOW,
"[%s] The remaining bytes of this buffer are smaller than size of short.", GetErrorMessage(E_OVERFLOW));
- *reinterpret_cast <short*>(&__pArrayStart[_position]) = value;
+ *reinterpret_cast< short* >(&__pArrayStart[_position]) = value;
_position += SHORT_SIZE;
return E_SUCCESS;
"[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of short(%d)'.",
GetErrorMessage(E_OUT_OF_RANGE), index, _limit, SHORT_SIZE);
- *reinterpret_cast <short*>(&__pArrayStart[index]) = value;
+ *reinterpret_cast< short* >(&__pArrayStart[index]) = value;
return E_SUCCESS;
}
ByteBuffer*
ByteBuffer::SliceN(void) const
{
- std::unique_ptr<ByteBuffer> pBuffer(new (std::nothrow) ByteBuffer());
+ std::unique_ptr< ByteBuffer > pBuffer(new (std::nothrow) ByteBuffer());
pBuffer->_pData = _pData;
AddRef();
pBuffer->_capacity = GetRemaining();
ByteBuffer::Equals(const Tizen::Base::Object& obj) const
{
bool out = false;
- const ByteBuffer* pOther = dynamic_cast <const ByteBuffer*>(&obj);
+ const ByteBuffer* pOther = dynamic_cast< const ByteBuffer* >(&obj);
if (pOther == null)
{
out = false;
int offset = _position;
for (int i = 0; i < len; ++i)
{
- hash = (hash << 5) - hash + static_cast <int>(__pArrayStart[offset + (i * sizeof(hash))]);
+ hash = (hash << 5) - hash + static_cast< int >(__pArrayStart[offset + (i * sizeof(hash))]);
}
return hash;
* @file FBaseCharacter.cpp
* @brief This is the implementation file for Char class.
*/
-
#include <wctype.h>
#include <FBaseCharacter.h>
#include <FApp_AppInfo.h>
#include <FBaseSysLog.h>
#include "FBase_CharacterImpl.h"
-
namespace Tizen { namespace Base
{
bool
Character::Equals(const Object& obj) const
{
- const Character* pOther = dynamic_cast <const Character*>(&obj);
+ const Character* pOther = dynamic_cast< const Character* >(&obj);
if (pOther == null)
{
return false;
if (Tizen::App::_AppInfo::GetApiVersion() == _API_VERSION_2_0 && Tizen::App::_AppInfo::IsOspCompat())
{
- return(iswalpha(ch) !=0);
+ return(iswalpha(ch) != 0);
}
else
{
* @file FBaseDateTime.cpp
* @brief This file contains implementation of DateTime class
*/
-
#include <stdlib.h>
#include <wchar.h>
#include <FBaseDateTime.h>
{
SysTryReturn(NID_BASE,
((year >= MIN_YEAR && year <= _MAX_YEAR) &&
- (month >= MIN_MONTH && month <= MAX_MONTH) &&
- (hour >= MIN_HOUR && hour <= MAX_HOUR) &&
- (minute >= MIN_MINUTE && minute <= MAX_MINUTE) &&
- ((second & LOW_16BIT) >= MIN_SECOND && (second & LOW_16BIT) <= MAX_SECOND) &&
- ((second >> INT_HALF_BIT) >= MIN_TICK && (second >> INT_HALF_BIT) <= MAX_TICK)),
+ (month >= MIN_MONTH && month <= MAX_MONTH) &&
+ (hour >= MIN_HOUR && hour <= MAX_HOUR) &&
+ (minute >= MIN_MINUTE && minute <= MAX_MINUTE) &&
+ ((second & LOW_16BIT) >= MIN_SECOND && (second & LOW_16BIT) <= MAX_SECOND) &&
+ ((second >> INT_HALF_BIT) >= MIN_TICK && (second >> INT_HALF_BIT) <= MAX_TICK)),
E_OUT_OF_RANGE, E_OUT_OF_RANGE,
"[%s] One of the year(%d), month(%d), day(%d), hour(%d), minute(%d), second(%d) and tick(%d) is out of allowable range.",
GetErrorMessage(E_OUT_OF_RANGE), year, month, day, hour, minute, second & LOW_16BIT, second >> INT_HALF_BIT);
{
SysTryReturn(NID_BASE,
((year >= MIN_YEAR && year <= _MAX_YEAR) &&
- (month >= MIN_MONTH && month <= MAX_MONTH) &&
- (hour >= MIN_HOUR && hour <= MAX_HOUR) &&
- (minute >= MIN_MINUTE && minute <= MAX_MINUTE) &&
- (second >= MIN_SECOND && second <= MAX_SECOND) &&
- ((millisecond * TICKS_PER_MILLISECOND >= MIN_TICK) && (millisecond * TICKS_PER_MILLISECOND <= MAX_TICK))),
+ (month >= MIN_MONTH && month <= MAX_MONTH) &&
+ (hour >= MIN_HOUR && hour <= MAX_HOUR) &&
+ (minute >= MIN_MINUTE && minute <= MAX_MINUTE) &&
+ (second >= MIN_SECOND && second <= MAX_SECOND) &&
+ ((millisecond * TICKS_PER_MILLISECOND >= MIN_TICK) && (millisecond * TICKS_PER_MILLISECOND <= MAX_TICK))),
E_OUT_OF_RANGE, E_OUT_OF_RANGE,
"[%s] One of the year(%d), month(%d), day(%d), hour(%d), minute(%d), second(%d) and tick(%d) is out of allowable range.",
GetErrorMessage(E_OUT_OF_RANGE), year, month, day, hour, minute, second, millisecond * TICKS_PER_MILLISECOND);
DateTime::operator ==(const DateTime& rhs) const
{
return((__dateTime.year == rhs.__dateTime.year) && (__dateTime.month == rhs.__dateTime.month)
- && (__dateTime.day == rhs.__dateTime.day) && (__dateTime.hour == rhs.__dateTime.hour) &&
- (__dateTime.minute == rhs.__dateTime.minute) && (__dateTime.second == rhs.__dateTime.second));
+ && (__dateTime.day == rhs.__dateTime.day) && (__dateTime.hour == rhs.__dateTime.hour) &&
+ (__dateTime.minute == rhs.__dateTime.minute) && (__dateTime.second == rhs.__dateTime.second));
}
bool
tmp.__dateTime.year += months / MAX_MONTH; // Get the year to add
int tempMonth = tmp.__dateTime.month + months % MAX_MONTH;
- if (tempMonth > MAX_MONTH) // Month was added and moved to next year
+ if (tempMonth > MAX_MONTH) // Month was added and moved to next year
{
tmp.__dateTime.year++;
tmp.__dateTime.month = tempMonth - MAX_MONTH;
}
- else if (tempMonth <= 0) // Month was subtracted and moved to previous year
+ else if (tempMonth <= 0) // Month was subtracted and moved to previous year
{
tmp.__dateTime.year--;
tmp.__dateTime.month = MAX_MONTH + tempMonth;
}
- else // Keep current year
+ else // Keep current year
{
tmp.__dateTime.month += months % MAX_MONTH;
}
// Check the days in Month
if (tmp.__dateTime.month != 2) // Current month is not Feb
{
- if (tmp.__dateTime.day == 31) // Previous day is 31th
+ if (tmp.__dateTime.day == 31) // Previous day is 31th
{
result r = SetValue(tmp.__dateTime.year, tmp.__dateTime.month, tmp.__dateTime.day);
- if (IsFailed(r)) // Current month doesn't have 31th
+ if (IsFailed(r)) // Current month doesn't have 31th
{
- tmp.__dateTime.day = 30; // Set day to 30th
+ tmp.__dateTime.day = 30; // Set day to 30th
}
}
}
- else // Current month is Feb
+ else // Current month is Feb
{
- if (tmp.__dateTime.day > 28) // Previous day is over 28th
+ if (tmp.__dateTime.day > 28) // Previous day is over 28th
{
- if (tmp.IsLeapYear()) // Leap year
+ if (tmp.IsLeapYear()) // Leap year
{
- tmp.__dateTime.day = 29; // Set day to 29th
+ tmp.__dateTime.day = 29; // Set day to 29th
}
- else // Not leap year
+ else // Not leap year
{
- tmp.__dateTime.day = 28; // Set day to 28th
+ tmp.__dateTime.day = 28; // Set day to 28th
}
}
}
bool
DateTime::Equals(const Object& obj) const
{
- const DateTime* pOther = dynamic_cast <const DateTime*>(&obj);
+ const DateTime* pOther = dynamic_cast< const DateTime* >(&obj);
if (pOther == null)
{
return false;
wchar_t date[] = L"01/01/1970 00:00:00";
swprintf(date, (sizeof(date) / sizeof(wchar_t)), L"%2d/%2d/%4d %2d:%2d:%2d",
- __dateTime.month, __dateTime.day, __dateTime.year, __dateTime.hour, __dateTime.minute,
- (__dateTime.second & LOW_16BIT));
+ __dateTime.month, __dateTime.day, __dateTime.year, __dateTime.hour, __dateTime.minute,
+ (__dateTime.second & LOW_16BIT));
if (__dateTime.month < 10)
{
E_INVALID_FORMAT, E_INVALID_FORMAT, ("[%s] The str(%s) is not formatted like 'mm/dd/yyyy hh:mm:ss'."),
GetErrorMessage(E_INVALID_FORMAT), str.GetPointer());
- std::unique_ptr<wchar_t []> pTmp(new (std::nothrow) wchar_t [5]);
+ std::unique_ptr< wchar_t[] > pTmp(new (std::nothrow) wchar_t[5]);
SysTryReturn(NID_BASE, pTmp != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
}
}} // Tizen::Base
-
-
* @brief This is the implementation file for Double class.
* @see Number
*/
-
#include <cfloat>
#include <math.h>
#include <stdio.h>
#include <FBaseSysLog.h>
#include "FBase_LocalizedNumParser.h"
-
namespace Tizen { namespace Base
{
* @brief This is the implementation file for DoubleComparer class.
* @see Double and Tizen::Base::Collection::IComparer
*/
-
#include <FBaseDoubleComparer.h>
#include <FBaseDouble.h>
#include <FBaseResult.h>
#include <FBaseSysLog.h>
-
namespace Tizen { namespace Base
{
result
DoubleComparer::Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const
{
- const Double* pDouble1 = dynamic_cast <const Double*>(&obj1);
- const Double* pDouble2 = dynamic_cast <const Double*>(&obj2);
+ const Double* pDouble1 = dynamic_cast< const Double* >(&obj1);
+ const Double* pDouble2 = dynamic_cast< const Double* >(&obj2);
SysTryReturn(NID_BASE, (pDouble1 != null && pDouble2 != null), E_INVALID_ARG, E_INVALID_ARG,
"[%s] Invalid argument is used. Both of the obj1 and obj2 MUST be Double.", GetErrorMessage(E_INVALID_ARG));
return E_SUCCESS;
}
-
}} //Tizen::Base
* @file FBaseDoubleMatrix.cpp
* @brief This is the implementation for DoubleMatrix class.
*/
-
#include <FBaseDoubleMatrix.h>
#include <FBaseSysLog.h>
#include <unique_ptr.h>
DoubleMatrix::~DoubleMatrix(void)
{
- for ( int i = 0 ; i < __row ; i++ )
+ for (int i = 0; i < __row; i++)
{
delete[] __pMatrix[i];
}
bool
DoubleMatrix::Equals(const Tizen::Base::Object& obj) const
{
- const DoubleMatrix* pOther = dynamic_cast <const DoubleMatrix*>(&obj);
+ const DoubleMatrix* pOther = dynamic_cast< const DoubleMatrix* >(&obj);
if (pOther == null)
{
bool
DoubleMatrix::AllocateCapacity(int rowCount, int columnCount)
{
- std::unique_ptr<double* []> pMatrix(new (std::nothrow) double* [rowCount]);
+ std::unique_ptr< double*[] > pMatrix(new (std::nothrow) double*[rowCount]);
SysTryReturn(NID_BASE, pMatrix != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
- for ( int i = 0 ; i < rowCount ; i++ )
+ for (int i = 0; i < rowCount; i++)
{
pMatrix[i] = new (std::nothrow) double[columnCount];
if (pMatrix[i] == null)
{
- for (int j = 0; j < i; j++)
+ for (int j = 0; j < i; j++)
{
delete[] pMatrix[j];
}
- return false;
+ return false;
}
}
}
double determinant = 0.0f;
- std::unique_ptr<double* []> pMinor(new (std::nothrow) double* [order - 1]);
+ std::unique_ptr< double*[] > pMinor(new (std::nothrow) double*[order - 1]);
SysTryReturn(NID_BASE, pMinor != null, determinant, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
for (int i = 0; i < order - 1; i++)
pMinor[i] = new (std::nothrow) double[order - 1];
if (pMinor[i] == null)
{
- for (int j = 0; j < i; j++)
+ for (int j = 0; j < i; j++)
{
delete[] pMinor[j];
}
- return determinant;
+ return determinant;
}
}
for (int i = 0; i < order; i++)
{
GetMinor(pMatrix, pMinor.get(), 0, i, order);
-
+
if (signFlag == true)
{
determinant += pMatrix[0][i] * CalculateDeterminant(pMinor.get(), order - 1);
else
{
determinant += -pMatrix[0][i] * CalculateDeterminant(pMinor.get(), order - 1);
- signFlag = true;
+ signFlag = true;
}
}
"[%s] Invalid argument is used. The columnIndex is larger than the column count of the current instance.",
GetErrorMessage(E_INVALID_ARG));
- std::unique_ptr<double []> pColumn(new (std::nothrow) double [__row]);
+ std::unique_ptr< double[] > pColumn(new (std::nothrow) double[__row]);
SysTryReturn(NID_BASE, pColumn != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
SysTryReturn(NID_BASE, __row == __column, null, E_INVALID_OPERATION,
"[%s] The current instance is not a square matrix.", GetErrorMessage(E_INVALID_OPERATION));
- std::unique_ptr<DoubleMatrix> pInverseMatrix(new (std::nothrow) DoubleMatrix(__row, __column));
+ std::unique_ptr< DoubleMatrix > pInverseMatrix(new (std::nothrow) DoubleMatrix(__row, __column));
SysTryReturn(NID_BASE, pInverseMatrix != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
double determinant = CalculateDeterminant(__pMatrix, __row);
- if (Tizen::Base::Double::Compare(determinant,0.0f) == 0)
+ if (Tizen::Base::Double::Compare(determinant, 0.0f) == 0)
{
return null;
}
- std::unique_ptr<double* []> pMinor(new (std::nothrow) double* [__row - 1]);
+ std::unique_ptr< double*[] > pMinor(new (std::nothrow) double*[__row - 1]);
SysTryReturn(NID_BASE, pMinor != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
- for (int i = 0; i < __row -1; i++)
+ for (int i = 0; i < __row - 1; i++)
{
pMinor[i] = new (std::nothrow) double[__row - 1];
if (pMinor[i] == null)
{
- for (int j = 0; j < i; j++)
+ for (int j = 0; j < i; j++)
{
delete[] pMinor[j];
}
{
pInverseMatrix->__pMatrix[j][i] = -pInverseMatrix->__pMatrix[j][i];
}
- }
+ }
}
- for ( int i = 0 ; i < __row -1 ; i++ )
+ for (int i = 0; i < __row - 1; i++)
{
delete[] pMinor[i];
}
if (i != rowIndex)
{
columnCount = 0;
-
+
for (int j = 0; j < order; j++)
{
if (j != columnIndex)
"[%s] Invalid argument is used. The rowIndex is larger than the row count of the current instance.",
GetErrorMessage(E_INVALID_ARG));
- std::unique_ptr<double []> pRow(new (std::nothrow) double [__column]);
+ std::unique_ptr< double[] > pRow(new (std::nothrow) double[__column]);
SysTryReturn(NID_BASE, pRow != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
SysTryReturn(NID_BASE, __row == __column, null, E_INVALID_OPERATION,
"[%s] The current instance is not a square matrix.", GetErrorMessage(E_INVALID_OPERATION));
- std::unique_ptr<DoubleMatrix> pTransposeMatrix(new (std::nothrow) DoubleMatrix(*this));
+ std::unique_ptr< DoubleMatrix > pTransposeMatrix(new (std::nothrow) DoubleMatrix(*this));
SysTryReturn(NID_BASE, pTransposeMatrix != null, null, E_OUT_OF_MEMORY,
"[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
{
if (i == j)
{
- if (Tizen::Base::Double::Compare(__pMatrix[i][j],1.0f) != 0)
+ if (Tizen::Base::Double::Compare(__pMatrix[i][j], 1.0f) != 0)
{
return false;
}
}
else
{
- if (Tizen::Base::Double::Compare(__pMatrix[i][j],0.0f) != 0)
+ if (Tizen::Base::Double::Compare(__pMatrix[i][j], 0.0f) != 0)
{
return false;
}
}
-
+
}
}
return true;
bool
DoubleMatrix::IsInvertible(void) const
{
- int ret = Tizen::Base::Double::Compare(GetDeterminant(),0.0f);
+ int ret = Tizen::Base::Double::Compare(GetDeterminant(), 0.0f);
if (ret == 0)
{
SysTryReturnResult(NID_BASE, __column == matrix.__row, E_INVALID_ARG,
"The column count of the current instance is not same with the row count of the specified instance.");
- std::unique_ptr<double* []> pResult(new (std::nothrow) double* [__row]);
+ std::unique_ptr< double*[] > pResult(new (std::nothrow) double*[__row]);
SysTryReturnResult(NID_BASE, pResult != null, E_OUT_OF_MEMORY, "Allocating memory is failed.");
- for ( int i = 0 ; i < __row ; i++ )
+ for (int i = 0; i < __row; i++)
{
pResult[i] = new (std::nothrow) double[matrix.__column];
if (pResult[i] == null)
{
- for (int j = 0; j < i; j++)
+ for (int j = 0; j < i; j++)
{
delete[] pResult[j];
}
}
}
- for ( int i = 0 ; i < __row ; i++ )
+ for (int i = 0; i < __row; i++)
{
delete[] __pMatrix[i];
}
else
{
__pMatrix[i][j] = 0.0f;
- }
+ }
}
}
SysTryReturnResult(NID_BASE, Tizen::Base::Double::Compare(determinant, 0.0f) != 0, E_INVALID_OPERATION,
"The current instance is not invertible.");
- std::unique_ptr<double* []> pInverse(new (std::nothrow) double* [__row]);
+ std::unique_ptr< double*[] > pInverse(new (std::nothrow) double*[__row]);
SysTryReturnResult(NID_BASE, pInverse != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
pInverse[i] = new (std::nothrow) double[__row];
if (pInverse[i] == null)
{
- for (int j = 0; j < i; j++)
+ for (int j = 0; j < i; j++)
{
delete[] pInverse[j];
}
}
}
- std::unique_ptr<double* []> pMinor(new (std::nothrow) double* [__row - 1]);
+ std::unique_ptr< double*[] > pMinor(new (std::nothrow) double*[__row - 1]);
if (pMinor == null)
{
- for ( int i = 0 ; i < __row ; i++ )
+ for (int i = 0; i < __row; i++)
{
delete[] pInverse[i];
}
return E_OUT_OF_MEMORY;
}
- for (int i = 0; i < __row -1; i++)
+ for (int i = 0; i < __row - 1; i++)
{
pMinor[i] = new double[__row - 1];
if (pMinor[i] == null)
{
- for( int k = 0 ; k < __row ; k++ )
+ for (int k = 0; k < __row; k++)
{
delete[] pInverse[k];
}
- for (int j = 0; j < i; j++)
+ for (int j = 0; j < i; j++)
{
delete[] pMinor[j];
}
{
GetMinor(__pMatrix, pMinor.get(), i, j, __row);
pInverse[j][i] = CalculateDeterminant(pMinor.get(), __row - 1) / determinant;
- if ((i +j +2) % 2 == 1)
+ if ((i + j + 2) % 2 == 1)
{
pInverse[j][i] = -pInverse[j][i];
}
- }
+ }
}
- for ( int i = 0 ; i < __row ; i++ )
+ for (int i = 0; i < __row; i++)
{
delete[] __pMatrix[i];
}
__pMatrix = pInverse.release();
- for (int i = 0 ; i < __row -1; i++ )
+ for (int i = 0; i < __row - 1; i++)
{
delete[] pMinor[i];
}
for (int i = 0; i < __row; i++)
{
- __pMatrix[i][columnIndex] = pArray[i];
+ __pMatrix[i][columnIndex] = pArray[i];
}
return E_SUCCESS;
for (int i = 0; i < __column; i++)
{
- __pMatrix[rowIndex][i] = pArray[i];
+ __pMatrix[rowIndex][i] = pArray[i];
}
return E_SUCCESS;
{
for (int j = 0; j < __column; j++)
{
- __pMatrix[i][j] = 0.0f;
+ __pMatrix[i][j] = 0.0f;
}
}
}
* @file FBaseDoubleMatrix3.cpp
* @brief This is the implementation for DoubleMatrix class.
*/
-
#include <FBaseDoubleMatrix3.h>
#include <FBaseSysLog.h>
bool
DoubleMatrix3::Equals(const Tizen::Base::Object& obj) const
{
- const DoubleMatrix3* pMatrix = dynamic_cast <const DoubleMatrix3*>(&obj);
+ const DoubleMatrix3* pMatrix = dynamic_cast< const DoubleMatrix3* >(&obj);
if (pMatrix == null)
{
* @file FBaseDoubleMatrix4.cpp
* @brief This is the implementation for DoubleMatrix class.
*/
-
#include <FBaseDoubleMatrix4.h>
#include <FBaseSysLog.h>
bool
DoubleMatrix4::Equals(const Tizen::Base::Object& obj) const
{
- const DoubleMatrix4* pMatrix = dynamic_cast <const DoubleMatrix4*>(&obj);
+ const DoubleMatrix4* pMatrix = dynamic_cast< const DoubleMatrix4* >(&obj);
if (pMatrix == null)
{
// See the License for the specific language governing permissions and
// limitations under the License.
//
+
/**
* @file FBaseErrors.cpp
* @brief This is the implementation file of Result class.
*/
-
#include <FBaseErrors.h>
-
* @brief This is the implementation file for Float class.
* @see Number class
*/
-
-// Includes
#include <cfloat>
#include <math.h>
#include <stdio.h>
* @brief This is the implementation file for FloatComparer class.
* @see Float and Tizen::Base::Collection::IComparer
*/
-
#include <FBaseFloatComparer.h>
#include <FBaseFloat.h>
#include <FBaseResult.h>
result
FloatComparer::Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const
{
- const Float* pFloat1 = dynamic_cast <const Float*>(&obj1);
- const Float* pFloat2 = dynamic_cast <const Float*>(&obj2);
+ const Float* pFloat1 = dynamic_cast< const Float* >(&obj1);
+ const Float* pFloat2 = dynamic_cast< const Float* >(&obj2);
SysTryReturn(NID_BASE, (pFloat1 != null && pFloat2 != null), E_INVALID_ARG, E_INVALID_ARG,
"[%s] Invalid argument is used.Both of the obj1 and obj2 MUST be Float.", GetErrorMessage(E_INVALID_ARG));
* @file FBaseFloatMatrix.cpp
* @brief This is the implementation for FloatMatrix class.
*/
-
#include <FBaseFloatMatrix.h>
#include <FBaseSysLog.h>
#include <unique_ptr.h>
FloatMatrix::~FloatMatrix(void)
{
- for ( int i = 0 ; i < __row ; i++ )
+ for (int i = 0; i < __row; i++)
{
delete[] __pMatrix[i];
}
bool
FloatMatrix::Equals(const Tizen::Base::Object& obj) const
{
- const FloatMatrix* pOther = dynamic_cast <const FloatMatrix*>(&obj);
+ const FloatMatrix* pOther = dynamic_cast< const FloatMatrix* >(&obj);
if (pOther == null)
{
bool
FloatMatrix::AllocateCapacity(int rowCount, int columnCount)
{
- std::unique_ptr<float* []> pMatrix(new (std::nothrow) float* [rowCount]);
+ std::unique_ptr< float*[] > pMatrix(new (std::nothrow) float*[rowCount]);
SysTryReturn(NID_BASE, pMatrix != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
- for ( int i = 0 ; i < rowCount ; i++ )
+ for (int i = 0; i < rowCount; i++)
{
pMatrix[i] = new (std::nothrow) float[columnCount];
if (pMatrix[i] == null)
{
- for (int j = 0; j < i; j++)
+ for (int j = 0; j < i; j++)
{
delete[] pMatrix[j];
}
- return false;
+ return false;
}
}
}
float determinant = 0.0f;
- std::unique_ptr<float* []> pMinor(new (std::nothrow) float* [order - 1]);
+ std::unique_ptr< float*[] > pMinor(new (std::nothrow) float*[order - 1]);
SysTryReturn(NID_BASE, pMinor != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
for (int i = 0; i < order - 1; i++)
pMinor[i] = new (std::nothrow) float[order - 1];
if (pMinor[i] == null)
{
- for (int j = 0; j < i; j++)
+ for (int j = 0; j < i; j++)
{
delete[] pMinor[j];
}
- return determinant;
+ return determinant;
}
}
for (int i = 0; i < order; i++)
{
GetMinor(pMatrix, pMinor.get(), 0, i, order);
-
+
if (signFlag == true)
{
determinant += pMatrix[0][i] * CalculateDeterminant(pMinor.get(), order - 1);
else
{
determinant += -pMatrix[0][i] * CalculateDeterminant(pMinor.get(), order - 1);
- signFlag = true;
+ signFlag = true;
}
}
"[%s] Invalid argument is used. The columnIndex is larger than the column count of the current instance.",
GetErrorMessage(E_INVALID_ARG));
- std::unique_ptr<float []> pColumn(new (std::nothrow) float [__row]);
+ std::unique_ptr< float[] > pColumn(new (std::nothrow) float[__row]);
SysTryReturn(NID_BASE, pColumn != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
SysTryReturn(NID_BASE, __row == __column, null, E_INVALID_OPERATION,
"[%s] The current instance is not a square matrix.", GetErrorMessage(E_INVALID_OPERATION));
- std::unique_ptr<FloatMatrix> pInverseMatrix(new (std::nothrow) FloatMatrix(__row, __column));
+ std::unique_ptr< FloatMatrix > pInverseMatrix(new (std::nothrow) FloatMatrix(__row, __column));
SysTryReturn(NID_BASE, pInverseMatrix != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
float determinant = CalculateDeterminant(__pMatrix, __row);
- if (Tizen::Base::Float::Compare(determinant,0.0f) == 0)
+ if (Tizen::Base::Float::Compare(determinant, 0.0f) == 0)
{
return null;
}
- std::unique_ptr<float* []> pMinor(new (std::nothrow) float* [__row - 1]);
+ std::unique_ptr< float*[] > pMinor(new (std::nothrow) float*[__row - 1]);
SysTryReturn(NID_BASE, pMinor != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
- for (int i = 0; i < __row -1; i++)
+ for (int i = 0; i < __row - 1; i++)
{
pMinor[i] = new (std::nothrow) float[__row - 1];
if (pMinor[i] == null)
{
- for (int j = 0; j < i; j++)
+ for (int j = 0; j < i; j++)
{
delete[] pMinor[j];
- }
+ }
return null;
}
{
pInverseMatrix->__pMatrix[j][i] = -pInverseMatrix->__pMatrix[j][i];
}
- }
+ }
}
- for ( int i = 0 ; i < __row -1 ; i++ )
+ for (int i = 0; i < __row - 1; i++)
{
delete[] pMinor[i];
}
if (i != rowIndex)
{
columnCount = 0;
-
+
for (int j = 0; j < order; j++)
{
if (j != columnIndex)
"[%s] Invalid argument is used. The rowIndex is larger than the row count of the current instance.",
GetErrorMessage(E_INVALID_ARG));
- std::unique_ptr<float []> pRow(new (std::nothrow) float [__column]);
+ std::unique_ptr< float[] > pRow(new (std::nothrow) float[__column]);
SysTryReturn(NID_BASE, pRow != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
SysTryReturn(NID_BASE, __row == __column, null, E_INVALID_OPERATION,
"[%s] The current instance is not a square matrix.", GetErrorMessage(E_INVALID_OPERATION));
- std::unique_ptr<FloatMatrix> pTransposeMatrix(new (std::nothrow) FloatMatrix(*this));
+ std::unique_ptr< FloatMatrix > pTransposeMatrix(new (std::nothrow) FloatMatrix(*this));
SysTryReturn(NID_BASE, pTransposeMatrix != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
{
if (i == j)
{
- if (Tizen::Base::Float::Compare(__pMatrix[i][j],1.0f) != 0)
+ if (Tizen::Base::Float::Compare(__pMatrix[i][j], 1.0f) != 0)
{
return false;
}
}
else
{
- if (Tizen::Base::Float::Compare(__pMatrix[i][j],0.0f) != 0)
+ if (Tizen::Base::Float::Compare(__pMatrix[i][j], 0.0f) != 0)
{
return false;
}
}
-
+
}
}
return true;
bool
FloatMatrix::IsInvertible(void) const
{
- int ret = Tizen::Base::Float::Compare(GetDeterminant(),0.0f);
+ int ret = Tizen::Base::Float::Compare(GetDeterminant(), 0.0f);
if (ret == 0)
{
SysTryReturnResult(NID_BASE, __column == matrix.__row, E_INVALID_ARG,
"The column count of the current instance is not same with the row count of the specified instance.");
- std::unique_ptr<float* []> pResult(new (std::nothrow) float* [__row]);
+ std::unique_ptr< float*[] > pResult(new (std::nothrow) float*[__row]);
SysTryReturnResult(NID_BASE, pResult != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
- for ( int i = 0 ; i < __row ; i++ )
+ for (int i = 0; i < __row; i++)
{
pResult[i] = new (std::nothrow) float[matrix.__column];
if (pResult[i] == null)
{
- for (int j = 0; j < i; j++)
+ for (int j = 0; j < i; j++)
{
delete[] pResult[j];
}
}
}
- for ( int i = 0 ; i < __row ; i++ )
+ for (int i = 0; i < __row; i++)
{
delete[] __pMatrix[i];
}
{
SysTryReturnResult(NID_BASE, __row == __column, E_INVALID_OPERATION, "The current instance is not a square matrix.");
- for (int i = 0; i < __row; i ++)
+ for (int i = 0; i < __row; i++)
{
for (int j = 0; j < __column; j++)
{
else
{
__pMatrix[i][j] = 0.0f;
- }
+ }
}
}
SysTryReturnResult(NID_BASE, Tizen::Base::Float::Compare(determinant, 0.0f) != 0, E_INVALID_OPERATION,
"The current instance is not invertible.");
- std::unique_ptr<float* []> pInverse(new (std::nothrow) float* [__row]);
+ std::unique_ptr< float*[] > pInverse(new (std::nothrow) float*[__row]);
SysTryReturn(NID_BASE, pInverse != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
pInverse[i] = new (std::nothrow) float[__row];
if (pInverse[i] == null)
{
- for (int j = 0; j < i; j++)
+ for (int j = 0; j < i; j++)
{
delete[] pInverse[j];
- }
+ }
return E_OUT_OF_MEMORY;
}
}
- std::unique_ptr<float* []> pMinor(new (std::nothrow) float* [__row - 1]);
+ std::unique_ptr< float*[] > pMinor(new (std::nothrow) float*[__row - 1]);
if (pMinor == null)
{
- for ( int i = 0 ; i < __row ; i++ )
+ for (int i = 0; i < __row; i++)
{
delete[] pInverse[i];
}
pMinor[i] = new (std::nothrow) float[__row - 1];
if (pMinor[i] == null)
{
- for (int k = 0 ; k < __row ; k++)
+ for (int k = 0; k < __row; k++)
{
delete[] pInverse[k];
}
- for (int j = 0; j < i; j++)
+ for (int j = 0; j < i; j++)
{
delete[] pMinor[j];
}
{
GetMinor(__pMatrix, pMinor.get(), i, j, __row);
pInverse[j][i] = CalculateDeterminant(pMinor.get(), __row - 1) / determinant;
- if ((i +j +2) % 2 == 1)
+ if ((i + j + 2) % 2 == 1)
{
pInverse[j][i] = -pInverse[j][i];
}
- }
+ }
}
- for ( int i = 0 ; i < __row ; i++ )
+ for (int i = 0; i < __row; i++)
{
delete[] __pMatrix[i];
}
__pMatrix = pInverse.release();
- for ( int i = 0 ; i < __row -1; i++ )
+ for (int i = 0; i < __row - 1; i++)
{
delete[] pMinor[i];
}
for (int i = 0; i < __row; i++)
{
- __pMatrix[i][columnIndex] = pArray[i];
+ __pMatrix[i][columnIndex] = pArray[i];
}
return E_SUCCESS;
for (int i = 0; i < __column; i++)
{
- __pMatrix[rowIndex][i] = pArray[i];
+ __pMatrix[rowIndex][i] = pArray[i];
}
return E_SUCCESS;
{
for (int j = 0; j < __column; j++)
{
- __pMatrix[i][j] = 0.0f;
+ __pMatrix[i][j] = 0.0f;
}
}
}
* @file FBaseFloatMatrix3.cpp
* @brief This is the implementation for FloatMatrix class.
*/
-
#include <FBaseFloatMatrix3.h>
#include <FBaseSysLog.h>
bool
FloatMatrix3::Equals(const Tizen::Base::Object& obj) const
{
- const FloatMatrix3* pMatrix = dynamic_cast <const FloatMatrix3*>(&obj);
+ const FloatMatrix3* pMatrix = dynamic_cast< const FloatMatrix3* >(&obj);
if (pMatrix == null)
{
* @file FBaseFloatMatrix4.cpp
* @brief This is the implementation for FloatMatrix class.
*/
-
#include <FBaseFloatMatrix4.h>
#include <FBaseSysLog.h>
bool
FloatMatrix4::Equals(const Tizen::Base::Object& obj) const
{
- const FloatMatrix4* pMatrix = dynamic_cast <const FloatMatrix4*>(&obj);
+ const FloatMatrix4* pMatrix = dynamic_cast< const FloatMatrix4* >(&obj);
if (pMatrix == null)
{
/**
* @file FBaseInit.cpp
*/
-
#include "FBaseRt_ThreadManager.h"
-//#include "FBaseResourceTracker.h"
-
-//Tizen::Base::__ResourceTracker* __gpResourceTracker = null;
-
-
void
BaseInit(void)
{
-// __gpResourceTracker = new Tizen::Base::__ResourceTracker();
-// __gpResourceTracker->Construct();
+
}
void
BaseFinalize(void)
{
-// if (__gpResourceTracker)
-// delete __gpResourceTracker;
+
}
extern "C"
{
-
void
FBase_Initialize(void)
{
Tizen::Base::Runtime::_ThreadManager::Initialize();
}
-
void
FBase_Finalize(void)
{
Tizen::Base::Runtime::_ThreadManager::Finalize();
}
-
}
* @brief This is the implementation file for Int8 class.
* @see Number class
*/
-
#include <wchar.h>
#include <errno.h>
#include <limits.h>
#include <FBaseCharacter.h>
#include <FBaseSysLog.h>
-
-
namespace Tizen { namespace Base
{
bool
Int8::Equals(const Object& obj) const
{
- const Int8* pOther = dynamic_cast <const Int8*>(&obj);
+ const Int8* pOther = dynamic_cast< const Int8* >(&obj);
if (pOther == null)
{
return (false);
int
Int8::GetHashCode(void) const
{
- return static_cast<int> (value);
+ return static_cast< int >(value);
}
int
Int8::GetHashCode(char val)
{
- return static_cast<int> (val);
+ return static_cast< int >(val);
}
result
{
int len = s.GetLength();
SysTryReturn(NID_BASE, (len > 0 && len < 5), E_NUM_FORMAT, E_NUM_FORMAT,
- "[%s] The length of s(%ls) MUST be greater than 0 and less than 5.", GetErrorMessage(E_NUM_FORMAT), s.GetPointer());
+ "[%s] The length of s(%ls) MUST be greater than 0 and less than 5.", GetErrorMessage(E_NUM_FORMAT), s.GetPointer());
return Parse(s, Character::RADIX_DECIMAL, ret);
}
char
Int8::ToChar(void) const
{
- return static_cast<char> (value);
+ return static_cast< char >(value);
}
short
Int8::ToShort(void) const
{
- return static_cast<short> (value);
+ return static_cast< short >(value);
}
int
Int8::ToInt(void) const
{
- return static_cast<int> (value);
+ return static_cast< int >(value);
}
long
Int8::ToLong(void) const
{
- return static_cast<long> (value);
+ return static_cast< long >(value);
}
long long
Int8::ToLongLong(void) const
{
- return static_cast<long long> (value);
+ return static_cast< long long >(value);
}
float
Int8::ToFloat(void) const
{
- return static_cast<float> (value);
+ return static_cast< float >(value);
}
double
Int8::ToDouble(void) const
{
- return static_cast<double> (value);
+ return static_cast< double >(value);
}
String
* @brief This is the implementation file for Int8Comparer class.
* @see Int8 and Tizen::Base::Collection::IComparer
*/
-
#include <FBaseInt8Comparer.h>
#include <FBaseInt8.h>
#include <FBaseResult.h>
result
Int8Comparer::Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const
{
- const Int8* pInteger1 = dynamic_cast <const Int8*>(&obj1);
- const Int8* pInteger2 = dynamic_cast <const Int8*>(&obj2);
+ const Int8* pInteger1 = dynamic_cast< const Int8* >(&obj1);
+ const Int8* pInteger2 = dynamic_cast< const Int8* >(&obj2);
SysTryReturn(NID_BASE, (pInteger1 != null && pInteger2 != null), E_INVALID_ARG, E_INVALID_ARG,
"[%s] Invalid argument is used. Both of the obj1 and obj2 MUST be Integer.", GetErrorMessage(E_INVALID_ARG));
* @file FBaseIntMatrix.cpp
* @brief This is the implementation for IntMatrix class.
*/
-
#include <FBaseIntMatrix.h>
#include <FBaseSysLog.h>
#include <unique_ptr.h>
IntMatrix::~IntMatrix(void)
{
- for ( int i = 0 ; i < __row ; i++ )
+ for (int i = 0; i < __row; i++)
{
delete[] __pMatrix[i];
}
bool
IntMatrix::Equals(const Tizen::Base::Object& obj) const
{
- const IntMatrix* pOther = dynamic_cast <const IntMatrix*>(&obj);
+ const IntMatrix* pOther = dynamic_cast< const IntMatrix* >(&obj);
if (pOther == null)
{
bool
IntMatrix::AllocateCapacity(int rowCount, int columnCount)
{
- std::unique_ptr<int* []> pMatrix(new (std::nothrow) int* [rowCount]);
+ std::unique_ptr< int*[] > pMatrix(new (std::nothrow) int*[rowCount]);
SysTryReturn(NID_BASE, pMatrix != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
- for ( int i = 0 ; i < rowCount ; i++ )
+ for (int i = 0; i < rowCount; i++)
{
pMatrix[i] = new (std::nothrow) int[columnCount];
if (pMatrix[i] == null)
{
- for (int j = 0; j < i; j++)
+ for (int j = 0; j < i; j++)
{
delete[] pMatrix[j];
}
- return false;
+ return false;
}
}
}
int determinant = 0;
- std::unique_ptr<int* []> pMinor(new (std::nothrow) int* [order - 1]);
+ std::unique_ptr< int*[] > pMinor(new (std::nothrow) int*[order - 1]);
SysTryReturn(NID_BASE, pMinor != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
- for (int i = 0; i < order -1; i++)
+ for (int i = 0; i < order - 1; i++)
{
pMinor[i] = new (std::nothrow) int[order - 1];
if (pMinor[i] == null)
{
- for (int j = 0; j < i; j++)
+ for (int j = 0; j < i; j++)
{
delete[] pMinor[j];
}
- return determinant;
+ return determinant;
}
}
if (signFlag == true)
{
- determinant += pMatrix[0][i] * CalculateDeterminant(pMinor.get(), order -1);
+ determinant += pMatrix[0][i] * CalculateDeterminant(pMinor.get(), order - 1);
signFlag = false;
}
else
{
- determinant += -pMatrix[0][i] * CalculateDeterminant(pMinor.get(), order -1);
+ determinant += -pMatrix[0][i] * CalculateDeterminant(pMinor.get(), order - 1);
signFlag = true;
}
}
- for (int i = 0; i < order -1; i++)
+ for (int i = 0; i < order - 1; i++)
{
delete[] pMinor[i];
}
"[%s] Invalid argument is used. The columnIndex is larger than the column count of the current instance.",
GetErrorMessage(E_INVALID_ARG));
- std::unique_ptr<int []> pColumn(new (std::nothrow) int [__row]);
+ std::unique_ptr< int[] > pColumn(new (std::nothrow) int[__row]);
SysTryReturn(NID_BASE, pColumn != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
SysTryReturn(NID_BASE, __row == __column, null, E_INVALID_OPERATION,
"[%s] The current instance is not a square matrix.", GetErrorMessage(E_INVALID_OPERATION));
- std::unique_ptr<IntMatrix> pInverseMatrix(new (std::nothrow) IntMatrix(__row, __column));
+ std::unique_ptr< IntMatrix > pInverseMatrix(new (std::nothrow) IntMatrix(__row, __column));
SysTryReturn(NID_BASE, pInverseMatrix != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
return null;
}
- std::unique_ptr<int* []> pMinor(new (std::nothrow) int* [__row - 1]);
+ std::unique_ptr< int*[] > pMinor(new (std::nothrow) int*[__row - 1]);
SysTryReturn(NID_BASE, pMinor != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
pMinor[i] = new (std::nothrow) int[__row - 1];
if (pMinor[i] == null)
{
- for (int j = 0; j < i; j++)
+ for (int j = 0; j < i; j++)
{
delete[] pMinor[j];
}
}
}
- for ( int i = 0 ; i < __row - 1 ; i++)
+ for (int i = 0; i < __row - 1; i++)
{
delete[] pMinor[i];
}
"[%s] Invalid argument is used. The rowIndex is larger than the row count of the current instance.",
GetErrorMessage(E_INVALID_ARG));
- std::unique_ptr<int []> pRow(new (std::nothrow) int [__column]);
+ std::unique_ptr< int[] > pRow(new (std::nothrow) int[__column]);
SysTryReturn(NID_BASE, pRow != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
SysTryReturn(NID_BASE, __row == __column, null, E_INVALID_OPERATION,
"[%s] The current instance is not a square matrix.", GetErrorMessage(E_INVALID_OPERATION));
- std::unique_ptr<IntMatrix> pTransposeMatrix(new (std::nothrow) IntMatrix(*this));
+ std::unique_ptr< IntMatrix > pTransposeMatrix(new (std::nothrow) IntMatrix(*this));
SysTryReturn(NID_BASE, pTransposeMatrix != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
SysTryReturnResult(NID_BASE, __column == matrix.__row, E_INVALID_ARG,
"The column count of the current instance is not same with the row count of the specified instance.");
- std::unique_ptr<int* []> pResult(new (std::nothrow) int* [__row]);
+ std::unique_ptr< int*[] > pResult(new (std::nothrow) int*[__row]);
SysTryReturnResult(NID_BASE, pResult != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
- for ( int i = 0 ; i < __row ; i++ )
+ for (int i = 0; i < __row; i++)
{
pResult[i] = new int[matrix.__column];
if (pResult[i] == null)
{
- for (int j = 0; j < i; j++)
+ for (int j = 0; j < i; j++)
{
delete[] pResult[j];
}
}
}
- for ( int i = 0 ; i < __row ; i++ )
+ for (int i = 0; i < __row; i++)
{
delete[] __pMatrix[i];
}
int determinant = CalculateDeterminant(__pMatrix, __row);
SysTryReturnResult(NID_BASE, determinant != 0, E_INVALID_OPERATION, "The current instance is not invertible.");
- std::unique_ptr<int* []> pInverse(new (std::nothrow) int* [__row]);
+ std::unique_ptr< int*[] > pInverse(new (std::nothrow) int*[__row]);
SysTryReturn(NID_BASE, pInverse != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
pInverse[i] = new (std::nothrow) int[__row];
if (pInverse[i] == null)
{
- for (int j = 0; j < i; j++)
+ for (int j = 0; j < i; j++)
{
delete[] pInverse[j];
- }
+ }
return E_OUT_OF_MEMORY;
}
}
- std::unique_ptr<int* []> pMinor(new (std::nothrow) int* [__row - 1]);
+ std::unique_ptr< int*[] > pMinor(new (std::nothrow) int*[__row - 1]);
if (pMinor == null)
{
- for ( int i = 0 ; i < __row ; i++ )
+ for (int i = 0; i < __row; i++)
{
delete[] pInverse[i];
}
pMinor[i] = new int[__row - 1];
if (pMinor[i] == null)
{
- for ( int k = 0 ; k < __row ; k++ )
+ for (int k = 0; k < __row; k++)
{
delete[] pInverse[k];
}
- for (int j = 0; j < i; j++)
+ for (int j = 0; j < i; j++)
{
delete[] pMinor[j];
}
{
GetMinor(__pMatrix, pMinor.get(), i, j, __row);
pInverse[j][i] = CalculateDeterminant(pMinor.get(), __row - 1) / determinant;
- if ((i +j +2) % 2 == 1)
+ if ((i + j + 2) % 2 == 1)
{
pInverse[j][i] = -pInverse[j][i];
}
}
}
- for ( int i = 0 ; i < __row ; i++ )
+ for (int i = 0; i < __row; i++)
{
delete[] __pMatrix[i];
}
__pMatrix = pInverse.release();
- for ( int i = 0 ; i < __row - 1; i++ )
+ for (int i = 0; i < __row - 1; i++)
{
delete[] pMinor[i];
}
* @brief This is the implementation file for Integer class.
* @see Number
*/
-
#include <wchar.h>
#include <limits.h>
#include <errno.h>
bool
Integer::Equals(const Object& obj) const
{
- const Integer* pOther = dynamic_cast <const Integer*>(&obj);
+ const Integer* pOther = dynamic_cast< const Integer* >(&obj);
if (pOther == null)
{
return false;
char
Integer::ToChar(void) const
{
- return static_cast<char> (value);
+ return static_cast< char >(value);
}
short
Integer::ToShort(void) const
{
- return static_cast<short> (value);
+ return static_cast< short >(value);
}
int
long
Integer::ToLong(void) const
{
- return static_cast<long> (value);
+ return static_cast< long >(value);
}
long long
Integer::ToLongLong(void) const
{
- return static_cast<long long> (value);
+ return static_cast< long long >(value);
}
float
Integer::ToFloat(void) const
{
- return static_cast<float> (value);
+ return static_cast< float >(value);
}
double
Integer::ToDouble(void) const
{
- return static_cast<double> (value);
+ return static_cast< double >(value);
}
String
* @brief This is the implementation file for IntegerComparer class.
* @see Integer and Tizen::Base::Collection::IComparer
*/
-
#include <FBaseIntegerComparer.h>
#include <FBaseInteger.h>
#include <FBaseResult.h>
result
IntegerComparer::Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const
{
- const Integer* pInteger1 = dynamic_cast <const Integer*>(&obj1);
- const Integer* pInteger2 = dynamic_cast <const Integer*>(&obj2);
+ const Integer* pInteger1 = dynamic_cast< const Integer* >(&obj1);
+ const Integer* pInteger2 = dynamic_cast< const Integer* >(&obj2);
SysTryReturn(NID_BASE, (pInteger1 != null && pInteger2 != null), E_INVALID_ARG, E_INVALID_ARG,
"[%s] Invalid argument is used. Both of the obj1 and obj2 MUST be Integer.", GetErrorMessage(E_INVALID_ARG));
* @brief This is the implementation file for Long class.
* @see Number
*/
-
#include <wchar.h>
#include <limits.h>
#include <errno.h>
bool
Long::Equals(const Object& obj) const
{
- const Long* pOther = dynamic_cast <const Long*>(&obj);
+ const Long* pOther = dynamic_cast< const Long* >(&obj);
if (pOther == null)
{
return false;
int
Long::GetHashCode(void) const
{
- return static_cast<int> (value);
+ return static_cast< int >(value);
}
int
Long::GetHashCode(long val)
{
- return static_cast<int> (val);
+ return static_cast< int >(val);
}
result
char
Long::ToChar(void) const
{
- return static_cast<char> (value);
+ return static_cast< char >(value);
}
short
Long::ToShort(void) const
{
- return static_cast<short> (value);
+ return static_cast< short >(value);
}
int
Long::ToInt(void) const
{
- return static_cast<int> (value);
+ return static_cast< int >(value);
}
long
long long
Long::ToLongLong(void) const
{
- return static_cast<long long> (value);
+ return static_cast< long long >(value);
}
float
Long::ToFloat(void) const
{
- return static_cast<float> (value);
+ return static_cast< float >(value);
}
double
Long::ToDouble(void) const
{
- return static_cast<double> (value);
+ return static_cast< double >(value);
}
String
* @brief This is the implementation file for LongComparer class.
* @see Long and Tizen::Base::Collection::IComparer
*/
-
#include <FBaseLongComparer.h>
#include <FBaseLong.h>
#include <FBaseResult.h>
result
LongComparer::Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const
{
- const Long* pLong1 = dynamic_cast <const Long*>(&obj1);
- const Long* pLong2 = dynamic_cast <const Long*>(&obj2);
+ const Long* pLong1 = dynamic_cast< const Long* >(&obj1);
+ const Long* pLong2 = dynamic_cast< const Long* >(&obj2);
SysTryReturn(NID_BASE, (pLong1 != null && pLong2 != null), E_INVALID_ARG, E_INVALID_ARG,
"[%s] Invalid argument is used. Both of the obj1 and obj2 MUST be Long.", GetErrorMessage(E_INVALID_ARG));
* @brief This is the implementation file for LongLong class.
* @see Number
*/
-
#include <wchar.h>
#include <limits.h>
#include <errno.h>
bool
LongLong::Equals(const Object& obj) const
{
- const LongLong* pOther = dynamic_cast <const LongLong*>(&obj);
+ const LongLong* pOther = dynamic_cast< const LongLong* >(&obj);
if (pOther == null)
{
return false;
int
LongLong::GetHashCode(void) const
{
- return static_cast<int> (value);
+ return static_cast< int >(value);
}
int
LongLong::GetHashCode(long long val)
{
- return static_cast<int> (val);
+ return static_cast< int >(val);
}
char
LongLong::ToChar(void) const
{
- return static_cast<char> (value);
+ return static_cast< char >(value);
}
short
LongLong::ToShort(void) const
{
- return static_cast<short> (value);
+ return static_cast< short >(value);
}
int
LongLong::ToInt(void) const
{
- return static_cast<int> (value);
+ return static_cast< int >(value);
}
long
LongLong::ToLong(void) const
{
- return static_cast<long> (value);
+ return static_cast< long >(value);
}
float
LongLong::ToFloat(void) const
{
- return static_cast<float> (value);
+ return static_cast< float >(value);
}
double
LongLong::ToDouble(void) const
{
- return static_cast<double> (value);
+ return static_cast< double >(value);
}
long long
* @brief This is the implementation file for LongLongComparer class.
* @see LongLong and Tizen::Base::Collection::IComparer
*/
-
#include <FBaseLongLongComparer.h>
#include <FBaseLongLong.h>
#include <FBaseResult.h>
result
LongLongComparer::Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const
{
- const LongLong* pLongLong1 = dynamic_cast <const LongLong*>(&obj1);
- const LongLong* pLongLong2 = dynamic_cast <const LongLong*>(&obj2);
+ const LongLong* pLongLong1 = dynamic_cast< const LongLong* >(&obj1);
+ const LongLong* pLongLong2 = dynamic_cast< const LongLong* >(&obj2);
SysTryReturn(NID_BASE, (pLongLong1 != null && pLongLong2 != null), E_INVALID_ARG, E_INVALID_ARG,
"[E_INVALID_ARG] Both of the obj1 and obj2 MUST be LongLong.");
* @file FBaseObject.cpp
* @brief This is the implementation file for Object class.
*/
-
#include <FBaseObject.h>
-
namespace Tizen { namespace Base
{
* @file FBaseResult.cpp
* @brief This is the implementation file of Result class.
*/
-
#include <stdlib.h>
#include <FBaseResult.h>
#include <FBaseErrorDefine.h>
"E_ALREADY_OPENED", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1103))
"E_AUTHENTICATION", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1104))
"E_APP_NOT_INSTALLED", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1105))
- "E_ALREADY_SET", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1106))
+ "E_ALREADY_SET", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1106))
"E_ACCOUNT_ALREADY_EXIST", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1107))
"E_ACCOUNT_NOT_FOUND" //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1108))
};
"E_CONNECTION_FAILED", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1302))
"E_CONNECTION_RESET", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1303))
"E_CREDENTIAL_EXPIRED", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1304))
- "E_CERTIFICATE_VERIFICATION_FAILED", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1305))
+ "E_CERTIFICATE_VERIFICATION_FAILED", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1305))
"E_CONTEXT_UNAVAILABLE" //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1306))
};
"E_DNS", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1409))
"E_DNS_NOT_FOUND", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1410))
"E_DATA_NOT_ENOUGH", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1411))
- "E_DISPLAY_RIGHT_VIOLATED" //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1412))
+ "E_DISPLAY_RIGHT_VIOLATED" //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1412))
};
const char* __errTable1500[] =
}
#define MAX_CHECK_COUNT 100
-_OSP_EXPORT_ result TransExceptionsExclusiveInternal(result r, result e, int num,...);
+_OSP_EXPORT_ result TransExceptionsExclusiveInternal(result r, result e, int num, ...);
-_OSP_EXPORT_ result TransExceptionsInclusiveInternal(result r, result e, int num,...);
+_OSP_EXPORT_ result TransExceptionsInclusiveInternal(result r, result e, int num, ...);
-result
+result
TransExceptionsExclusiveInternal(result r, result e, int num, ...)
{
va_list ap;
bool ref = false;
int count = 0;
- if(r == E_SUCCESS)
+ if (r == E_SUCCESS)
+ {
return r;
+ }
- va_start(ap,num);
- for(; count < num; count++ )
+ va_start(ap, num);
+ for (; count < num; count++)
{
if (r == va_arg(ap, result))
{
}
}
va_end(ap);
- if(ref)
+ if (ref)
+ {
return r;
-
- return e;
+ }
+
+ return e;
}
-result
+result
TransExceptionsInclusiveInternal(result r, result e, int num, ...)
{
va_list ap;
bool ref = false;
int count = 0;
-
- if(r == E_SUCCESS)
+
+ if (r == E_SUCCESS)
+ {
return r;
+ }
- va_start(ap,num);
- for(; count < num ; count++ )
+ va_start(ap, num);
+ for (; count < num; count++)
{
if (r == va_arg(ap, result))
{
}
}
va_end(ap);
- if(ref)
+ if (ref)
+ {
return e;
-
- return r;
-
-}
-
-
+ }
+ return r;
+}
* @brief This is the implementation file for Short class.
* @see Number
*/
-
#include <wchar.h>
#include <limits.h>
#include <errno.h>
bool
Short::Equals(const Object& obj) const
{
- const Short* pOther = dynamic_cast <const Short*>(&obj);
+ const Short* pOther = dynamic_cast< const Short* >(&obj);
if (pOther == null)
{
return false;
int
Short::GetHashCode(void) const
{
- return static_cast<int> (value);
+ return static_cast< int >(value);
}
int
Short::GetHashCode(short val)
{
- return static_cast<int> (val);
+ return static_cast< int >(val);
}
result
char
Short::ToChar(void) const
{
- return static_cast<char> (value);
+ return static_cast< char >(value);
}
short
int
Short::ToInt(void) const
{
- return static_cast<int> (value);
+ return static_cast< int >(value);
}
long
Short::ToLong(void) const
{
- return static_cast<long> (value);
+ return static_cast< long >(value);
}
long long
Short::ToLongLong(void) const
{
- return static_cast<long long> (value);
+ return static_cast< long long >(value);
}
float
Short::ToFloat(void) const
{
- return static_cast<float> (value);
+ return static_cast< float >(value);
}
double
Short::ToDouble(void) const
{
- return static_cast<double> (value);
+ return static_cast< double >(value);
}
String
* @brief This is the implementation file for ShortComparer class.
* @see Short class and Tizen::Base::Collection::IComparer
*/
-
#include <FBaseShortComparer.h>
#include <FBaseShort.h>
#include <FBaseResult.h>
result
ShortComparer::Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const
{
- const Short* pShort1 = dynamic_cast <const Short*>(&obj1);
- const Short* pShort2 = dynamic_cast <const Short*>(&obj2);
+ const Short* pShort1 = dynamic_cast< const Short* >(&obj1);
+ const Short* pShort2 = dynamic_cast< const Short* >(&obj2);
SysTryReturn(NID_BASE, (pShort1 != null && pShort2 != null), E_INVALID_ARG, E_INVALID_ARG,
"[%s] Invalid argument is used. Both of the obj1 and obj2 MUST be Short.", GetErrorMessage(E_INVALID_ARG));
* @file FBaseString.cpp
* @brief This is the implementation for String class.
*/
-
#include <wchar.h>
#include <math.h>
#include <stdlib.h>
#include "FBase_String.h"
#include "FBaseUtil_IcuConverter.h"
-
namespace Tizen { namespace Base
{
result
String::SetCharAt(wchar_t ch, int indexAt)
{
- SysTryReturn(NID_BASE,indexAt >= 0 && indexAt < __length, E_OUT_OF_RANGE, E_OUT_OF_RANGE,
+ SysTryReturn(NID_BASE, indexAt >= 0 && indexAt < __length, E_OUT_OF_RANGE, E_OUT_OF_RANGE,
"[%s] The indexAt(%d) MUST be greater than or equal to 0, and less then the length of this string(%d).",
GetErrorMessage(E_OUT_OF_RANGE), indexAt, __length);
SysTryReturn(NID_BASE, startIndex >= 0 && startIndex < __length, false, E_OUT_OF_RANGE,
"[%s] The startIndex(%d) MUST be greater than or equal to 0, and less than the length of this string(%d).",
GetErrorMessage(E_OUT_OF_RANGE), startIndex, __length);
- SysTryReturn(NID_BASE, str.__length > 0, false, E_INVALID_ARG,
+ SysTryReturn(NID_BASE, str.__length > 0, false, E_INVALID_ARG,
"[%s] Invalid argument is used. The length of str(%d) MUST be greater than 0.",
GetErrorMessage(E_INVALID_ARG), str.__length);
bool trimRight = lastIndex < __length;
bool trimLeft = startIndex > 0;
- if (!trimRight && !trimLeft) // nothing to trim
+ if (!trimRight && !trimLeft) // nothing to trim
{
return;
}
capacity = minCapacity;
}
- std::unique_ptr<wchar_t []> pNewValue(new (std::nothrow) wchar_t[capacity + 1]); // + 1 for null character
+ std::unique_ptr< wchar_t[] > pNewValue(new (std::nothrow) wchar_t[capacity + 1]); // + 1 for null character
SysTryReturn(NID_BASE, pNewValue != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
* @brief This is the implementation file for StringComparer class.
* @see String class and Tizen::Base::Collection::IComparer
*/
-
#include <FBaseStringComparer.h>
#include <FBaseString.h>
#include <FBaseResult.h>
result
StringComparer::Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const
{
- const String* pString1 = dynamic_cast <const String*>(&obj1);
- const String* pString2 = dynamic_cast <const String*>(&obj2);
+ const String* pString1 = dynamic_cast< const String* >(&obj1);
+ const String* pString2 = dynamic_cast< const String* >(&obj2);
SysTryReturn(NID_BASE, (pString1 != null && pString2 != null), E_INVALID_ARG, E_INVALID_ARG,
"[%s] Invalid argument is used. Both of the obj1 and obj2 MUST be String.", GetErrorMessage(E_INVALID_ARG));
* @file FBaseStringHashCodeProvider.cpp
* @brief This is the implementation file for StringHashCodeProvider class.
*/
-
#include <FBaseString.h>
#include <FBaseStringHashCodeProvider.h>
* @file FBaseTimeSpan.cpp
* @brief This is the implementation file of TimeSpan class.
*/
-
#include <FBaseTimeSpan.h>
#include <FBaseSysLog.h>
bool
TimeSpan::Equals(const Object& obj) const
{
- const TimeSpan* pOther = dynamic_cast <const TimeSpan*>(&obj);
+ const TimeSpan* pOther = dynamic_cast< const TimeSpan* >(&obj);
if (pOther == null)
{
return false;
* @file FBaseTypes.cpp
* @brief This file defines the built-in types.
*/
-
-// Includes
#include <FBaseTypes.h>
-
* @file FBaseUuId.cpp
* @brief This is the implementation file for UuId class.
*/
-
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
#include <FBaseResult.h>
#include <FBaseByteBuffer.h>
#include <FBaseSysLog.h>
-#include "FBase_StringConverter.h"
#include <unique_ptr.h>
-
+#include "FBase_StringConverter.h"
namespace Tizen { namespace Base
{
bool
operator ==(const UUID& uuid1, const UuId& uuid2)
{
- byte uuid[16] = {0,};
+ byte uuid[16] = {0, };
memcpy(uuid, &uuid1, sizeof(uuid));
UuId::ConvertToUuId(uuid);
bool
UuId::Equals(const Object& obj) const
{
- const UuId* pOther = dynamic_cast<const UuId*>(&obj);
+ const UuId* pOther = dynamic_cast< const UuId* >(&obj);
if (pOther == null)
{
return String(pChar);
*/
- char uuid_str[36] = {0,};
-
+ char uuid_str[36] = {0, };
+
uuid_unparse(this->uuid, uuid_str);
return String(uuid_str);
UuId::ToUUID(void) const
{
UUID uuid;
- byte uuidValue[16] = {0,};
-
+ byte uuidValue[16] = {0, };
+
uuid_copy(uuidValue, this->uuid);
ConvertToUuId(uuidValue);
SysTryReturnResult(NID_BASE, length == 36, E_INVALID_ARG, "The length of str(%d) MUST be 36.", length);
SysTryReturnResult(NID_BASE, !(str[8] != L'-' || str[13] != L'-' || str[18] != L'-' || str[23] != L'-')
- ,E_INVALID_ARG, "The str(%ls) is not valid UuId type.", str.GetPointer());
+ , E_INVALID_ARG, "The str(%ls) is not valid UuId type.", str.GetPointer());
uuid_t uuidValue;
- std::unique_ptr<char []> pStr(_StringConverter::CopyToCharArrayN(str));
+ std::unique_ptr< char[] > pStr(_StringConverter::CopyToCharArrayN(str));
SysTryReturnResult(NID_BASE, pStr != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
int ret = uuid_parse(pStr.get(), uuidValue);
- SysTryReturnResult(NID_BASE, ret == 0, E_INVALID_ARG, "The str(%ls) MUST consist of only alphanumeric characters and '-'.", str.GetPointer());
+ SysTryReturnResult(NID_BASE, ret == 0, E_INVALID_ARG, "The str(%ls) MUST consist of only alphanumeric characters and '-'.", str.GetPointer());
uuid_copy(uuid.uuid, uuidValue);
{
byte value = 0x00;
- for (int i=0; i<2; i++)
+ for (int i = 0; i < 2; i++)
{
value = uuid[i];
- uuid[i] = uuid[3-i];
- uuid[3-i] = value;
+ uuid[i] = uuid[3 - i];
+ uuid[3 - i] = value;
}
value = uuid[4];
* @file FBase_CharacterImpl.cpp
* @brief This is the implementation file for _CharImpl class.
*/
-
#include <wctype.h>
#include <unicode/uchar.h>
#include <FBaseSysLog.h>
#include "FBase_CharacterImpl.h"
-
namespace Tizen { namespace Base
{
*
* This header file contains the declarations of the _CharacterImpl class.
*/
-
#ifndef _FBASE_INTERNAL_CHARACTER_IMPL_H_
#define _FBASE_INTERNAL_CHARACTER_IMPL_H_
#include <FBaseString.h>
#include <FBaseCharacter.h>
-
namespace Tizen { namespace Base
{
}; // _CharacterImpl
-} } // Tizen::Base
+}} // Tizen::Base
#endif // _FBASE_INTERNAL_CHARACTER_IMPL_H_
* @file FBaseExceptionInternal.cpp
* @brief This is the implementation file for Exception.
*/
-
#include "FBase_Exception.h"
const char* ExceptionStrings[] =
"UndefinedException" // for exception handling
};
-
/**
* Returns a string representation of the specified exception. It is useful when printing out a caught exception.
*
* @file FBase_LocalizedNumParser.cpp
* @brief This is the implementation file for _LocalizedNumParser class.
*/
-
#include <cerrno>
#include <clocale>
#include <cmath>
}
}
- result
- Construct(const char* pLocale)
+ result Construct(const char* pLocale)
{
_locale = newlocale(LC_ALL, pLocale, null);
SysTryReturnResult(NID_BASE, _locale != null, E_INVALID_ARG, "Creating a new locale object is failed. pLocale is invalid.");
return String(sValue);
}
-}} // Tizen::Base
+}} // Tizen::Base
* @file FBaseNativeError.cpp
* @brief This is the implementation file of functions for native error handling.
*/
-
#include <string.h>
#include <errno.h>
#include <system_info.h>
#include <power.h>
#include <alarm.h>
-#include "FBase_NativeError.h"
#include <FBaseSysLog.h>
+#include "FBase_NativeError.h"
#include "device.h"
#include "sqlite3.h"
-
-
using namespace Tizen::Base;
static int nativeErrorToResultTable[] =
static int sqlErrorToResultTable[] =
{
E_SUCCESS, // SQLITE_OK 0 /* Successful result */
- E_DATABASE, // SQLITE_ERROR 1 /* SQL error or missing database */
+ E_DATABASE, // SQLITE_ERROR 1 /* SQL error or missing database */
E_DATABASE, // SQLITE_INTERNAL 2 /* Internal logic error in SQLite */
E_DATABASE, // SQLITE_PERM 3 /* Access permission denied */
E_DATABASE, // SQLITE_ABORT 4 /* Callback routine requested an abort */
{
case SYSTEM_INFO_ERROR_INVALID_PARAMETER:
return E_INVALID_ARG;
- //case SYSTEM_INFO_ERROR_INTERNAL: return E_SYSTEM;
- //case SYSTEM_INFO_ERROR_OUT_OF_MEMORY: return E_OUT_OF_MEMORY;
- //case SYSTEM_INFO_ERROR_IO : return E_IO;
}
return E_UNKNOWN;
{
switch (err)
{
-// case DEVICE_ERROR_UNKNOWN: return E_SYSTEM;
case DEVICE_ERROR_INVALID_PARAMETER:
return E_INVALID_ARG;
}
{
switch (err)
{
-// case POWER_ERROR_UNKNOWN: return E_SYSTEM;
case POWER_ERROR_INVALID_PARAMETER:
return E_INVALID_ARG;
}
result
_NativeError::ConvertNativeHapticErrorToResult(int err)
{
- switch (err)
- {
- //case HAPTIC_ERROR_UNKNOWN: return E_SYSTEM;
- //case HAPTIC_ERROR_INVALID_PARAMETER: return E_INVALID_ARG;
- //case HAPTIC_ERROR_OPENED_DEVICE: return E_INVALID_STATE;
- }
-
return E_UNKNOWN;
}
result
_NativeError::ConvertNativeTelephonyErrorToResult(int err)
{
- switch (err)
- {
- /* deprecated on SLP SDK RC 11 */
-// case TELEPHONY_ERROR_INTERNAL: return E_SYSTEM;
-// case TELEPHONY_ERROR_INVALID_PARAMETER: return E_INVALID_ARG;
-// case TELEPHONY_ERROR_OUT_OF_SERVICE: return E_SERVICE_DEACTIVATED;
-// case TELEPHONY_ERROR_OUT_OF_MEMORY: return E_OUT_OF_MEMORY;
- }
-
return E_UNKNOWN;
}
result
_NativeError::ConvertNativeSoundManagerErrorToResult(int err)
{
- switch (err)
- {
-// case SOUND_MANAGER_NO_PLAYING_SOUND: return E_SYSTEM;
-// case SOUND_MANAGER_INVALID_PARAMETER: return E_INVALID_ARG;
-// case SOUND_MANAGER_INVALID_OPERATION: return E_INVALID_OPERATION;
-// case SOUND_MANAGER_OUT_OF_MEMORY: return E_OUT_OF_MEMORY;
- }
-
return E_UNKNOWN;
}
return r;
}
-
* @file FBase_StringConverter.cpp
* @brief This is the implementation for _StringConverter class.
*/
-
#include <new>
#include <FBaseResult.h>
#include <FBaseSysLog.h>