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 
26 extern "C" {
27 
33 {
38  RegError (REGISTRY_CALLTYPE *getName) (RegHandle, rtl_uString**);
48  RegError (REGISTRY_CALLTYPE *createKey) (RegKeyHandle, rtl_uString*, RegKeyHandle*);
49  RegError (REGISTRY_CALLTYPE *openKey) (RegKeyHandle, rtl_uString*, RegKeyHandle*);
50  RegError (REGISTRY_CALLTYPE *openSubKeys) (RegKeyHandle, rtl_uString*, RegKeyHandle**, sal_uInt32*);
55  RegError (REGISTRY_CALLTYPE *setLongListValue) (RegKeyHandle, rtl_uString*, sal_Int32 const *, sal_uInt32);
58  RegError (REGISTRY_CALLTYPE *getValueInfo) (RegKeyHandle, rtl_uString*, RegValueType*, sal_uInt32*);
60  RegError (REGISTRY_CALLTYPE *getLongListValue) (RegKeyHandle, rtl_uString*, sal_Int32**, sal_uInt32*);
62  RegError (REGISTRY_CALLTYPE *getUnicodeListValue)(RegKeyHandle, rtl_uString*, sal_Unicode***, sal_uInt32*);
65  RegError (REGISTRY_CALLTYPE *getKeyNames) (RegKeyHandle, rtl_uString*, rtl_uString***, sal_uInt32*);
67 };
68 
72 
73 }
74 
75 class RegistryKey;
76 
77 
82 class Registry final
83 {
84 public:
87  inline Registry();
88 
90  inline Registry(const Registry& toCopy);
91 
92  Registry(Registry && other) noexcept : m_pApi(other.m_pApi), m_hImpl(other.m_hImpl)
93  { other.m_hImpl = nullptr; }
94 
96  inline ~Registry();
97 
99  inline Registry& operator = (const Registry& toAssign);
100 
102  if (m_hImpl != nullptr) {
103  m_pApi->release(m_hImpl);
104  }
105  m_hImpl = other.m_hImpl;
106  other.m_hImpl = nullptr;
107  return *this;
108  }
109 
111  inline bool isValid() const;
112 
117  inline bool isReadOnly() const;
118 
124  inline RegError openRootKey(RegistryKey& rRootKey);
125 
127  inline OUString getName();
128 
134  inline RegError create(const OUString& registryName);
135 
143  inline RegError open(const OUString& registryName,
144  RegAccessMode accessMode);
145 
147  inline RegError close();
148 
155  inline RegError destroy(const OUString& registryName);
156 
171  inline RegError mergeKey(RegistryKey& rKey,
172  const OUString& keyName,
173  const OUString& regFileName,
174  bool bReport);
175 
176  friend class RegistryKey;
177  friend class RegistryKeyArray;
178  friend class RegistryKeyNames;
179 
181  const Registry_Api* getApi() const { return m_pApi; }
182 
183 private:
188 };
189 
190 
196 {
197 public:
199  inline RegistryKeyArray();
200 
202  inline ~RegistryKeyArray();
203 
205  inline RegistryKey getElement(sal_uInt32 index);
206 
208  inline sal_uInt32 getLength() const;
209 
210  friend class RegistryKey;
211 protected:
218  inline void setKeyHandles(Registry const & registry, RegKeyHandle* phKeys, sal_uInt32 length);
219 private:
221  sal_uInt32 m_length;
226 };
227 
228 
234 {
235 public:
237  inline RegistryKeyNames();
238 
240  inline ~RegistryKeyNames();
241 
243  inline OUString getElement(sal_uInt32 index);
244 
246  inline sal_uInt32 getLength() const;
247 
248  friend class RegistryKey;
249 protected:
256  inline void setKeyNames(Registry const & registry, rtl_uString** pKeyNames, sal_uInt32 length);
257 private:
259  sal_uInt32 m_length;
261  rtl_uString** m_pKeyNames;
264 };
265 
266 
271 template<class ValueType>
272 class RegistryValueList final
273 {
274 public:
277  : m_length(0)
278  , m_pValueList(nullptr)
280  {}
281 
284  {
285  if (m_pValueList)
286  {
287  m_registry.getApi()->freeValueList(m_valueType, m_pValueList, m_length);
288  }
289  }
290 
292  ValueType getElement(sal_uInt32 index)
293  {
294  if (m_registry.isValid() && index < m_length)
295  {
296  return m_pValueList[index];
297  } else
298  {
299  return 0;
300  }
301  }
302 
304  sal_uInt32 getLength()
305  {
306  return m_length;
307  }
308 
309  friend class RegistryKey;
310 
311 private:
319  void setValueList(const Registry& registry, RegValueType valueType,
320  ValueType* pValueList, sal_uInt32 length)
321  {
322  m_length = length;
323  m_pValueList = pValueList;
324  m_valueType = valueType;
325  m_registry = registry;
326  }
327 
329  sal_uInt32 m_length;
338 };
339 
340 
346 {
347 public:
349  inline RegistryKey();
350 
352  inline RegistryKey(const RegistryKey& toCopy);
353 
355  inline ~RegistryKey();
356 
358  inline RegistryKey& operator = (const RegistryKey& toAssign);
359 
361  inline bool isValid() const;
362 
367  inline bool isReadOnly() const;
368 
370  inline OUString getName();
371 
379  inline RegError createKey(const OUString& keyName,
380  RegistryKey& rNewKey);
381 
389  inline RegError openKey(const OUString& keyName,
390  RegistryKey& rOpenKey);
391 
399  inline RegError openSubKeys(const OUString& keyName,
400  RegistryKeyArray& rSubKeys);
401 
409  inline RegError getKeyNames(const OUString& keyName,
410  RegistryKeyNames& rSubKeyNames);
411 
417  inline RegError deleteKey(const OUString& keyName);
418 
420  inline RegError closeKey();
421 
423  inline void releaseKey();
424 
435  inline RegError setValue(const OUString& keyName,
436  RegValueType valueType,
437  RegValue pValue,
438  sal_uInt32 valueSize);
439 
449  inline RegError setLongListValue(const OUString& keyName,
450  sal_Int32 const * pValueList,
451  sal_uInt32 len);
452 
462  inline RegError setStringListValue(const OUString& keyName,
463  char** pValueList,
464  sal_uInt32 len);
465 
475  inline RegError setUnicodeListValue(const OUString& keyName,
476  sal_Unicode** pValueList,
477  sal_uInt32 len);
478 
488  inline RegError getValueInfo(const OUString& keyName,
489  RegValueType* pValueType,
490  sal_uInt32* pValueSize);
491 
500  inline RegError getValue(const OUString& keyName,
501  RegValue pValue);
502 
511  inline RegError getLongListValue(const OUString& keyName,
512  RegistryValueList<sal_Int32>& rValueList);
513 
522  inline RegError getStringListValue(const OUString& keyName,
523  RegistryValueList<char*>& rValueList);
524 
533  inline RegError getUnicodeListValue(const OUString& keyName,
534  RegistryValueList<sal_Unicode*>& rValueList);
535 
543  inline RegError getResolvedKeyName(const OUString& keyName,
544  OUString& rResolvedName) const;
545 
547  inline OUString getRegistryName();
548 
549  friend class Registry;
550 public:
552 
557  inline RegistryKey(Registry const & registry,
558  RegKeyHandle hKey);
559 
560 protected:
563  inline void setRegistry(Registry const & registry);
564 
566 
571 };
572 
573 
575  : m_length(0)
576  , m_phKeys(nullptr)
577 {
578 }
579 
581 {
582  if (m_phKeys)
583  m_registry.m_pApi->closeSubKeys(m_phKeys, m_length);
584 }
585 
587 {
588  if (m_registry.isValid() && index < m_length)
589  return RegistryKey(m_registry, m_phKeys[index]);
590  else
591  return RegistryKey();
592 }
593 
594 inline sal_uInt32 RegistryKeyArray::getLength() const
595 {
596  return m_length;
597 }
598 
599 inline void RegistryKeyArray::setKeyHandles(Registry const & registry,
600  RegKeyHandle* phKeys,
601  sal_uInt32 length)
602 {
603  m_phKeys = phKeys;
604  m_length = length;
605  m_registry = registry;
606 }
607 
609  : m_length(0)
610  , m_pKeyNames(nullptr)
611 {
612 }
613 
615 {
616  if (m_pKeyNames)
617  m_registry.m_pApi->freeKeyNames(m_pKeyNames, m_length);
618 }
619 
620 inline OUString RegistryKeyNames::getElement(sal_uInt32 index)
621 {
622 
623  if (m_pKeyNames && index < m_length)
624  return m_pKeyNames[index];
625  else
626  return OUString();
627 }
628 
629 inline sal_uInt32 RegistryKeyNames::getLength() const
630 {
631  return m_length;
632 }
633 
634 inline void RegistryKeyNames::setKeyNames(Registry const & registry,
635  rtl_uString** pKeyNames,
636  sal_uInt32 length)
637 {
638  m_pKeyNames = pKeyNames;
639  m_length = length;
640  m_registry = registry;
641 }
642 
644  : m_hImpl(nullptr)
645  { }
646 
648 inline RegistryKey::RegistryKey(Registry const & registry, RegKeyHandle hKey)
649  : m_registry(registry)
650  , m_hImpl(hKey)
651  {
652  if (m_hImpl)
653  m_registry.m_pApi->acquireKey(m_hImpl);
654  }
656 
658  : m_registry(toCopy.m_registry)
659  , m_hImpl(toCopy.m_hImpl)
660  {
661  if (m_hImpl)
662  m_registry.m_pApi->acquireKey(m_hImpl);
663  }
664 
666 inline void RegistryKey::setRegistry(Registry const & registry)
667  {
668  m_registry = registry;
669  }
671 
673  {
674  if (m_hImpl)
675  m_registry.m_pApi->releaseKey(m_hImpl);
676  }
677 
679 {
680  m_registry = toAssign.m_registry;
681 
682  if (toAssign.m_hImpl)
683  m_registry.m_pApi->acquireKey(toAssign.m_hImpl);
684  if (m_hImpl)
685  m_registry.m_pApi->releaseKey(m_hImpl);
686  m_hImpl = toAssign.m_hImpl;
687 
688  return *this;
689 }
690 
691 inline bool RegistryKey::isValid() const
692  { return (m_hImpl != nullptr); }
693 
694 inline bool RegistryKey::isReadOnly() const
695  {
696  if (m_registry.isValid())
697  return m_registry.m_pApi->isKeyReadOnly(m_hImpl);
698  else
699  return false;
700  }
701 
702 inline OUString RegistryKey::getName()
703  {
704  OUString sRet;
705  if (m_registry.isValid())
706  m_registry.m_pApi->getKeyName(m_hImpl, &sRet.pData);
707  return sRet;
708  }
709 
710 inline RegError RegistryKey::createKey(const OUString& keyName,
711  RegistryKey& rNewKey)
712  {
713  if (rNewKey.isValid()) rNewKey.closeKey();
714  if (m_registry.isValid())
715  {
716  RegError ret = m_registry.m_pApi->createKey(m_hImpl, keyName.pData, &rNewKey.m_hImpl);
717  if (ret == RegError::NO_ERROR) rNewKey.setRegistry(m_registry);
718  return ret;
719  } else
720  return RegError::INVALID_KEY;
721  }
722 
723 inline RegError RegistryKey::openKey(const OUString& keyName,
724  RegistryKey& rOpenKey)
725  {
726  if (rOpenKey.isValid()) rOpenKey.closeKey();
727  if (m_registry.isValid())
728  {
729  RegError ret = m_registry.m_pApi->openKey(m_hImpl, keyName.pData,
730  &rOpenKey.m_hImpl);
731  if (ret == RegError::NO_ERROR) rOpenKey.setRegistry(m_registry);
732  return ret;
733  } else
734  return RegError::INVALID_KEY;
735  }
736 
737 inline RegError RegistryKey::openSubKeys(const OUString& keyName,
738  RegistryKeyArray& rSubKeys)
739  {
740  if (m_registry.isValid())
741  {
743  RegKeyHandle* pSubKeys;
744  sal_uInt32 nSubKeys;
745  ret = m_registry.m_pApi->openSubKeys(m_hImpl, keyName.pData,
746  &pSubKeys, &nSubKeys);
747  if ( ret != RegError::NO_ERROR)
748  {
749  return ret;
750  } else
751  {
752  rSubKeys.setKeyHandles(m_registry, pSubKeys, nSubKeys);
753  return ret;
754  }
755  } else
756  return RegError::INVALID_KEY;
757  }
758 
759 inline RegError RegistryKey::getKeyNames(const OUString& keyName,
760  RegistryKeyNames& rSubKeyNames)
761  {
762  if (m_registry.isValid())
763  {
765  rtl_uString** pSubKeyNames;
766  sal_uInt32 nSubKeys;
767  ret = m_registry.m_pApi->getKeyNames(m_hImpl, keyName.pData,
768  &pSubKeyNames, &nSubKeys);
769  if ( ret != RegError::NO_ERROR)
770  {
771  return ret;
772  } else
773  {
774  rSubKeyNames.setKeyNames(m_registry, pSubKeyNames, nSubKeys);
775  return ret;
776  }
777  } else
778  return RegError::INVALID_KEY;
779  }
780 
781 inline RegError RegistryKey::deleteKey(const OUString& keyName)
782  {
783  if (m_registry.isValid())
784  return m_registry.m_pApi->deleteKey(m_hImpl, keyName.pData);
785  else
786  return RegError::INVALID_KEY;
787  }
788 
790  {
791  if (m_registry.isValid())
792  {
793  RegError ret = m_registry.m_pApi->closeKey(m_hImpl);
794  if (ret == RegError::NO_ERROR)
795  {
796  m_hImpl = nullptr;
797  m_registry = Registry();
798  }
799  return ret;
800  } else
801  return RegError::INVALID_KEY;
802  }
803 
805 {
806  if (m_registry.isValid() && (m_hImpl != nullptr))
807  {
808  m_registry.m_pApi->releaseKey(m_hImpl);
809  m_hImpl = nullptr;
810  }
811 }
812 
813 inline RegError RegistryKey::setValue(const OUString& keyName,
814  RegValueType valueType,
815  RegValue pValue,
816  sal_uInt32 valueSize)
817  {
818  if (m_registry.isValid())
819  return m_registry.m_pApi->setValue(m_hImpl, keyName.pData, valueType,
820  pValue, valueSize);
821  else
822  return RegError::INVALID_KEY;
823  }
824 
825 inline RegError RegistryKey::setLongListValue(const OUString& keyName,
826  sal_Int32 const * pValueList,
827  sal_uInt32 len)
828  {
829  if (m_registry.isValid())
830  return m_registry.m_pApi->setLongListValue(m_hImpl, keyName.pData,
831  pValueList, len);
832  else
833  return RegError::INVALID_KEY;
834  }
835 
836 inline RegError RegistryKey::setStringListValue(const OUString& keyName,
837  char** pValueList,
838  sal_uInt32 len)
839  {
840  if (m_registry.isValid())
841  return m_registry.m_pApi->setStringListValue(m_hImpl, keyName.pData,
842  pValueList, len);
843  else
844  return RegError::INVALID_KEY;
845  }
846 
847 inline RegError RegistryKey::setUnicodeListValue(const OUString& keyName,
848  sal_Unicode** pValueList,
849  sal_uInt32 len)
850  {
851  if (m_registry.isValid())
852  return m_registry.m_pApi->setUnicodeListValue(m_hImpl, keyName.pData,
853  pValueList, len);
854  else
855  return RegError::INVALID_KEY;
856  }
857 
858 inline RegError RegistryKey::getValueInfo(const OUString& keyName,
859  RegValueType* pValueType,
860  sal_uInt32* pValueSize)
861  {
862  if (m_registry.isValid())
863  return m_registry.m_pApi->getValueInfo(m_hImpl, keyName.pData, pValueType, pValueSize);
864  else
865  return RegError::INVALID_KEY;
866  }
867 
868 inline RegError RegistryKey::getValue(const OUString& keyName,
869  RegValue pValue)
870  {
871  if (m_registry.isValid())
872  return m_registry.m_pApi->getValue(m_hImpl, keyName.pData, pValue);
873  else
874  return RegError::INVALID_KEY;
875  }
876 
877 inline RegError RegistryKey::getLongListValue(const OUString& keyName,
878  RegistryValueList<sal_Int32>& rValueList)
879  {
880  if (m_registry.isValid())
881  {
883  sal_Int32* pValueList;
884  sal_uInt32 length;
885  ret = m_registry.m_pApi->getLongListValue(m_hImpl, keyName.pData,
886  &pValueList, &length);
887  if ( ret != RegError::NO_ERROR)
888  {
889  return ret;
890  } else
891  {
893  pValueList, length);
894  return ret;
895  }
896  } else
897  return RegError::INVALID_KEY;
898  }
899 
900 inline RegError RegistryKey::getStringListValue(const OUString& keyName,
901  RegistryValueList<char*>& rValueList)
902  {
903  if (m_registry.isValid())
904  {
906  char** pValueList;
907  sal_uInt32 length;
908  ret = m_registry.m_pApi->getStringListValue(m_hImpl, keyName.pData,
909  &pValueList, &length);
910  if ( ret != RegError::NO_ERROR )
911  {
912  return ret;
913  } else
914  {
916  pValueList, length);
917  return ret;
918  }
919  } else
920  return RegError::INVALID_KEY;
921  }
922 
923 inline RegError RegistryKey::getUnicodeListValue(const OUString& keyName,
925  {
926  if (m_registry.isValid())
927  {
929  sal_Unicode** pValueList;
930  sal_uInt32 length;
931  ret = m_registry.m_pApi->getUnicodeListValue(m_hImpl, keyName.pData,
932  &pValueList, &length);
933  if ( ret != RegError::NO_ERROR )
934  {
935  return ret;
936  } else
937  {
938  rValueList.setValueList(m_registry, RegValueType::UNICODELIST,
939  pValueList, length);
940  return ret;
941  }
942  } else
943  return RegError::INVALID_KEY;
944  }
945 
946 inline RegError RegistryKey::getResolvedKeyName(const OUString& keyName,
947  OUString& rResolvedName) const
948  {
949  if (m_registry.isValid())
950  return m_registry.m_pApi->getResolvedKeyName(m_hImpl,
951  keyName.pData,
952  true,
953  &rResolvedName.pData);
954  else
955  return RegError::INVALID_KEY;
956  }
957 
959  {
960  if (m_registry.isValid())
961  {
962  return m_registry.getName();
963  } else
964  return OUString();
965  }
966 
967 
970  , m_hImpl(nullptr)
971  { }
972 
973 inline Registry::Registry(const Registry& toCopy)
974  : m_pApi(toCopy.m_pApi)
975  , m_hImpl(toCopy.m_hImpl)
976  {
977  if (m_hImpl)
978  m_pApi->acquire(m_hImpl);
979  }
980 
981 
983  {
984  if (m_hImpl)
985  m_pApi->release(m_hImpl);
986  }
987 
988 inline Registry& Registry::operator = (const Registry& toAssign)
989 {
990  if (toAssign.m_hImpl)
991  toAssign.m_pApi->acquire(toAssign.m_hImpl);
992  if (m_hImpl)
993  m_pApi->release(m_hImpl);
994 
995  m_pApi = toAssign.m_pApi;
996  m_hImpl = toAssign.m_hImpl;
997 
998  return *this;
999 }
1000 
1001 inline bool Registry::isValid() const
1002  { return ( m_hImpl != nullptr ); }
1003 
1004 inline bool Registry::isReadOnly() const
1005  { return m_pApi->isReadOnly(m_hImpl); }
1006 
1008  {
1009  rRootKey.setRegistry(*this);
1010  return m_pApi->openRootKey(m_hImpl, &rRootKey.m_hImpl);
1011  }
1012 
1013 inline OUString Registry::getName()
1014  {
1015  OUString sRet;
1016  m_pApi->getName(m_hImpl, &sRet.pData);
1017  return sRet;
1018  }
1019 
1020 inline RegError Registry::create(const OUString& registryName)
1021  {
1022  if (m_hImpl)
1023  m_pApi->release(m_hImpl);
1024  return m_pApi->createRegistry(registryName.pData, &m_hImpl);
1025  }
1026 
1027 inline RegError Registry::open(const OUString& registryName,
1028  RegAccessMode accessMode)
1029  {
1030  if (m_hImpl)
1031  m_pApi->release(m_hImpl);
1032  return m_pApi->openRegistry(registryName.pData, &m_hImpl, accessMode);
1033  }
1034 
1036  {
1037  RegError ret = m_pApi->closeRegistry(m_hImpl);
1038  if (ret == RegError::NO_ERROR)
1039  m_hImpl = nullptr;
1040  return ret;
1041  }
1042 
1043 inline RegError Registry::destroy(const OUString& registryName)
1044  {
1045  RegError ret = m_pApi->destroyRegistry(m_hImpl, registryName.pData);
1046  if ( ret == RegError::NO_ERROR && registryName.isEmpty() )
1047  m_hImpl = nullptr;
1048  return ret;
1049  }
1050 
1052  const OUString& keyName,
1053  const OUString& regFileName,
1054  bool bReport)
1055  { return m_pApi->mergeKey(m_hImpl, rKey.m_hImpl, keyName.pData, regFileName.pData, false/*bWarnings*/, bReport); }
1056 
1057 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
RegError REGISTRY_CALLTYPE setValue(RegKeyHandle hKey, rtl_uString *keyName, RegValueType valueType, RegValue pData, sal_uInt32 valueSize)
Definition: regkey.cxx:194
sal_uInt32 m_length
stores the number of open subkeys, the number of elements.
Definition: registry.hxx:221
static RegError REGISTRY_CALLTYPE openRootKey(RegHandle hReg, RegKeyHandle *phRootKey)
Definition: registry.cxx:116
STRINGLIST
The key has a value of type ascii string list.
Definition: regtype.h:62
NO_ERROR
no error.
Definition: regtype.h:83
void setKeyNames(Registry const &registry, rtl_uString **pKeyNames, sal_uInt32 length)
sets the data of the array.
Definition: registry.hxx:634
RegError destroy(const OUString &registryName)
destroys a registry.
Definition: registry.hxx:1043
rtl_uString sal_Unicode sal_uInt32
Definition: registry.hxx:57
bool isValid() const
checks if the key points to a valid registry key.
Definition: registry.hxx:691
RegistryKey & operator=(const RegistryKey &toAssign)
Assign operator.
Definition: registry.hxx:678
RegError mergeKey(RegistryKey &rKey, const OUString &keyName, const OUString &regFileName, bool bReport)
merges the registry information of the specified key with the registry information of the specified f...
Definition: registry.hxx:1051
RegError REGISTRY_CALLTYPE getStringListValue(RegKeyHandle hKey, rtl_uString *keyName, char ***pValueList, sal_uInt32 *pLen)
Definition: regkey.cxx:491
RegError openKey(const OUString &keyName, RegistryKey &rOpenKey)
opens the specified key.
Definition: registry.hxx:723
RegAccessMode
defines the open/access mode of the registry.
Definition: regtype.h:41
sal_uInt32 getLength() const
returns the length of the array.
Definition: registry.hxx:594
sal_Bool REGISTRY_CALLTYPE isKeyReadOnly(RegKeyHandle hKey)
Definition: regkey.cxx:56
const Registry_Api * m_pApi
stores the used and initialized registry Api.
Definition: registry.hxx:185
RegError getValueInfo(const OUString &keyName, RegValueType *pValueType, sal_uInt32 *pValueSize)
gets info about type and size of a value.
Definition: registry.hxx:858
rtl_uString char sal_uInt32
Definition: registry.hxx:56
friend class RegistryKey
Definition: registry.hxx:210
#define REG_DLLPUBLIC
Definition: regdllapi.h:28
RegError setStringListValue(const OUString &keyName, char **pValueList, sal_uInt32 len)
sets an ascii list value of a key.
Definition: registry.hxx:836
sal_uInt32 m_length
stores the number of key names, the number of elements.
Definition: registry.hxx:259
rtl_uString sal_Bool
Definition: registry.hxx:64
LONGLIST
The key has a value of type long list.
Definition: regtype.h:62
const Registry_Api * getApi() const
returns the used registry Api.
Definition: registry.hxx:181
RegError REGISTRY_CALLTYPE closeKey(RegKeyHandle hKey)
Definition: regkey.cxx:182
RegistryKey getElement(sal_uInt32 index)
returns the open key specified by index.
Definition: registry.hxx:586
OUString getElement(sal_uInt32 index)
returns the name of the key specified by index.
Definition: registry.hxx:620
static RegError REGISTRY_CALLTYPE openRegistry(rtl_uString *registryName, RegHandle *phRegistry, RegAccessMode accessMode)
Definition: registry.cxx:140
RegError getValue(const OUString &keyName, RegValue pValue)
gets the value of a key.
Definition: registry.hxx:868
RegError REGISTRY_CALLTYPE getUnicodeListValue(RegKeyHandle hKey, rtl_uString *keyName, sal_Unicode ***pValueList, sal_uInt32 *pLen)
Definition: regkey.cxx:529
static void REGISTRY_CALLTYPE acquire(RegHandle hReg)
Definition: registry.cxx:36
RegKeyHandle rtl_uString RegHandle RegHandle RegAccessMode
Definition: registry.hxx:40
rtl_uString rtl_uString rtl_uString sal_Bool
Definition: registry.hxx:43
static void TYPEREG_CALLTYPE release(TypeWriterImpl hEntry)
Definition: reflwrit.cxx:1112
RegError close()
closes explicitly the current registry data file.
Definition: registry.hxx:1035
NOT_DEFINED
The key has no value or the value type is unknown.
Definition: regtype.h:62
Registry m_registry
stores the registry on which this key works
Definition: registry.hxx:568
specifies a collection of function pointers which represents the complete registry C-API...
Definition: registry.hxx:32
RegError REGISTRY_CALLTYPE getValue(RegKeyHandle hKey, rtl_uString *keyName, RegValue pValue)
Definition: regkey.cxx:416
Registry m_registry
stores the handle to the registry file where the appropriate keys are located.
Definition: registry.hxx:225
Registry m_registry
stores the handle to the registry file where the appropriate keys are located.
Definition: registry.hxx:263
RegKeyHandle m_hImpl
stores the current key handle of this key
Definition: registry.hxx:570
RegError REGISTRY_CALLTYPE getResolvedKeyName(RegKeyHandle hKey, rtl_uString *keyName, SAL_UNUSED_PARAMETER sal_Bool, rtl_uString **pResolvedName)
Definition: regkey.cxx:613
RegError getKeyNames(const OUString &keyName, RegistryKeyNames &rSubKeyNames)
returns an array with the names of all subkeys of the specified key.
Definition: registry.hxx:759
sal_uInt16 sal_Unicode
rtl_uString ** m_pKeyNames
stores an array of key names.
Definition: registry.hxx:261
Registry()
Default constructor.
Definition: registry.hxx:968
rtl_uString RegValueType sal_uInt32 rtl_uString RegValue
Definition: registry.hxx:59
OUString getName()
returns the full qualified name of the key beginning with the rootkey.
Definition: registry.hxx:702
static sal_Bool REGISTRY_CALLTYPE isReadOnly(RegHandle hReg)
Definition: registry.cxx:84
length
void * RegHandle
defines the type of a registry handle used in the C API.
Definition: regtype.h:27
sal_uInt32 m_length
stores the length of the list, the number of elements.
Definition: registry.hxx:329
Registry & operator=(const Registry &toAssign)
Assign operator.
Definition: registry.hxx:988
RegError REGISTRY_CALLTYPE setUnicodeListValue(RegKeyHandle hKey, rtl_uString *keyName, sal_Unicode **pValueList, sal_uInt32 len)
Definition: regkey.cxx:321
RegistryKeyNames()
Default constructor.
Definition: registry.hxx:608
enum SAL_DLLPUBLIC_RTTI RegError
specifies the possible error codes which can occur using the registry API.
Definition: regtype.h:80
RegError setValue(const OUString &keyName, RegValueType valueType, RegValue pValue, sal_uInt32 valueSize)
sets a value of a key.
Definition: registry.hxx:813
RegError open(const OUString &registryName, RegAccessMode accessMode)
opens a registry with the specified name.
Definition: registry.hxx:1027
RegError REGISTRY_CALLTYPE openKey(RegKeyHandle hKey, rtl_uString *keyName, RegKeyHandle *phOpenKey)
Definition: regkey.cxx:104
RegistryKey reads or writes information of the underlying key in a registry.
Definition: registry.hxx:345
rtl_uString RegValueType
Definition: registry.hxx:54
rtl_uString rtl_uString RegKeyHandle rtl_uString RegKeyHandle rtl_uString RegKeyHandle sal_uInt32 sal_uInt32
Definition: registry.hxx:51
RegistryValueList represents a value list of the specified type.
Definition: registry.hxx:272
RegError openSubKeys(const OUString &keyName, RegistryKeyArray &rSubKeys)
opens all subkeys of the specified key.
Definition: registry.hxx:737
enum SAL_DLLPUBLIC_RTTI RegValueType
defines the type of a key value.
Definition: regtype.h:59
RegistryKey()
Default constructor.
Definition: registry.hxx:643
OUString getName()
returns the name of the current registry data file.
Definition: registry.hxx:1013
RegError REGISTRY_CALLTYPE closeSubKeys(RegKeyHandle *phSubKeys, sal_uInt32 nSubKeys)
Definition: regkey.cxx:144
RegError setLongListValue(const OUString &keyName, sal_Int32 const *pValueList, sal_uInt32 len)
sets a long list value of a key.
Definition: registry.hxx:825
RegValueType m_valueType
stores the type of the list elements
Definition: registry.hxx:333
static RegError REGISTRY_CALLTYPE destroyRegistry(RegHandle hReg, rtl_uString *registryName)
Definition: registry.cxx:192
RegistryKeyNames represents an array of key names.
Definition: registry.hxx:233
Registry(Registry &&other) noexcept
Definition: registry.hxx:92
~RegistryKey()
Destructor, close the key if it references an open one.
Definition: registry.hxx:672
sal_uInt32 getLength() const
returns the length of the array.
Definition: registry.hxx:629
Registry m_registry
stores the handle to the registry file where the appropriate key to this value is located...
Definition: registry.hxx:337
RegError deleteKey(const OUString &keyName)
deletes the specified key.
Definition: registry.hxx:781
void REGISTRY_CALLTYPE acquireKey(RegKeyHandle hKey)
Definition: regkey.cxx:30
RegError REGISTRY_CALLTYPE setStringListValue(RegKeyHandle hKey, rtl_uString *keyName, char **pValueList, sal_uInt32 len)
Definition: regkey.cxx:279
tuple index
rtl_uString RegValue
Definition: registry.hxx:54
RegError getResolvedKeyName(const OUString &keyName, OUString &rResolvedName) const
resolves a keyname.
Definition: registry.hxx:946
RegError REGISTRY_CALLTYPE deleteKey(RegKeyHandle hKey, rtl_uString *keyName)
Definition: regkey.cxx:163
rtl_uString sal_uInt32
Definition: registry.hxx:54
sal_uInt32 getLength()
returns the length of the list.
Definition: registry.hxx:304
ValueType * m_pValueList
stores the value list.
Definition: registry.hxx:331
RegError REGISTRY_CALLTYPE freeValueList(RegValueType valueType, RegValue pValueList, sal_uInt32 len)
Definition: regkey.cxx:569
RegError closeKey()
closes explicitly the current key
Definition: registry.hxx:789
RegError REGISTRY_CALLTYPE setLongListValue(RegKeyHandle hKey, rtl_uString *keyName, sal_Int32 const *pValueList, sal_uInt32 len)
Definition: regkey.cxx:237
RegKeyHandle * m_phKeys
stores an array of open subkeys.
Definition: registry.hxx:223
~RegistryKeyArray()
Destructor, all subkeys will be closed.
Definition: registry.hxx:580
INVALID_KEY
the key is not in a valid state.
Definition: regtype.h:83
static RegError REGISTRY_CALLTYPE closeRegistry(RegHandle hReg)
Definition: registry.cxx:163
RegError getUnicodeListValue(const OUString &keyName, RegistryValueList< sal_Unicode * > &rValueList)
gets a unicode value of a key.
Definition: registry.hxx:923
void setKeyHandles(Registry const &registry, RegKeyHandle *phKeys, sal_uInt32 length)
sets the data of the key array.
Definition: registry.hxx:599
~Registry()
Destructor. The Destructor close the registry if it is open.
Definition: registry.hxx:982
ValueType
RegError openRootKey(RegistryKey &rRootKey)
opens the root key of the registry.
Definition: registry.hxx:1007
rtl_uString sal_Int32 sal_uInt32 rtl_uString char sal_uInt32 rtl_uString sal_Unicode sal_uInt32 sal_uInt32
Definition: registry.hxx:63
static RegError REGISTRY_CALLTYPE getName(RegHandle hReg, rtl_uString **pName)
Definition: registry.cxx:61
void * RegKeyHandle
defines the type of a registry key handle used in the C API.
Definition: regtype.h:30
RegHandle m_hImpl
stores the handle of the underlying registry file on which most of the functions work.
Definition: registry.hxx:187
rtl_uString rtl_uString rtl_uString rtl_uString sal_uInt32 sal_uInt32
Definition: registry.hxx:66
bool isReadOnly() const
returns the access mode of the key.
Definition: registry.hxx:694
void REGISTRY_CALLTYPE releaseKey(RegKeyHandle hKey)
Definition: regkey.cxx:43
static RegError REGISTRY_CALLTYPE mergeKey(RegHandle hReg, RegKeyHandle hKey, rtl_uString *keyName, rtl_uString *regFileName, sal_Bool bWarnings, sal_Bool bReport)
Definition: registry.cxx:222
void * RegValue
defines the type of a registry key value handle used in the C API.
Definition: regtype.h:33
friend class Registry
Definition: registry.hxx:549
RegError REGISTRY_CALLTYPE openSubKeys(RegKeyHandle hKey, rtl_uString *keyName, RegKeyHandle **pphSubKeys, sal_uInt32 *pnSubKeys)
Definition: regkey.cxx:123
void setValueList(const Registry &registry, RegValueType valueType, ValueType *pValueList, sal_uInt32 length)
sets the data of the value list.
Definition: registry.hxx:319
RegError REGISTRY_CALLTYPE getLongListValue(RegKeyHandle hKey, rtl_uString *keyName, sal_Int32 **pValueList, sal_uInt32 *pLen)
Definition: regkey.cxx:451
bool isReadOnly() const
returns the access mode of the registry.
Definition: registry.hxx:1004
~RegistryKeyNames()
Destructor, the internal array with key names will be deleted.
Definition: registry.hxx:614
RegError getStringListValue(const OUString &keyName, RegistryValueList< char * > &rValueList)
gets an ascii list value of a key.
Definition: registry.hxx:900
RegError REGISTRY_CALLTYPE getKeyNames(RegKeyHandle hKey, rtl_uString *keyName, rtl_uString ***pSubKeyNames, sal_uInt32 *pnSubKeys)
Definition: regkey.cxx:635
~RegistryValueList()
Destructor, the internal value list will be freed.
Definition: registry.hxx:283
RegError getLongListValue(const OUString &keyName, RegistryValueList< sal_Int32 > &rValueList)
gets a long list value of a key.
Definition: registry.hxx:877
bool isValid() const
checks if the registry points to a valid registry data file.
Definition: registry.hxx:1001
RegError(REGISTRY_CALLTYPE *openRootKey)(RegHandle
RegistryKeyArray represents an array of open keys.
Definition: registry.hxx:195
rtl_uString sal_Int32 const sal_uInt32
Definition: registry.hxx:55
The Registry provides the functionality to read and write information in a registry file...
Definition: registry.hxx:82
static RegError REGISTRY_CALLTYPE createRegistry(rtl_uString *registryName, RegHandle *phRegistry)
Definition: registry.cxx:95
ValueType getElement(sal_uInt32 index)
returns the value of the list specified by index.
Definition: registry.hxx:292
void(REGISTRY_CALLTYPE *acquire)(RegHandle)
#define REGISTRY_CALLTYPE
specify the calling convention for the registry API
Definition: regtype.h:135
RegError REGISTRY_CALLTYPE getKeyName(RegKeyHandle hKey, rtl_uString **pKeyName)
Definition: regkey.cxx:65
void releaseKey()
releases the current key
Definition: registry.hxx:804
REG_DLLPUBLIC Registry_Api *REGISTRY_CALLTYPE initRegistry_Api()
the API initialization function.
Definition: registry.cxx:294
RegistryValueList()
Default constructor.
Definition: registry.hxx:276
RegError setUnicodeListValue(const OUString &keyName, sal_Unicode **pValueList, sal_uInt32 len)
sets a unicode string list value of a key.
Definition: registry.hxx:847
RegError create(const OUString &registryName)
creates a new registry with the specified name and creates a root key.
Definition: registry.hxx:1020
OUString getRegistryName()
returns the name of the registry in which the key is defined.
Definition: registry.hxx:958
RegError REGISTRY_CALLTYPE getValueInfo(RegKeyHandle hKey, rtl_uString *keyName, RegValueType *pValueType, sal_uInt32 *pValueSize)
Definition: regkey.cxx:363
RegError createKey(const OUString &keyName, RegistryKey &rNewKey)
creates a new key or opens a key if the specified key already exists.
Definition: registry.hxx:710
rtl_uString RegKeyHandle
Definition: registry.hxx:43
RegError REGISTRY_CALLTYPE createKey(RegKeyHandle hKey, rtl_uString *keyName, RegKeyHandle *phNewKey)
Definition: regkey.cxx:82
RegistryKeyArray()
Default constructor.
Definition: registry.hxx:574
RegError REGISTRY_CALLTYPE freeKeyNames(rtl_uString **pKeyNames, sal_uInt32 nKeys)
Definition: regkey.cxx:653