LibreOffice Module registry (master) 1
registry.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <registry/regdllapi.h>
23#include <registry/regtype.h>
24#include <rtl/ustring.hxx>
25
26extern "C" {
27
33{
54 RegError (REGISTRY_CALLTYPE *setLongListValue) (RegKeyHandle, rtl_uString*, sal_Int32 const *, sal_uInt32);
64 RegError (REGISTRY_CALLTYPE *getKeyNames) (RegKeyHandle, rtl_uString*, rtl_uString***, sal_uInt32*);
66};
67
71
72}
73
74class RegistryKey;
75
76
81class Registry final
82{
83public:
86 inline Registry();
87
89 inline Registry(const Registry& toCopy);
90
91 Registry(Registry && other) noexcept : m_pApi(other.m_pApi), m_hImpl(other.m_hImpl)
92 { other.m_hImpl = nullptr; }
93
95 inline ~Registry();
96
98 inline Registry& operator = (const Registry& toAssign);
99
101 if (m_hImpl != nullptr) {
102 m_pApi->release(m_hImpl);
103 }
104 m_hImpl = other.m_hImpl;
105 other.m_hImpl = nullptr;
106 return *this;
107 }
108
110 inline bool isValid() const;
111
116 inline bool isReadOnly() const;
117
123 inline RegError openRootKey(RegistryKey& rRootKey);
124
126 inline OUString getName();
127
133 inline RegError create(const OUString& registryName);
134
142 inline RegError open(const OUString& registryName,
143 RegAccessMode accessMode);
144
146 inline RegError close();
147
154 inline RegError destroy(const OUString& registryName);
155
156 friend class RegistryKey;
157 friend class RegistryKeyArray;
158 friend class RegistryKeyNames;
159
161 const Registry_Api* getApi() const { return m_pApi; }
162
163private:
168};
169
170
176{
177public:
179 inline RegistryKeyArray();
180
182 inline ~RegistryKeyArray();
183
185 inline RegistryKey getElement(sal_uInt32 index);
186
188 inline sal_uInt32 getLength() const;
189
190 friend class RegistryKey;
191
192private:
199 inline void setKeyHandles(Registry const & registry, RegKeyHandle* phKeys, sal_uInt32 length);
200
202 sal_uInt32 m_length;
207};
208
209
215{
216public:
218 inline RegistryKeyNames();
219
221 inline ~RegistryKeyNames();
222
224 inline OUString getElement(sal_uInt32 index);
225
227 inline sal_uInt32 getLength() const;
228
229 friend class RegistryKey;
230
231private:
238 inline void setKeyNames(Registry const & registry, rtl_uString** pKeyNames, sal_uInt32 length);
239
241 sal_uInt32 m_length;
243 rtl_uString** m_pKeyNames;
246};
247
248
253template<class ValueType>
255{
256public:
259 : m_length(0)
260 , m_pValueList(nullptr)
262 {}
263
266 {
267 if (m_pValueList)
268 {
270 }
271 }
272
274 ValueType getElement(sal_uInt32 index)
275 {
276 if (m_registry.isValid() && index < m_length)
277 {
278 return m_pValueList[index];
279 } else
280 {
281 return {};
282 }
283 }
284
286 sal_uInt32 getLength()
287 {
288 return m_length;
289 }
290
291 friend class RegistryKey;
292
293private:
301 void setValueList(const Registry& registry, RegValueType valueType,
302 ValueType* pValueList, sal_uInt32 length)
303 {
305 m_pValueList = pValueList;
306 m_valueType = valueType;
307 m_registry = registry;
308 }
309
311 sal_uInt32 m_length;
320};
321
322
328{
329public:
331 inline RegistryKey();
332
334 inline RegistryKey(const RegistryKey& toCopy);
335
337 inline ~RegistryKey();
338
340 inline RegistryKey& operator = (const RegistryKey& toAssign);
341
343 inline bool isValid() const;
344
349 inline bool isReadOnly() const;
350
352 inline OUString getName();
353
361 inline RegError createKey(const OUString& keyName,
362 RegistryKey& rNewKey);
363
371 inline RegError openKey(const OUString& keyName,
372 RegistryKey& rOpenKey);
373
381 inline RegError openSubKeys(const OUString& keyName,
382 RegistryKeyArray& rSubKeys);
383
391 inline RegError getKeyNames(const OUString& keyName,
392 RegistryKeyNames& rSubKeyNames);
393
399 inline RegError deleteKey(const OUString& keyName);
400
402 inline RegError closeKey();
403
414 inline RegError setValue(const OUString& keyName,
415 RegValueType valueType,
416 RegValue pValue,
417 sal_uInt32 valueSize);
418
428 inline RegError setLongListValue(const OUString& keyName,
429 sal_Int32 const * pValueList,
430 sal_uInt32 len);
431
441 inline RegError setStringListValue(const OUString& keyName,
442 char** pValueList,
443 sal_uInt32 len);
444
454 inline RegError setUnicodeListValue(const OUString& keyName,
455 sal_Unicode** pValueList,
456 sal_uInt32 len);
457
467 inline RegError getValueInfo(const OUString& keyName,
468 RegValueType* pValueType,
469 sal_uInt32* pValueSize);
470
479 inline RegError getValue(const OUString& keyName,
480 RegValue pValue);
481
490 inline RegError getLongListValue(const OUString& keyName,
491 RegistryValueList<sal_Int32>& rValueList);
492
501 inline RegError getStringListValue(const OUString& keyName,
502 RegistryValueList<char*>& rValueList);
503
512 inline RegError getUnicodeListValue(const OUString& keyName,
514
522 inline RegError getResolvedKeyName(const OUString& keyName,
523 OUString& rResolvedName) const;
524
526 inline OUString getRegistryName();
527
528 friend class Registry;
529public:
531
536 inline RegistryKey(Registry const & registry,
537 RegKeyHandle hKey);
538
539private:
542 inline void setRegistry(Registry const & registry);
543
545
550};
551
552
554 : m_length(0)
555 , m_phKeys(nullptr)
556{
557}
558
560{
561 if (m_phKeys)
562 m_registry.m_pApi->closeSubKeys(m_phKeys, m_length);
563}
564
566{
567 if (m_registry.isValid() && index < m_length)
569 else
570 return RegistryKey();
571}
572
573inline sal_uInt32 RegistryKeyArray::getLength() const
574{
575 return m_length;
576}
577
578inline void RegistryKeyArray::setKeyHandles(Registry const & registry,
579 RegKeyHandle* phKeys,
580 sal_uInt32 length)
581{
582 m_phKeys = phKeys;
584 m_registry = registry;
585}
586
588 : m_length(0)
589 , m_pKeyNames(nullptr)
590{
591}
592
594{
595 if (m_pKeyNames)
596 m_registry.m_pApi->freeKeyNames(m_pKeyNames, m_length);
597}
598
599inline OUString RegistryKeyNames::getElement(sal_uInt32 index)
600{
601
602 if (m_pKeyNames && index < m_length)
603 return m_pKeyNames[index];
604 else
605 return OUString();
606}
607
608inline sal_uInt32 RegistryKeyNames::getLength() const
609{
610 return m_length;
611}
612
613inline void RegistryKeyNames::setKeyNames(Registry const & registry,
614 rtl_uString** pKeyNames,
615 sal_uInt32 length)
616{
617 m_pKeyNames = pKeyNames;
619 m_registry = registry;
620}
621
623 : m_hImpl(nullptr)
624 { }
625
627inline RegistryKey::RegistryKey(Registry const & registry, RegKeyHandle hKey)
628 : m_registry(registry)
629 , m_hImpl(hKey)
630 {
631 if (m_hImpl)
632 m_registry.m_pApi->acquireKey(m_hImpl);
633 }
635
637 : m_registry(toCopy.m_registry)
638 , m_hImpl(toCopy.m_hImpl)
639 {
640 if (m_hImpl)
641 m_registry.m_pApi->acquireKey(m_hImpl);
642 }
643
645inline void RegistryKey::setRegistry(Registry const & registry)
646 {
647 m_registry = registry;
648 }
650
652 {
653 if (m_hImpl)
654 m_registry.m_pApi->releaseKey(m_hImpl);
655 }
656
658{
659 m_registry = toAssign.m_registry;
660
661 if (toAssign.m_hImpl)
662 m_registry.m_pApi->acquireKey(toAssign.m_hImpl);
663 if (m_hImpl)
664 m_registry.m_pApi->releaseKey(m_hImpl);
665 m_hImpl = toAssign.m_hImpl;
666
667 return *this;
668}
669
670inline bool RegistryKey::isValid() const
671 { return (m_hImpl != nullptr); }
672
673inline bool RegistryKey::isReadOnly() const
674 {
675 if (m_registry.isValid())
676 return m_registry.m_pApi->isKeyReadOnly(m_hImpl);
677 else
678 return false;
679 }
680
681inline OUString RegistryKey::getName()
682 {
683 OUString sRet;
684 if (m_registry.isValid())
685 m_registry.m_pApi->getKeyName(m_hImpl, &sRet.pData);
686 return sRet;
687 }
688
689inline RegError RegistryKey::createKey(const OUString& keyName,
690 RegistryKey& rNewKey)
691 {
692 if (rNewKey.isValid()) rNewKey.closeKey();
693 if (m_registry.isValid())
694 {
695 RegError ret = m_registry.m_pApi->createKey(m_hImpl, keyName.pData, &rNewKey.m_hImpl);
696 if (ret == RegError::NO_ERROR) rNewKey.setRegistry(m_registry);
697 return ret;
698 } else
700 }
701
702inline RegError RegistryKey::openKey(const OUString& keyName,
703 RegistryKey& rOpenKey)
704 {
705 if (rOpenKey.isValid()) rOpenKey.closeKey();
706 if (m_registry.isValid())
707 {
708 RegError ret = m_registry.m_pApi->openKey(m_hImpl, keyName.pData,
709 &rOpenKey.m_hImpl);
710 if (ret == RegError::NO_ERROR) rOpenKey.setRegistry(m_registry);
711 return ret;
712 } else
714 }
715
716inline RegError RegistryKey::openSubKeys(const OUString& keyName,
717 RegistryKeyArray& rSubKeys)
718 {
719 if (m_registry.isValid())
720 {
722 RegKeyHandle* pSubKeys;
723 sal_uInt32 nSubKeys;
724 ret = m_registry.m_pApi->openSubKeys(m_hImpl, keyName.pData,
725 &pSubKeys, &nSubKeys);
726 if ( ret != RegError::NO_ERROR)
727 {
728 return ret;
729 } else
730 {
731 rSubKeys.setKeyHandles(m_registry, pSubKeys, nSubKeys);
732 return ret;
733 }
734 } else
736 }
737
738inline RegError RegistryKey::getKeyNames(const OUString& keyName,
739 RegistryKeyNames& rSubKeyNames)
740 {
741 if (m_registry.isValid())
742 {
744 rtl_uString** pSubKeyNames;
745 sal_uInt32 nSubKeys;
746 ret = m_registry.m_pApi->getKeyNames(m_hImpl, keyName.pData,
747 &pSubKeyNames, &nSubKeys);
748 if ( ret != RegError::NO_ERROR)
749 {
750 return ret;
751 } else
752 {
753 rSubKeyNames.setKeyNames(m_registry, pSubKeyNames, nSubKeys);
754 return ret;
755 }
756 } else
758 }
759
760inline RegError RegistryKey::deleteKey(const OUString& keyName)
761 {
762 if (m_registry.isValid())
763 return m_registry.m_pApi->deleteKey(m_hImpl, keyName.pData);
764 else
766 }
767
769 {
770 if (m_registry.isValid())
771 {
772 RegError ret = m_registry.m_pApi->closeKey(m_hImpl);
773 if (ret == RegError::NO_ERROR)
774 {
775 m_hImpl = nullptr;
777 }
778 return ret;
779 } else
781 }
782
783inline RegError RegistryKey::setValue(const OUString& keyName,
784 RegValueType valueType,
785 RegValue pValue,
786 sal_uInt32 valueSize)
787 {
788 if (m_registry.isValid())
789 return m_registry.m_pApi->setValue(m_hImpl, keyName.pData, valueType,
790 pValue, valueSize);
791 else
793 }
794
795inline RegError RegistryKey::setLongListValue(const OUString& keyName,
796 sal_Int32 const * pValueList,
797 sal_uInt32 len)
798 {
799 if (m_registry.isValid())
800 return m_registry.m_pApi->setLongListValue(m_hImpl, keyName.pData,
801 pValueList, len);
802 else
804 }
805
806inline RegError RegistryKey::setStringListValue(const OUString& keyName,
807 char** pValueList,
808 sal_uInt32 len)
809 {
810 if (m_registry.isValid())
811 return m_registry.m_pApi->setStringListValue(m_hImpl, keyName.pData,
812 pValueList, len);
813 else
815 }
816
817inline RegError RegistryKey::setUnicodeListValue(const OUString& keyName,
818 sal_Unicode** pValueList,
819 sal_uInt32 len)
820 {
821 if (m_registry.isValid())
822 return m_registry.m_pApi->setUnicodeListValue(m_hImpl, keyName.pData,
823 pValueList, len);
824 else
826 }
827
828inline RegError RegistryKey::getValueInfo(const OUString& keyName,
829 RegValueType* pValueType,
830 sal_uInt32* pValueSize)
831 {
832 if (m_registry.isValid())
833 return m_registry.m_pApi->getValueInfo(m_hImpl, keyName.pData, pValueType, pValueSize);
834 else
836 }
837
838inline RegError RegistryKey::getValue(const OUString& keyName,
839 RegValue pValue)
840 {
841 if (m_registry.isValid())
842 return m_registry.m_pApi->getValue(m_hImpl, keyName.pData, pValue);
843 else
845 }
846
847inline RegError RegistryKey::getLongListValue(const OUString& keyName,
849 {
850 if (m_registry.isValid())
851 {
853 sal_Int32* pValueList;
854 sal_uInt32 length;
855 ret = m_registry.m_pApi->getLongListValue(m_hImpl, keyName.pData,
856 &pValueList, &length);
857 if ( ret != RegError::NO_ERROR)
858 {
859 return ret;
860 } else
861 {
863 pValueList, length);
864 return ret;
865 }
866 } else
868 }
869
870inline RegError RegistryKey::getStringListValue(const OUString& keyName,
871 RegistryValueList<char*>& rValueList)
872 {
873 if (m_registry.isValid())
874 {
876 char** pValueList;
877 sal_uInt32 length;
878 ret = m_registry.m_pApi->getStringListValue(m_hImpl, keyName.pData,
879 &pValueList, &length);
880 if ( ret != RegError::NO_ERROR )
881 {
882 return ret;
883 } else
884 {
886 pValueList, length);
887 return ret;
888 }
889 } else
891 }
892
893inline RegError RegistryKey::getUnicodeListValue(const OUString& keyName,
895 {
896 if (m_registry.isValid())
897 {
899 sal_Unicode** pValueList;
900 sal_uInt32 length;
901 ret = m_registry.m_pApi->getUnicodeListValue(m_hImpl, keyName.pData,
902 &pValueList, &length);
903 if ( ret != RegError::NO_ERROR )
904 {
905 return ret;
906 } else
907 {
908 rValueList.setValueList(m_registry, RegValueType::UNICODELIST,
909 pValueList, length);
910 return ret;
911 }
912 } else
914 }
915
916inline RegError RegistryKey::getResolvedKeyName(const OUString& keyName,
917 OUString& rResolvedName) const
918 {
919 if (m_registry.isValid())
920 return m_registry.m_pApi->getResolvedKeyName(m_hImpl,
921 keyName.pData,
922 true,
923 &rResolvedName.pData);
924 else
926 }
927
929 {
930 if (m_registry.isValid())
931 {
932 return m_registry.getName();
933 } else
934 return OUString();
935 }
936
937
940 , m_hImpl(nullptr)
941 { }
942
943inline Registry::Registry(const Registry& toCopy)
944 : m_pApi(toCopy.m_pApi)
945 , m_hImpl(toCopy.m_hImpl)
946 {
947 if (m_hImpl)
948 m_pApi->acquire(m_hImpl);
949 }
950
951
953 {
954 if (m_hImpl)
955 m_pApi->release(m_hImpl);
956 }
957
959{
960 if (toAssign.m_hImpl)
961 toAssign.m_pApi->acquire(toAssign.m_hImpl);
962 if (m_hImpl)
963 m_pApi->release(m_hImpl);
964
965 m_pApi = toAssign.m_pApi;
966 m_hImpl = toAssign.m_hImpl;
967
968 return *this;
969}
970
971inline bool Registry::isValid() const
972 { return ( m_hImpl != nullptr ); }
973
974inline bool Registry::isReadOnly() const
975 { return m_pApi->isReadOnly(m_hImpl); }
976
978 {
979 rRootKey.setRegistry(*this);
980 return m_pApi->openRootKey(m_hImpl, &rRootKey.m_hImpl);
981 }
982
983inline OUString Registry::getName()
984 {
985 OUString sRet;
986 m_pApi->getName(m_hImpl, &sRet.pData);
987 return sRet;
988 }
989
990inline RegError Registry::create(const OUString& registryName)
991 {
992 if (m_hImpl)
993 m_pApi->release(m_hImpl);
994 return m_pApi->createRegistry(registryName.pData, &m_hImpl);
995 }
996
997inline RegError Registry::open(const OUString& registryName,
998 RegAccessMode accessMode)
999 {
1000 if (m_hImpl)
1001 m_pApi->release(m_hImpl);
1002 return m_pApi->openRegistry(registryName.pData, &m_hImpl, accessMode);
1003 }
1004
1006 {
1007 RegError ret = m_pApi->closeRegistry(m_hImpl);
1008 if (ret == RegError::NO_ERROR)
1009 m_hImpl = nullptr;
1010 return ret;
1011 }
1012
1013inline RegError Registry::destroy(const OUString& registryName)
1014 {
1015 RegError ret = m_pApi->destroyRegistry(m_hImpl, registryName.pData);
1016 if ( ret == RegError::NO_ERROR && registryName.isEmpty() )
1017 m_hImpl = nullptr;
1018 return ret;
1019 }
1020
1021/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
RegistryKeyArray represents an array of open keys.
Definition: registry.hxx:176
~RegistryKeyArray()
Destructor, all subkeys will be closed.
Definition: registry.hxx:559
RegKeyHandle * m_phKeys
stores an array of open subkeys.
Definition: registry.hxx:204
sal_uInt32 getLength() const
returns the length of the array.
Definition: registry.hxx:573
void setKeyHandles(Registry const &registry, RegKeyHandle *phKeys, sal_uInt32 length)
sets the data of the key array.
Definition: registry.hxx:578
sal_uInt32 m_length
stores the number of open subkeys, the number of elements.
Definition: registry.hxx:202
Registry m_registry
stores the handle to the registry file where the appropriate keys are located.
Definition: registry.hxx:206
RegistryKeyArray()
Default constructor.
Definition: registry.hxx:553
friend class RegistryKey
Definition: registry.hxx:190
RegistryKey getElement(sal_uInt32 index)
returns the open key specified by index.
Definition: registry.hxx:565
RegistryKeyNames represents an array of key names.
Definition: registry.hxx:215
OUString getElement(sal_uInt32 index)
returns the name of the key specified by index.
Definition: registry.hxx:599
rtl_uString ** m_pKeyNames
stores an array of key names.
Definition: registry.hxx:243
~RegistryKeyNames()
Destructor, the internal array with key names will be deleted.
Definition: registry.hxx:593
RegistryKeyNames()
Default constructor.
Definition: registry.hxx:587
Registry m_registry
stores the handle to the registry file where the appropriate keys are located.
Definition: registry.hxx:245
void setKeyNames(Registry const &registry, rtl_uString **pKeyNames, sal_uInt32 length)
sets the data of the array.
Definition: registry.hxx:613
sal_uInt32 m_length
stores the number of key names, the number of elements.
Definition: registry.hxx:241
sal_uInt32 getLength() const
returns the length of the array.
Definition: registry.hxx:608
RegistryKey reads or writes information of the underlying key in a registry.
Definition: registry.hxx:328
OUString getRegistryName()
returns the name of the registry in which the key is defined.
Definition: registry.hxx:928
RegError getKeyNames(const OUString &keyName, RegistryKeyNames &rSubKeyNames)
returns an array with the names of all subkeys of the specified key.
Definition: registry.hxx:738
RegError openKey(const OUString &keyName, RegistryKey &rOpenKey)
opens the specified key.
Definition: registry.hxx:702
RegistryKey & operator=(const RegistryKey &toAssign)
Assign operator.
Definition: registry.hxx:657
RegError deleteKey(const OUString &keyName)
deletes the specified key.
Definition: registry.hxx:760
RegError getResolvedKeyName(const OUString &keyName, OUString &rResolvedName) const
resolves a keyname.
Definition: registry.hxx:916
RegError closeKey()
closes explicitly the current key
Definition: registry.hxx:768
RegError getLongListValue(const OUString &keyName, RegistryValueList< sal_Int32 > &rValueList)
gets a long list value of a key.
Definition: registry.hxx:847
RegistryKey()
Default constructor.
Definition: registry.hxx:622
~RegistryKey()
Destructor, close the key if it references an open one.
Definition: registry.hxx:651
OUString getName()
returns the full qualified name of the key beginning with the rootkey.
Definition: registry.hxx:681
RegError getValueInfo(const OUString &keyName, RegValueType *pValueType, sal_uInt32 *pValueSize)
gets info about type and size of a value.
Definition: registry.hxx:828
bool isValid() const
checks if the key points to a valid registry key.
Definition: registry.hxx:670
RegError getUnicodeListValue(const OUString &keyName, RegistryValueList< sal_Unicode * > &rValueList)
gets a unicode value of a key.
Definition: registry.hxx:893
RegError setValue(const OUString &keyName, RegValueType valueType, RegValue pValue, sal_uInt32 valueSize)
sets a value of a key.
Definition: registry.hxx:783
RegError setStringListValue(const OUString &keyName, char **pValueList, sal_uInt32 len)
sets an ascii list value of a key.
Definition: registry.hxx:806
RegError getValue(const OUString &keyName, RegValue pValue)
gets the value of a key.
Definition: registry.hxx:838
friend class Registry
Definition: registry.hxx:528
bool isReadOnly() const
returns the access mode of the key.
Definition: registry.hxx:673
RegError openSubKeys(const OUString &keyName, RegistryKeyArray &rSubKeys)
opens all subkeys of the specified key.
Definition: registry.hxx:716
RegError setLongListValue(const OUString &keyName, sal_Int32 const *pValueList, sal_uInt32 len)
sets a long list value of a key.
Definition: registry.hxx:795
Registry m_registry
stores the registry on which this key works
Definition: registry.hxx:547
RegError setUnicodeListValue(const OUString &keyName, sal_Unicode **pValueList, sal_uInt32 len)
sets a unicode string list value of a key.
Definition: registry.hxx:817
RegKeyHandle m_hImpl
stores the current key handle of this key
Definition: registry.hxx:549
RegError createKey(const OUString &keyName, RegistryKey &rNewKey)
creates a new key or opens a key if the specified key already exists.
Definition: registry.hxx:689
RegError getStringListValue(const OUString &keyName, RegistryValueList< char * > &rValueList)
gets an ascii list value of a key.
Definition: registry.hxx:870
RegistryValueList represents a value list of the specified type.
Definition: registry.hxx:255
sal_uInt32 m_length
stores the length of the list, the number of elements.
Definition: registry.hxx:311
RegistryValueList()
Default constructor.
Definition: registry.hxx:258
void setValueList(const Registry &registry, RegValueType valueType, ValueType *pValueList, sal_uInt32 length)
sets the data of the value list.
Definition: registry.hxx:301
ValueType * m_pValueList
stores the value list.
Definition: registry.hxx:313
ValueType getElement(sal_uInt32 index)
returns the value of the list specified by index.
Definition: registry.hxx:274
RegValueType m_valueType
stores the type of the list elements
Definition: registry.hxx:315
sal_uInt32 getLength()
returns the length of the list.
Definition: registry.hxx:286
~RegistryValueList()
Destructor, the internal value list will be freed.
Definition: registry.hxx:265
Registry m_registry
stores the handle to the registry file where the appropriate key to this value is located.
Definition: registry.hxx:319
The Registry provides the functionality to read and write information in a registry file.
Definition: registry.hxx:82
RegError create(const OUString &registryName)
creates a new registry with the specified name and creates a root key.
Definition: registry.hxx:990
RegError close()
closes explicitly the current registry data file.
Definition: registry.hxx:1005
Registry & operator=(const Registry &toAssign)
Assign operator.
Definition: registry.hxx:958
Registry(Registry &&other) noexcept
Definition: registry.hxx:91
RegError openRootKey(RegistryKey &rRootKey)
opens the root key of the registry.
Definition: registry.hxx:977
OUString getName()
returns the name of the current registry data file.
Definition: registry.hxx:983
RegHandle m_hImpl
stores the handle of the underlying registry file on which most of the functions work.
Definition: registry.hxx:167
RegError open(const OUString &registryName, RegAccessMode accessMode)
opens a registry with the specified name.
Definition: registry.hxx:997
~Registry()
Destructor. The Destructor close the registry if it is open.
Definition: registry.hxx:952
Registry()
Default constructor.
Definition: registry.hxx:938
RegError destroy(const OUString &registryName)
destroys a registry.
Definition: registry.hxx:1013
bool isValid() const
checks if the registry points to a valid registry data file.
Definition: registry.hxx:971
bool isReadOnly() const
returns the access mode of the registry.
Definition: registry.hxx:974
const Registry_Api * m_pApi
stores the used and initialized registry Api.
Definition: registry.hxx:165
const Registry_Api * getApi() const
returns the used registry Api.
Definition: registry.hxx:161
index
ValueType
#define REG_DLLPUBLIC
Definition: regdllapi.h:27
static RegError REGISTRY_CALLTYPE closeRegistry(RegHandle hReg)
Definition: registry.cxx:139
static RegError REGISTRY_CALLTYPE createRegistry(rtl_uString *registryName, RegHandle *phRegistry)
Definition: registry.cxx:80
static sal_Bool REGISTRY_CALLTYPE isReadOnly(RegHandle hReg)
Definition: registry.cxx:72
static RegError REGISTRY_CALLTYPE openRootKey(RegHandle hReg, RegKeyHandle *phRootKey)
Definition: registry.cxx:98
static RegError REGISTRY_CALLTYPE openRegistry(rtl_uString *registryName, RegHandle *phRegistry, RegAccessMode accessMode)
Definition: registry.cxx:119
static void REGISTRY_CALLTYPE acquire(RegHandle hReg)
Definition: registry.cxx:33
static void REGISTRY_CALLTYPE release(RegHandle hReg)
Definition: registry.cxx:41
static RegError REGISTRY_CALLTYPE getName(RegHandle hReg, rtl_uString **pName)
Definition: registry.cxx:52
static RegError REGISTRY_CALLTYPE destroyRegistry(RegHandle hReg, rtl_uString *registryName)
Definition: registry.cxx:163
REG_DLLPUBLIC Registry_Api *REGISTRY_CALLTYPE initRegistry_Api()
the API initialization function.
Definition: registry.cxx:211
RegError REGISTRY_CALLTYPE setUnicodeListValue(RegKeyHandle hKey, rtl_uString *keyName, sal_Unicode **pValueList, sal_uInt32 len)
Definition: regkey.cxx:279
RegError REGISTRY_CALLTYPE setLongListValue(RegKeyHandle hKey, rtl_uString *keyName, sal_Int32 const *pValueList, sal_uInt32 len)
Definition: regkey.cxx:201
RegError REGISTRY_CALLTYPE createKey(RegKeyHandle hKey, rtl_uString *keyName, RegKeyHandle *phNewKey)
Definition: regkey.cxx:67
RegError REGISTRY_CALLTYPE setStringListValue(RegKeyHandle hKey, rtl_uString *keyName, char **pValueList, sal_uInt32 len)
Definition: regkey.cxx:240
void REGISTRY_CALLTYPE acquireKey(RegKeyHandle hKey)
Definition: regkey.cxx:27
RegError REGISTRY_CALLTYPE getValueInfo(RegKeyHandle hKey, rtl_uString *keyName, RegValueType *pValueType, sal_uInt32 *pValueSize)
Definition: regkey.cxx:318
RegError REGISTRY_CALLTYPE getStringListValue(RegKeyHandle hKey, rtl_uString *keyName, char ***pValueList, sal_uInt32 *pLen)
Definition: regkey.cxx:437
void REGISTRY_CALLTYPE releaseKey(RegKeyHandle hKey)
Definition: regkey.cxx:37
RegError REGISTRY_CALLTYPE getKeyNames(RegKeyHandle hKey, rtl_uString *keyName, rtl_uString ***pSubKeyNames, sal_uInt32 *pnSubKeys)
Definition: regkey.cxx:571
RegError REGISTRY_CALLTYPE getLongListValue(RegKeyHandle hKey, rtl_uString *keyName, sal_Int32 **pValueList, sal_uInt32 *pLen)
Definition: regkey.cxx:400
RegError REGISTRY_CALLTYPE getKeyName(RegKeyHandle hKey, rtl_uString **pKeyName)
Definition: regkey.cxx:53
RegError REGISTRY_CALLTYPE deleteKey(RegKeyHandle hKey, rtl_uString *keyName)
Definition: regkey.cxx:136
RegError REGISTRY_CALLTYPE getResolvedKeyName(RegKeyHandle hKey, rtl_uString *keyName, SAL_UNUSED_PARAMETER sal_Bool, rtl_uString **pResolvedName)
Definition: regkey.cxx:552
RegError REGISTRY_CALLTYPE closeSubKeys(RegKeyHandle *phSubKeys, sal_uInt32 nSubKeys)
Definition: regkey.cxx:120
RegError REGISTRY_CALLTYPE freeKeyNames(rtl_uString **pKeyNames, sal_uInt32 nKeys)
Definition: regkey.cxx:586
RegError REGISTRY_CALLTYPE freeValueList(RegValueType valueType, RegValue pValueList, sal_uInt32 len)
Definition: regkey.cxx:511
sal_Bool REGISTRY_CALLTYPE isKeyReadOnly(RegKeyHandle hKey)
Definition: regkey.cxx:47
RegError REGISTRY_CALLTYPE openKey(RegKeyHandle hKey, rtl_uString *keyName, RegKeyHandle *phOpenKey)
Definition: regkey.cxx:86
RegError REGISTRY_CALLTYPE openSubKeys(RegKeyHandle hKey, rtl_uString *keyName, RegKeyHandle **pphSubKeys, sal_uInt32 *pnSubKeys)
Definition: regkey.cxx:102
RegError REGISTRY_CALLTYPE closeKey(RegKeyHandle hKey)
Definition: regkey.cxx:152
RegError REGISTRY_CALLTYPE getValue(RegKeyHandle hKey, rtl_uString *keyName, RegValue pValue)
Definition: regkey.cxx:368
RegError REGISTRY_CALLTYPE getUnicodeListValue(RegKeyHandle hKey, rtl_uString *keyName, sal_Unicode ***pValueList, sal_uInt32 *pLen)
Definition: regkey.cxx:474
RegError REGISTRY_CALLTYPE setValue(RegKeyHandle hKey, rtl_uString *keyName, RegValueType valueType, RegValue pData, sal_uInt32 valueSize)
Definition: regkey.cxx:161
STRINGLIST
The key has a value of type ascii string list.
Definition: regtype.h:75
void * RegHandle
defines the type of a registry handle used in the C API.
Definition: regtype.h:26
void * RegKeyHandle
defines the type of a registry key handle used in the C API.
Definition: regtype.h:29
INVALID_KEY
the key is not in a valid state.
Definition: regtype.h:116
RegAccessMode
defines the open/access mode of the registry.
Definition: regtype.h:41
NOT_DEFINED
The key has no value or the value type is unknown.
Definition: regtype.h:63
enum SAL_DLLPUBLIC_RTTI RegValueType
defines the type of a key value.
Definition: regtype.h:61
void * RegValue
defines the type of a registry key value handle used in the C API.
Definition: regtype.h:32
#define REGISTRY_CALLTYPE
specify the calling convention for the registry API
Definition: regtype.h:129
LONGLIST
The key has a value of type long list.
Definition: regtype.h:73
NO_ERROR
no error.
Definition: regtype.h:84
enum SAL_DLLPUBLIC_RTTI RegError
specifies the possible error codes which can occur using the registry API.
Definition: regtype.h:82
specifies a collection of function pointers which represents the complete registry C-API.
Definition: registry.hxx:33
void(REGISTRY_CALLTYPE *releaseKey)(RegKeyHandle)
rtl_uString rtl_uString RegKeyHandle rtl_uString RegKeyHandle * RegError(REGISTRY_CALLTYPE *openSubKeys)(RegKeyHandle
rtl_uString sal_Int32 sal_uInt32 * RegError(REGISTRY_CALLTYPE *getStringListValue)(RegKeyHandle
RegKeyHandle * RegError(REGISTRY_CALLTYPE *getName)(RegHandle
RegError(REGISTRY_CALLTYPE *setValue)(RegKeyHandle
rtl_uString * RegError(REGISTRY_CALLTYPE *closeKey)(RegKeyHandle)
RegError(REGISTRY_CALLTYPE *closeRegistry)(RegHandle)
rtl_uString RegValueType sal_uInt32 * RegError(REGISTRY_CALLTYPE *getValue)(RegKeyHandle
RegError(REGISTRY_CALLTYPE *deleteKey)(RegKeyHandle
RegError(REGISTRY_CALLTYPE *getKeyName)(RegKeyHandle
rtl_uString sal_Int32 sal_uInt32 rtl_uString char sal_uInt32 * RegError(REGISTRY_CALLTYPE *getUnicodeListValue)(RegKeyHandle
RegKeyHandle rtl_uString ** RegError(REGISTRY_CALLTYPE *createRegistry)(rtl_uString *
rtl_uString RegValueType
Definition: registry.hxx:53
sal_Bool(REGISTRY_CALLTYPE *isReadOnly)(RegHandle)
RegError(REGISTRY_CALLTYPE *getLongListValue)(RegKeyHandle
RegError(REGISTRY_CALLTYPE *destroyRegistry)(RegHandle
sal_Bool(REGISTRY_CALLTYPE *isKeyReadOnly)(RegKeyHandle)
rtl_uString ** RegError(REGISTRY_CALLTYPE *createKey)(RegKeyHandle
rtl_uString RegValue
Definition: registry.hxx:53
rtl_uString sal_Int32 sal_uInt32 rtl_uString char sal_uInt32 rtl_uString sal_Unicode sal_uInt32 * RegError(REGISTRY_CALLTYPE *freeValueList)(RegValueType
RegKeyHandle rtl_uString RegHandle RegHandle RegAccessMode
Definition: registry.hxx:40
rtl_uString rtl_uString RegKeyHandle rtl_uString RegKeyHandle rtl_uString RegKeyHandle sal_uInt32 sal_uInt32
Definition: registry.hxx:50
rtl_uString rtl_uString RegKeyHandle rtl_uString RegKeyHandle rtl_uString RegKeyHandle sal_uInt32 * RegError(REGISTRY_CALLTYPE *closeSubKeys)(RegKeyHandle *
rtl_uString rtl_uString RegKeyHandle * RegError(REGISTRY_CALLTYPE *openKey)(RegKeyHandle
rtl_uString * void(REGISTRY_CALLTYPE *acquireKey)(RegKeyHandle)
void(REGISTRY_CALLTYPE *release)(RegHandle)
RegError(REGISTRY_CALLTYPE *setLongListValue)(RegKeyHandle
RegError(REGISTRY_CALLTYPE *getResolvedKeyName)(RegKeyHandle
RegError(REGISTRY_CALLTYPE *setUnicodeListValue)(RegKeyHandle
rtl_uString sal_Bool
Definition: registry.hxx:63
rtl_uString rtl_uString rtl_uString rtl_uString sal_uInt32 * RegError(REGISTRY_CALLTYPE *freeKeyNames)(rtl_uString **
void(REGISTRY_CALLTYPE *acquire)(RegHandle)
RegError(REGISTRY_CALLTYPE *getValueInfo)(RegKeyHandle
rtl_uString rtl_uString ** RegError(REGISTRY_CALLTYPE *getKeyNames)(RegKeyHandle
RegError(REGISTRY_CALLTYPE *setStringListValue)(RegKeyHandle
RegError(REGISTRY_CALLTYPE *openRootKey)(RegHandle
sal_uInt16 sal_Unicode