* synchronization.
* @exception E_SECTION_NOT_FOUND The specified @c sectionName is not found within the registry.
* @exception E_KEY_ALREADY_EXIST The specified @c entryName already exists in this section.
+ * @remarks This method converts the specified double type @c value to string value using "%lg" format specifier. @n
+ * Also, it does not depend on system locale.
*/
result AddValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, double value);
* synchronization.
* @exception E_SECTION_NOT_FOUND The specified @c sectionName is not found within the registry.
* @exception E_KEY_ALREADY_EXIST The specified @c entryName already exists in this section.
+ * @remarks This method converts the specified float type @c value to string value using "%g" format specifier. @n
+ * Also, it does not depend on system locale.
*/
result AddValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, float value);
* @exception E_KEY_NOT_FOUND The specified @c entryName is not found within the registry.
* @exception E_PARSING_FAILED The method has failed to parse the encoded entry value string, or the value is retrieved by using an incorrect data type.
* @exception E_DATA_NOT_FOUND The name-value pair has no value assigned (if the value is retrieved using the REGTYPE_STRING type, an empty string is returned even if no value is assigned).
+ * @remarks This method does not depend on system locale.
*/
result GetValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, double& retVal) const;
* @exception E_KEY_NOT_FOUND The specified @c entryName is not found within the registry.
* @exception E_PARSING_FAILED The method has failed to parse the encoded entry value string, or the value is retrieved by using an incorrect data type.
* @exception E_DATA_NOT_FOUND The name-value pair has no value assigned (if the value is retrieved using the REGTYPE_STRING type, an empty string is returned even if no value is assigned).
+ * @remarks This method does not depend on system locale.
*/
result GetValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, float& retVal) const;
* @remarks This method will not add a name-value pair as an entry of a specific section
* if no entry with the specified name exists.
* In such a case, it returns E_KEY_NOT_FOUND. Use AddValue() to insert a new entry.
+ * @remarks This method converts the specified double type @c newValue to string value using "%lg" format specifier. @n
+ * Also, it does not depend on system locale.
* @see AddValue()
*/
result SetValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, double newValue);
* @remarks This method will not add a name-value pair as an entry of a specific section
* if no entry with the specified name exists.
* In such a case, it returns E_KEY_NOT_FOUND. Use AddValue() to insert a new entry.
+ * @remarks This method converts the specified float type @c newValue to string value using "%g" format specifier. @n
+ * Also, it does not depend on system locale.
* @see AddValue()
*/
result SetValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, float newValue);
}
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++)
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
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
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
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
#include <unistd.h>
#include <new>
#include <unique_ptr.h>
+#include <locale.h>
+#include <string.h>
+#include <errno.h>
#include <FBaseInteger.h>
#include <FBaseDouble.h>
_RegistryImpl::_RegistryImpl(void)
: __pRegistryCore(null)
+ , __loc((locale_t)0)
{
}
_RegistryImpl::~_RegistryImpl(void)
{
delete __pRegistryCore;
+ if (__loc != (locale_t)0)
+ {
+ freelocale(__loc);
+ }
}
bool
__pRegistryCore = pSecureRegistry.release();
}
+ __loc = newlocale(LC_ALL_MASK, "C", (locale_t)0);
+ if (__loc == (locale_t)0)
+ {
+ SysLogException(NID_IO, E_SYSTEM, "[E_SYSTEM] Failed to create locale object. errno: %d (%s)",
+ errno, strerror(errno));
+ }
+
return r;
}
}
result
-_RegistryImpl::GetValue(const String& sectionName, const String& entryName, String& valStr)
+_RegistryImpl::GetValue(const String& sectionName, const String& entryName, float& entryValue)
+{
+ String value;
+ uselocale(__loc);
+ result r = GetValue(sectionName, entryName, value);
+ if (!IsFailed(r))
+ {
+ r = Float::Parse(value, entryValue);
+ if (IsFailed(r))
+ {
+ r = E_PARSING_FAILED;
+ }
+ }
+ uselocale(LC_GLOBAL_LOCALE);
+ return r;
+}
+
+result
+_RegistryImpl::GetValue(const String& sectionName, const String& entryName, double& entryValue)
+{
+ String value;
+ uselocale(__loc);
+ result r = GetValue(sectionName, entryName, value);
+ if (!IsFailed(r))
+ {
+ r = Double::Parse(value, entryValue);
+ if (IsFailed(r))
+ {
+ r = E_PARSING_FAILED;
+ }
+ }
+ uselocale(LC_GLOBAL_LOCALE);
+ return r;
+}
+
+result
+_RegistryImpl::GetValue(const String& sectionName, const String& entryName, String& entryValue)
{
SysAssertf(__pRegistryCore != null, "Not yet constructed. Construct() should be called before use.\n");
- return __pRegistryCore->GetValue(sectionName, entryName, valStr);
+ return __pRegistryCore->GetValue(sectionName, entryName, entryValue);
}
result
-_RegistryImpl::AddValue(const String& sectionName, const String& entryName, const String& valStr)
+_RegistryImpl::AddValue(const String& sectionName, const String& entryName, float entryValue)
+{
+ uselocale(__loc);
+ result r = AddValue(sectionName, entryName, Float::ToString(entryValue));
+ uselocale(LC_GLOBAL_LOCALE);
+ return r;
+}
+
+result
+_RegistryImpl::AddValue(const String& sectionName, const String& entryName, double entryValue)
+{
+ uselocale(__loc);
+ result r = AddValue(sectionName, entryName, Double::ToString(entryValue));
+ uselocale(LC_GLOBAL_LOCALE);
+ return r;
+}
+
+result
+_RegistryImpl::AddValue(const String& sectionName, const String& entryName, const String& entryValue)
{
SysAssertf(__pRegistryCore != null, "Not yet constructed. Construct() should be called before use.\n");
- return __pRegistryCore->AddValue(sectionName, entryName, valStr);
+ return __pRegistryCore->AddValue(sectionName, entryName, entryValue);
}
result
-_RegistryImpl::SetValue(const String& sectionName, const String& entryName, const String& valStr)
+_RegistryImpl::SetValue(const String& sectionName, const String& entryName, float entryValue)
+{
+ uselocale(__loc);
+ result r = SetValue(sectionName, entryName, Float::ToString(entryValue));
+ uselocale(LC_GLOBAL_LOCALE);
+ return r;
+}
+
+result
+_RegistryImpl::SetValue(const String& sectionName, const String& entryName, double entryValue)
+{
+ uselocale(__loc);
+ result r = SetValue(sectionName, entryName, Double::ToString(entryValue));
+ uselocale(LC_GLOBAL_LOCALE);
+ return r;
+}
+
+result
+_RegistryImpl::SetValue(const String& sectionName, const String& entryName, const String& entryValue)
{
SysAssertf(__pRegistryCore != null, "Not yet constructed. Construct() should be called before use.\n");
- return __pRegistryCore->SetValue(sectionName, entryName, valStr);
+ return __pRegistryCore->SetValue(sectionName, entryName, entryValue);
}
result
_RegistryImpl::GetEntryValue(int sectionIndex, int entryIndex, _RegValueType type, void* pValue, int* pSize)
{
SysAssertf(__pRegistryCore != null, "Not yet constructed. Construct() should be called before use.\n");
- __pRegistryCore->GetEntryValue(sectionIndex, entryIndex, type, pValue, pSize);
+ if (type == REG_VALUE_TYPE_REAL)
+ {
+ uselocale(__loc);
+ __pRegistryCore->GetEntryValue(sectionIndex, entryIndex, type, pValue, pSize);
+ uselocale(LC_GLOBAL_LOCALE);
+ }
+ else
+ {
+ __pRegistryCore->GetEntryValue(sectionIndex, entryIndex, type, pValue, pSize);
+ }
}
String
#include <FOspConfig.h>
#include <FBaseObject.h>
#include <FIoFileLock.h>
+#include <locale.h>
namespace Tizen {namespace Base
{
result GetEntryList(const Tizen::Base::String& sectionName, Tizen::Base::Collection::HashMap& retMap);
- result GetValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, Tizen::Base::String& valStr);
+ result GetValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, float& entryValue);
- result AddValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, const Tizen::Base::String& valStr);
+ result GetValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, double& entryValue);
- result SetValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, const Tizen::Base::String& valStr);
+ result GetValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, Tizen::Base::String& entryValue);
+
+ result AddValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, float entryValue);
+
+ result AddValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, double entryValue);
+
+ result AddValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, const Tizen::Base::String& entryValue);
+
+ result SetValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, float entryValue);
+
+ result SetValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, double entryValue);
+
+ result SetValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, const Tizen::Base::String& entryValue);
result RemoveValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName);
static bool ConvertRegistryOpenMode(long legacyMode, char* pOpenMode);
- static result CheckOpenMode(const Tizen::Base::String& openMode);
+ static result CheckOpenMode(const Tizen::Base::String& openMode);
_RegistryCore* __pRegistryCore;
+ locale_t __loc;
+
}; // _RegistryImpl
}} // Tizen::Io