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 
212 private:
219  inline void setKeyHandles(Registry const & registry, RegKeyHandle* phKeys, sal_uInt32 length);
220 
222  sal_uInt32 m_length;
227 };
228 
229 
235 {
236 public:
238  inline RegistryKeyNames();
239 
241  inline ~RegistryKeyNames();
242 
244  inline OUString getElement(sal_uInt32 index);
245 
247  inline sal_uInt32 getLength() const;
248 
249  friend class RegistryKey;
250 
251 private:
258  inline void setKeyNames(Registry const & registry, rtl_uString** pKeyNames, sal_uInt32 length);
259 
261  sal_uInt32 m_length;
263  rtl_uString** m_pKeyNames;
266 };
267 
268 
273 template<class ValueType>
274 class RegistryValueList final
275 {
276 public:
279  : m_length(0)
280  , m_pValueList(nullptr)
282  {}
283 
286  {
287  if (m_pValueList)
288  {
289  m_registry.getApi()->freeValueList(m_valueType, m_pValueList, m_length);
290  }
291  }
292 
294  ValueType getElement(sal_uInt32 index)
295  {
296  if (m_registry.isValid() && index < m_length)
297  {
298  return m_pValueList[index];
299  } else
300  {
301  return 0;
302  }
303  }
304 
306  sal_uInt32 getLength()
307  {
308  return m_length;
309  }
310 
311  friend class RegistryKey;
312 
313 private:
321  void setValueList(const Registry& registry, RegValueType valueType,
322  ValueType* pValueList, sal_uInt32 length)
323  {
324  m_length = length;
325  m_pValueList = pValueList;
326  m_valueType = valueType;
327  m_registry = registry;
328  }
329 
331  sal_uInt32 m_length;
340 };
341 
342 
348 {
349 public:
351  inline RegistryKey();
352 
354  inline RegistryKey(const RegistryKey& toCopy);
355 
357  inline ~RegistryKey();
358 
360  inline RegistryKey& operator = (const RegistryKey& toAssign);
361 
363  inline bool isValid() const;
364 
369  inline bool isReadOnly() const;
370 
372  inline OUString getName();
373 
381  inline RegError createKey(const OUString& keyName,
382  RegistryKey& rNewKey);
383 
391  inline RegError openKey(const OUString& keyName,
392  RegistryKey& rOpenKey);
393 
401  inline RegError openSubKeys(const OUString& keyName,
402  RegistryKeyArray& rSubKeys);
403 
411  inline RegError getKeyNames(const OUString& keyName,
412  RegistryKeyNames& rSubKeyNames);
413 
419  inline RegError deleteKey(const OUString& keyName);
420 
422  inline RegError closeKey();
423 
425  inline void releaseKey();
426 
437  inline RegError setValue(const OUString& keyName,
438  RegValueType valueType,
439  RegValue pValue,
440  sal_uInt32 valueSize);
441 
451  inline RegError setLongListValue(const OUString& keyName,
452  sal_Int32 const * pValueList,
453  sal_uInt32 len);
454 
464  inline RegError setStringListValue(const OUString& keyName,
465  char** pValueList,
466  sal_uInt32 len);
467 
477  inline RegError setUnicodeListValue(const OUString& keyName,
478  sal_Unicode** pValueList,
479  sal_uInt32 len);
480 
490  inline RegError getValueInfo(const OUString& keyName,
491  RegValueType* pValueType,
492  sal_uInt32* pValueSize);
493 
502  inline RegError getValue(const OUString& keyName,
503  RegValue pValue);
504 
513  inline RegError getLongListValue(const OUString& keyName,
514  RegistryValueList<sal_Int32>& rValueList);
515 
524  inline RegError getStringListValue(const OUString& keyName,
525  RegistryValueList<char*>& rValueList);
526 
535  inline RegError getUnicodeListValue(const OUString& keyName,
536  RegistryValueList<sal_Unicode*>& rValueList);
537 
545  inline RegError getResolvedKeyName(const OUString& keyName,
546  OUString& rResolvedName) const;
547 
549  inline OUString getRegistryName();
550 
551  friend class Registry;
552 public:
554 
559  inline RegistryKey(Registry const & registry,
560  RegKeyHandle hKey);
561 
562 private:
565  inline void setRegistry(Registry const & registry);
566 
568 
573 };
574 
575 
577  : m_length(0)
578  , m_phKeys(nullptr)
579 {
580 }
581 
583 {
584  if (m_phKeys)
585  m_registry.m_pApi->closeSubKeys(m_phKeys, m_length);
586 }
587 
589 {
590  if (m_registry.isValid() && index < m_length)
591  return RegistryKey(m_registry, m_phKeys[index]);
592  else
593  return RegistryKey();
594 }
595 
596 inline sal_uInt32 RegistryKeyArray::getLength() const
597 {
598  return m_length;
599 }
600 
601 inline void RegistryKeyArray::setKeyHandles(Registry const & registry,
602  RegKeyHandle* phKeys,
603  sal_uInt32 length)
604 {
605  m_phKeys = phKeys;
606  m_length = length;
607  m_registry = registry;
608 }
609 
611  : m_length(0)
612  , m_pKeyNames(nullptr)
613 {
614 }
615 
617 {
618  if (m_pKeyNames)
619  m_registry.m_pApi->freeKeyNames(m_pKeyNames, m_length);
620 }
621 
622 inline OUString RegistryKeyNames::getElement(sal_uInt32 index)
623 {
624 
625  if (m_pKeyNames && index < m_length)
626  return m_pKeyNames[index];
627  else
628  return OUString();
629 }
630 
631 inline sal_uInt32 RegistryKeyNames::getLength() const
632 {
633  return m_length;
634 }
635 
636 inline void RegistryKeyNames::setKeyNames(Registry const & registry,
637  rtl_uString** pKeyNames,
638  sal_uInt32 length)
639 {
640  m_pKeyNames = pKeyNames;
641  m_length = length;
642  m_registry = registry;
643 }
644 
646  : m_hImpl(nullptr)
647  { }
648 
650 inline RegistryKey::RegistryKey(Registry const & registry, RegKeyHandle hKey)
651  : m_registry(registry)
652  , m_hImpl(hKey)
653  {
654  if (m_hImpl)
655  m_registry.m_pApi->acquireKey(m_hImpl);
656  }
658 
660  : m_registry(toCopy.m_registry)
661  , m_hImpl(toCopy.m_hImpl)
662  {
663  if (m_hImpl)
664  m_registry.m_pApi->acquireKey(m_hImpl);
665  }
666 
668 inline void RegistryKey::setRegistry(Registry const & registry)
669  {
670  m_registry = registry;
671  }
673 
675  {
676  if (m_hImpl)
677  m_registry.m_pApi->releaseKey(m_hImpl);
678  }
679 
681 {
682  m_registry = toAssign.m_registry;
683 
684  if (toAssign.m_hImpl)
685  m_registry.m_pApi->acquireKey(toAssign.m_hImpl);
686  if (m_hImpl)
687  m_registry.m_pApi->releaseKey(m_hImpl);
688  m_hImpl = toAssign.m_hImpl;
689 
690  return *this;
691 }
692 
693 inline bool RegistryKey::isValid() const
694  { return (m_hImpl != nullptr); }
695 
696 inline bool RegistryKey::isReadOnly() const
697  {
698  if (m_registry.isValid())
699  return m_registry.m_pApi->isKeyReadOnly(m_hImpl);
700  else
701  return false;
702  }
703 
704 inline OUString RegistryKey::getName()
705  {
706  OUString sRet;
707  if (m_registry.isValid())
708  m_registry.m_pApi->getKeyName(m_hImpl, &sRet.pData);
709  return sRet;
710  }
711 
712 inline RegError RegistryKey::createKey(const OUString& keyName,
713  RegistryKey& rNewKey)
714  {
715  if (rNewKey.isValid()) rNewKey.closeKey();
716  if (m_registry.isValid())
717  {
718  RegError ret = m_registry.m_pApi->createKey(m_hImpl, keyName.pData, &rNewKey.m_hImpl);
719  if (ret == RegError::NO_ERROR) rNewKey.setRegistry(m_registry);
720  return ret;
721  } else
722  return RegError::INVALID_KEY;
723  }
724 
725 inline RegError RegistryKey::openKey(const OUString& keyName,
726  RegistryKey& rOpenKey)
727  {
728  if (rOpenKey.isValid()) rOpenKey.closeKey();
729  if (m_registry.isValid())
730  {
731  RegError ret = m_registry.m_pApi->openKey(m_hImpl, keyName.pData,
732  &rOpenKey.m_hImpl);
733  if (ret == RegError::NO_ERROR) rOpenKey.setRegistry(m_registry);
734  return ret;
735  } else
736  return RegError::INVALID_KEY;
737  }
738 
739 inline RegError RegistryKey::openSubKeys(const OUString& keyName,
740  RegistryKeyArray& rSubKeys)
741  {
742  if (m_registry.isValid())
743  {
745  RegKeyHandle* pSubKeys;
746  sal_uInt32 nSubKeys;
747  ret = m_registry.m_pApi->openSubKeys(m_hImpl, keyName.pData,
748  &pSubKeys, &nSubKeys);
749  if ( ret != RegError::NO_ERROR)
750  {
751  return ret;
752  } else
753  {
754  rSubKeys.setKeyHandles(m_registry, pSubKeys, nSubKeys);
755  return ret;
756  }
757  } else
758  return RegError::INVALID_KEY;
759  }
760 
761 inline RegError RegistryKey::getKeyNames(const OUString& keyName,
762  RegistryKeyNames& rSubKeyNames)
763  {
764  if (m_registry.isValid())
765  {
767  rtl_uString** pSubKeyNames;
768  sal_uInt32 nSubKeys;
769  ret = m_registry.m_pApi->getKeyNames(m_hImpl, keyName.pData,
770  &pSubKeyNames, &nSubKeys);
771  if ( ret != RegError::NO_ERROR)
772  {
773  return ret;
774  } else
775  {
776  rSubKeyNames.setKeyNames(m_registry, pSubKeyNames, nSubKeys);
777  return ret;
778  }
779  } else
780  return RegError::INVALID_KEY;
781  }
782 
783 inline RegError RegistryKey::deleteKey(const OUString& keyName)
784  {
785  if (m_registry.isValid())
786  return m_registry.m_pApi->deleteKey(m_hImpl, keyName.pData);
787  else
788  return RegError::INVALID_KEY;
789  }
790 
792  {
793  if (m_registry.isValid())
794  {
795  RegError ret = m_registry.m_pApi->closeKey(m_hImpl);
796  if (ret == RegError::NO_ERROR)
797  {
798  m_hImpl = nullptr;
799  m_registry = Registry();
800  }
801  return ret;
802  } else
803  return RegError::INVALID_KEY;
804  }
805 
807 {
808  if (m_registry.isValid() && (m_hImpl != nullptr))
809  {
810  m_registry.m_pApi->releaseKey(m_hImpl);
811  m_hImpl = nullptr;
812  }
813 }
814 
815 inline RegError RegistryKey::setValue(const OUString& keyName,
816  RegValueType valueType,
817  RegValue pValue,
818  sal_uInt32 valueSize)
819  {
820  if (m_registry.isValid())
821  return m_registry.m_pApi->setValue(m_hImpl, keyName.pData, valueType,
822  pValue, valueSize);
823  else
824  return RegError::INVALID_KEY;
825  }
826 
827 inline RegError RegistryKey::setLongListValue(const OUString& keyName,
828  sal_Int32 const * pValueList,
829  sal_uInt32 len)
830  {
831  if (m_registry.isValid())
832  return m_registry.m_pApi->setLongListValue(m_hImpl, keyName.pData,
833  pValueList, len);
834  else
835  return RegError::INVALID_KEY;
836  }
837 
838 inline RegError RegistryKey::setStringListValue(const OUString& keyName,
839  char** pValueList,
840  sal_uInt32 len)
841  {
842  if (m_registry.isValid())
843  return m_registry.m_pApi->setStringListValue(m_hImpl, keyName.pData,
844  pValueList, len);
845  else
846  return RegError::INVALID_KEY;
847  }
848 
849 inline RegError RegistryKey::setUnicodeListValue(const OUString& keyName,
850  sal_Unicode** pValueList,
851  sal_uInt32 len)
852  {
853  if (m_registry.isValid())
854  return m_registry.m_pApi->setUnicodeListValue(m_hImpl, keyName.pData,
855  pValueList, len);
856  else
857  return RegError::INVALID_KEY;
858  }
859 
860 inline RegError RegistryKey::getValueInfo(const OUString& keyName,
861  RegValueType* pValueType,
862  sal_uInt32* pValueSize)
863  {
864  if (m_registry.isValid())
865  return m_registry.m_pApi->getValueInfo(m_hImpl, keyName.pData, pValueType, pValueSize);
866  else
867  return RegError::INVALID_KEY;
868  }
869 
870 inline RegError RegistryKey::getValue(const OUString& keyName,
871  RegValue pValue)
872  {
873  if (m_registry.isValid())
874  return m_registry.m_pApi->getValue(m_hImpl, keyName.pData, pValue);
875  else
876  return RegError::INVALID_KEY;
877  }
878 
879 inline RegError RegistryKey::getLongListValue(const OUString& keyName,
880  RegistryValueList<sal_Int32>& rValueList)
881  {
882  if (m_registry.isValid())
883  {
885  sal_Int32* pValueList;
886  sal_uInt32 length;
887  ret = m_registry.m_pApi->getLongListValue(m_hImpl, keyName.pData,
888  &pValueList, &length);
889  if ( ret != RegError::NO_ERROR)
890  {
891  return ret;
892  } else
893  {
895  pValueList, length);
896  return ret;
897  }
898  } else
899  return RegError::INVALID_KEY;
900  }
901 
902 inline RegError RegistryKey::getStringListValue(const OUString& keyName,
903  RegistryValueList<char*>& rValueList)
904  {
905  if (m_registry.isValid())
906  {
908  char** pValueList;
909  sal_uInt32 length;
910  ret = m_registry.m_pApi->getStringListValue(m_hImpl, keyName.pData,
911  &pValueList, &length);
912  if ( ret != RegError::NO_ERROR )
913  {
914  return ret;
915  } else
916  {
918  pValueList, length);
919  return ret;
920  }
921  } else
922  return RegError::INVALID_KEY;
923  }
924 
925 inline RegError RegistryKey::getUnicodeListValue(const OUString& keyName,
927  {
928  if (m_registry.isValid())
929  {
931  sal_Unicode** pValueList;
932  sal_uInt32 length;
933  ret = m_registry.m_pApi->getUnicodeListValue(m_hImpl, keyName.pData,
934  &pValueList, &length);
935  if ( ret != RegError::NO_ERROR )
936  {
937  return ret;
938  } else
939  {
940  rValueList.setValueList(m_registry, RegValueType::UNICODELIST,
941  pValueList, length);
942  return ret;
943  }
944  } else
945  return RegError::INVALID_KEY;
946  }
947 
948 inline RegError RegistryKey::getResolvedKeyName(const OUString& keyName,
949  OUString& rResolvedName) const
950  {
951  if (m_registry.isValid())
952  return m_registry.m_pApi->getResolvedKeyName(m_hImpl,
953  keyName.pData,
954  true,
955  &rResolvedName.pData);
956  else
957  return RegError::INVALID_KEY;
958  }
959 
961  {
962  if (m_registry.isValid())
963  {
964  return m_registry.getName();
965  } else
966  return OUString();
967  }
968 
969 
972  , m_hImpl(nullptr)
973  { }
974 
975 inline Registry::Registry(const Registry& toCopy)
976  : m_pApi(toCopy.m_pApi)
977  , m_hImpl(toCopy.m_hImpl)
978  {
979  if (m_hImpl)
980  m_pApi->acquire(m_hImpl);
981  }
982 
983 
985  {
986  if (m_hImpl)
987  m_pApi->release(m_hImpl);
988  }
989 
990 inline Registry& Registry::operator = (const Registry& toAssign)
991 {
992  if (toAssign.m_hImpl)
993  toAssign.m_pApi->acquire(toAssign.m_hImpl);
994  if (m_hImpl)
995  m_pApi->release(m_hImpl);
996 
997  m_pApi = toAssign.m_pApi;
998  m_hImpl = toAssign.m_hImpl;
999 
1000  return *this;
1001 }
1002 
1003 inline bool Registry::isValid() const
1004  { return ( m_hImpl != nullptr ); }
1005 
1006 inline bool Registry::isReadOnly() const
1007  { return m_pApi->isReadOnly(m_hImpl); }
1008 
1010  {
1011  rRootKey.setRegistry(*this);
1012  return m_pApi->openRootKey(m_hImpl, &rRootKey.m_hImpl);
1013  }
1014 
1015 inline OUString Registry::getName()
1016  {
1017  OUString sRet;
1018  m_pApi->getName(m_hImpl, &sRet.pData);
1019  return sRet;
1020  }
1021 
1022 inline RegError Registry::create(const OUString& registryName)
1023  {
1024  if (m_hImpl)
1025  m_pApi->release(m_hImpl);
1026  return m_pApi->createRegistry(registryName.pData, &m_hImpl);
1027  }
1028 
1029 inline RegError Registry::open(const OUString& registryName,
1030  RegAccessMode accessMode)
1031  {
1032  if (m_hImpl)
1033  m_pApi->release(m_hImpl);
1034  return m_pApi->openRegistry(registryName.pData, &m_hImpl, accessMode);
1035  }
1036 
1038  {
1039  RegError ret = m_pApi->closeRegistry(m_hImpl);
1040  if (ret == RegError::NO_ERROR)
1041  m_hImpl = nullptr;
1042  return ret;
1043  }
1044 
1045 inline RegError Registry::destroy(const OUString& registryName)
1046  {
1047  RegError ret = m_pApi->destroyRegistry(m_hImpl, registryName.pData);
1048  if ( ret == RegError::NO_ERROR && registryName.isEmpty() )
1049  m_hImpl = nullptr;
1050  return ret;
1051  }
1052 
1054  const OUString& keyName,
1055  const OUString& regFileName,
1056  bool bReport)
1057  { return m_pApi->mergeKey(m_hImpl, rKey.m_hImpl, keyName.pData, regFileName.pData, false/*bWarnings*/, bReport); }
1058 
1059 /* 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:222
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:64
NO_ERROR
no error.
Definition: regtype.h:85
void setKeyNames(Registry const &registry, rtl_uString **pKeyNames, sal_uInt32 length)
sets the data of the array.
Definition: registry.hxx:636
RegError destroy(const OUString &registryName)
destroys a registry.
Definition: registry.hxx:1045
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:693
RegistryKey & operator=(const RegistryKey &toAssign)
Assign operator.
Definition: registry.hxx:680
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:1053
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:725
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:596
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:860
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:838
sal_uInt32 m_length
stores the number of key names, the number of elements.
Definition: registry.hxx:261
rtl_uString sal_Bool
Definition: registry.hxx:64
LONGLIST
The key has a value of type long list.
Definition: regtype.h:64
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:588
OUString getElement(sal_uInt32 index)
returns the name of the key specified by index.
Definition: registry.hxx:622
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:870
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:1037
NOT_DEFINED
The key has no value or the value type is unknown.
Definition: regtype.h:64
Registry m_registry
stores the registry on which this key works
Definition: registry.hxx:570
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:226
Registry m_registry
stores the handle to the registry file where the appropriate keys are located.
Definition: registry.hxx:265
RegKeyHandle m_hImpl
stores the current key handle of this key
Definition: registry.hxx:572
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:761
sal_uInt16 sal_Unicode
rtl_uString ** m_pKeyNames
stores an array of key names.
Definition: registry.hxx:263
Registry()
Default constructor.
Definition: registry.hxx:970
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:704
static sal_Bool REGISTRY_CALLTYPE isReadOnly(RegHandle hReg)
Definition: registry.cxx:84
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:331
Registry & operator=(const Registry &toAssign)
Assign operator.
Definition: registry.hxx:990
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:610
enum SAL_DLLPUBLIC_RTTI RegError
specifies the possible error codes which can occur using the registry API.
Definition: regtype.h:82
RegError setValue(const OUString &keyName, RegValueType valueType, RegValue pValue, sal_uInt32 valueSize)
sets a value of a key.
Definition: registry.hxx:815
RegError open(const OUString &registryName, RegAccessMode accessMode)
opens a registry with the specified name.
Definition: registry.hxx:1029
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:347
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:274
RegError openSubKeys(const OUString &keyName, RegistryKeyArray &rSubKeys)
opens all subkeys of the specified key.
Definition: registry.hxx:739
enum SAL_DLLPUBLIC_RTTI RegValueType
defines the type of a key value.
Definition: regtype.h:61
RegistryKey()
Default constructor.
Definition: registry.hxx:645
OUString getName()
returns the name of the current registry data file.
Definition: registry.hxx:1015
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:827
RegValueType m_valueType
stores the type of the list elements
Definition: registry.hxx:335
static RegError REGISTRY_CALLTYPE destroyRegistry(RegHandle hReg, rtl_uString *registryName)
Definition: registry.cxx:190
RegistryKeyNames represents an array of key names.
Definition: registry.hxx:234
Registry(Registry &&other) noexcept
Definition: registry.hxx:92
~RegistryKey()
Destructor, close the key if it references an open one.
Definition: registry.hxx:674
sal_uInt32 getLength() const
returns the length of the array.
Definition: registry.hxx:631
Registry m_registry
stores the handle to the registry file where the appropriate key to this value is located...
Definition: registry.hxx:339
RegError deleteKey(const OUString &keyName)
deletes the specified key.
Definition: registry.hxx:783
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:948
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:306
ValueType * m_pValueList
stores the value list.
Definition: registry.hxx:333
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:791
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:224
~RegistryKeyArray()
Destructor, all subkeys will be closed.
Definition: registry.hxx:582
INVALID_KEY
the key is not in a valid state.
Definition: regtype.h:85
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:925
void setKeyHandles(Registry const &registry, RegKeyHandle *phKeys, sal_uInt32 length)
sets the data of the key array.
Definition: registry.hxx:601
~Registry()
Destructor. The Destructor close the registry if it is open.
Definition: registry.hxx:984
ValueType
RegError openRootKey(RegistryKey &rRootKey)
opens the root key of the registry.
Definition: registry.hxx:1009
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:696
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:218
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:551
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:321
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:1006
~RegistryKeyNames()
Destructor, the internal array with key names will be deleted.
Definition: registry.hxx:616
RegError getStringListValue(const OUString &keyName, RegistryValueList< char * > &rValueList)
gets an ascii list value of a key.
Definition: registry.hxx:902
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:285
RegError getLongListValue(const OUString &keyName, RegistryValueList< sal_Int32 > &rValueList)
gets a long list value of a key.
Definition: registry.hxx:879
bool isValid() const
checks if the registry points to a valid registry data file.
Definition: registry.hxx:1003
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:294
void(REGISTRY_CALLTYPE *acquire)(RegHandle)
#define REGISTRY_CALLTYPE
specify the calling convention for the registry API
Definition: regtype.h:137
RegError REGISTRY_CALLTYPE getKeyName(RegKeyHandle hKey, rtl_uString **pKeyName)
Definition: regkey.cxx:65
void releaseKey()
releases the current key
Definition: registry.hxx:806
REG_DLLPUBLIC Registry_Api *REGISTRY_CALLTYPE initRegistry_Api()
the API initialization function.
Definition: registry.cxx:290
RegistryValueList()
Default constructor.
Definition: registry.hxx:278
RegError setUnicodeListValue(const OUString &keyName, sal_Unicode **pValueList, sal_uInt32 len)
sets a unicode string list value of a key.
Definition: registry.hxx:849
RegError create(const OUString &registryName)
creates a new registry with the specified name and creates a root key.
Definition: registry.hxx:1022
OUString getRegistryName()
returns the name of the registry in which the key is defined.
Definition: registry.hxx:960
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:712
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:576
RegError REGISTRY_CALLTYPE freeKeyNames(rtl_uString **pKeyNames, sal_uInt32 nKeys)
Definition: regkey.cxx:653