Merge "[3.0][ACR]Modify IteratorT/RandomIteratorT/PairIteratorT to satisfy the reqire...
[platform/framework/native/appfw.git] / src / io / FIoRegistry.cpp
index a928e2e..9eac89d 100644 (file)
@@ -1,5 +1,4 @@
 //
-// Open Service Platform
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the License);
@@ -187,69 +186,69 @@ Registry::GetAllEntryNamesN(const String& sectionName) const
 }
 
 result
-Registry::AddValue(const String& sectionName, const String& entryName, int value)
+Registry::AddValue(const String& sectionName, const String& entryName, int entryValue)
 {
        SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
        SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
        SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
 
-       return __pRegistryImpl->AddValue(sectionName, entryName, Integer::ToString(value));
+       return __pRegistryImpl->AddValue(sectionName, entryName, Integer::ToString(entryValue));
 }
 
 result
-Registry::AddValue(const String& sectionName, const String& entryName, double value)
+Registry::AddValue(const String& sectionName, const String& entryName, double entryValue)
 {
        SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
        SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
        SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
 
-       return __pRegistryImpl->AddValue(sectionName, entryName, Double::ToString(value));
+       return __pRegistryImpl->AddValue(sectionName, entryName, entryValue);
 }
 
 result
-Registry::AddValue(const String& sectionName, const String& entryName, float value)
+Registry::AddValue(const String& sectionName, const String& entryName, float entryValue)
 {
        SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
        SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
        SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
 
-       return __pRegistryImpl->AddValue(sectionName, entryName, Float::ToString(value));
+       return __pRegistryImpl->AddValue(sectionName, entryName, entryValue);
 }
 
 result
-Registry::AddValue(const String& sectionName, const String& entryName, const String& value)
+Registry::AddValue(const String& sectionName, const String& entryName, const String& entryValue)
 {
        SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
        SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
        SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
 
-       return __pRegistryImpl->AddValue(sectionName, entryName, value);
+       return __pRegistryImpl->AddValue(sectionName, entryName, entryValue);
 }
 
 result
-Registry::AddValue(const String& sectionName, const String& entryName, const UuId& value)
+Registry::AddValue(const String& sectionName, const String& entryName, const UuId& entryValue)
 {
        SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
        SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
        SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
 
-       return __pRegistryImpl->AddValue(sectionName, entryName, value.ToString());
+       return __pRegistryImpl->AddValue(sectionName, entryName, entryValue.ToString());
 }
 
 result
-Registry::AddValue(const String& sectionName, const String& entryName, const ByteBuffer& value)
+Registry::AddValue(const String& sectionName, const String& entryName, const ByteBuffer& entryValue)
 {
        SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
        SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
        SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
 
-       int size = value.GetLimit();
+       int size = entryValue.GetLimit();
        SysTryReturnResult(NID_IO, size > 0, E_INVALID_ARG, "invalid buffer length");
 
        String strValEncoded;
        String strVal;
        result r = E_SUCCESS;
-       byte* pValue = const_cast< byte* >(value.GetPointer());
+       byte* pValue = const_cast< byte* >(entryValue.GetPointer());
        SysAssert(pValue);
 
        for (int i = 0; i < size; i++)
@@ -301,20 +300,7 @@ Registry::GetValue(const String& sectionName, const String& entryName, double& r
        SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
        SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
 
-       result r = E_SUCCESS;
-       String valStr;
-
-       r = __pRegistryImpl->GetValue(sectionName, entryName, valStr);
-       if (!IsFailed(r))
-       {
-               r = Double::Parse(valStr, retVal);
-               if (IsFailed(r))
-               {
-                       r = E_PARSING_FAILED;
-               }
-       }
-
-       return r;
+       return __pRegistryImpl->GetValue(sectionName, entryName, retVal);
 }
 
 result
@@ -324,20 +310,7 @@ Registry::GetValue(const String& sectionName, const String& entryName, float& re
        SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
        SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
 
-       result r = E_SUCCESS;
-       String valStr;
-
-       r = __pRegistryImpl->GetValue(sectionName, entryName, valStr);
-       if (!IsFailed(r))
-       {
-               r = Float::Parse(valStr, retVal);
-               if (IsFailed(r))
-               {
-                       r = E_PARSING_FAILED;
-               }
-       }
-
-       return r;
+       return __pRegistryImpl->GetValue(sectionName, entryName, retVal);
 }
 
 result
@@ -446,7 +419,7 @@ Registry::SetValue(const String& sectionName, const String& entryName, double ne
        SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
        SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
 
-       return __pRegistryImpl->SetValue(sectionName, entryName, Double::ToString(newValue));
+       return __pRegistryImpl->SetValue(sectionName, entryName, newValue);
 }
 
 result
@@ -456,7 +429,7 @@ Registry::SetValue(const String& sectionName, const String& entryName, float new
        SysTryReturnResult(NID_IO, sectionName.GetLength() > 0, E_INVALID_ARG, "sectionName.GetLength() <= 0");
        SysTryReturnResult(NID_IO, entryName.GetLength() > 0, E_INVALID_ARG, "entryName.GetLength() <= 0");
 
-       return __pRegistryImpl->SetValue(sectionName, entryName, Float::ToString(newValue));
+       return __pRegistryImpl->SetValue(sectionName, entryName, newValue);
 }
 
 result
@@ -546,5 +519,19 @@ Registry::ConvertToSecureRegistry(const String& plainRegPath, const String& secu
        return _RegistryImpl::ConvertToSecureRegistry(plainRegPath, secureRegPath, &key);
 }
 
+FileLock*
+Registry::LockN(FileLockType lockType)
+{
+       SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
+       return __pRegistryImpl->LockN(lockType);
+}
+
+FileLock*
+Registry::TryToLockN(FileLockType lockType)
+{
+       SysAssertf(__pRegistryImpl != null, "Not yet constructed. Construct() should be called before use.\n");
+       return __pRegistryImpl->TryToLockN(lockType);
+}
+
 }} // Tizen::Io