2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FIo_RegistryCore.h
19 * @brief This is the header file for the %_RegistryCore class.
22 #ifndef _FIO_INTERNAL_REGISTRYCORE_H_
23 #define _FIO_INTERNAL_REGISTRYCORE_H_
25 #include <FBaseUuId.h>
26 #include <FBaseString.h>
27 #include <FBaseByteBuffer.h>
28 #include <FBaseColArrayList.h>
29 #include <FBaseColLinkedList.h>
30 #include <FBaseColHashMap.h>
31 #include <FBaseColIMap.h>
32 #include <FBaseResult.h>
33 #include <FIoFileLock.h>
36 namespace Tizen { namespace Io
42 : public Tizen::Base::Object
47 virtual ~_RegistryCore(void);
49 virtual result Flush(void);
51 bool VerifyRegistryOpenMode(const char* pOpenMode);
55 result Load(const Tizen::Base::String& regPath, const char* pOpenMode);
57 result AddSection(const Tizen::Base::String& SectionName);
59 result RemoveSection(const Tizen::Base::String& SectionName);
61 result GetSectionListN(Tizen::Base::Collection::IList** pRetList);
63 result GetEntryListN(const Tizen::Base::String& sectionName, Tizen::Base::Collection::HashMap** pRetList);
65 Tizen::Base::Collection::IMap* GetAllEntriesN(const Tizen::Base::String& sectionName);
67 Tizen::Base::Collection::IList* GetAllEntryNamesN(const Tizen::Base::String& sectionName);
69 result GetEntryList(const Tizen::Base::String& sectionName, Tizen::Base::Collection::HashMap& retMap);
71 result GetValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, Tizen::Base::String& valStr);
73 result AddValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, const Tizen::Base::String& valStr);
75 result SetValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, const Tizen::Base::String& valStr);
77 result RemoveValue(const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName);
79 result PrepareToWrite(void);
83 int GetSectionIndex(const Tizen::Base::String& sectionName);
85 Tizen::Base::String GetSectionName(int sectionIndex);
87 int GetEntryIndex(int sectionIndex, const Tizen::Base::String& entryName);
89 Tizen::Base::String GetEntryName(int sectionIndex, int entryIndex);
91 void Removekey(const Tizen::Base::String& sectionName, const Tizen::Base::String& keyName);
93 int GetAllSectionCount(void);
95 int GetAllEntryCount(int sectionIndex);
97 void RemoveEntry(int sectionIndex, int entryIndex);
99 void GetEntryValue(int sectionIndex, int entryIndex, _RegValueType type, void* pValue, int* pSize);
101 void ModifyEntryValue(int sectionIndex, int entryIndex, _RegValueType type, const void* pValue, int size);
103 void* GetSectionByIndex(int sectionIndex);
105 static result ConvertToSecureRegistry(const Tizen::Base::String& plainRegPath, const Tizen::Base::String& secureRegPath, const Tizen::Base::ByteBuffer* key = null);
107 FileLock* LockN(FileLockType lockType);
109 FileLock* TryToLockN(FileLockType lockType);
112 static result AddSection(Tizen::Base::Collection::LinkedList& sectionList, const Tizen::Base::String& sectionName);
114 static result AddValue(Tizen::Base::Collection::LinkedList& sectionList, const Tizen::Base::String& sectionName, const Tizen::Base::String& entryName, const Tizen::Base::String& valStr);
116 static bool CheckSectionName(char* pSectionName);
118 static bool CheckEntryName(char* pEntryName);
120 static bool CheckEntryValue(char* pEntryVal);
123 _RegistryCore(const _RegistryCore& rhs);
125 _RegistryCore& operator =(const _RegistryCore& rhs);
127 void DecodeData(const Tizen::Base::String& strValueEncoded, _RegValueType type, void* pValue, int* pSize);
131 Tizen::Base::String _regPath;
137 Tizen::Base::Collection::LinkedList _sectionList; // <section_name, list<section_val_name, val>>
142 _FileImpl* __pFileImpl;
148 #endif //_FIO_INTERNAL_REGISTRYCORE_H_