* @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];