home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / h / vd2 / system / registry.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-14  |  2.7 KB  |  85 lines

  1. //    VirtualDub - Video processing and capture application
  2. //    System library component
  3. //    Copyright (C) 1998-2004 Avery Lee, All Rights Reserved.
  4. //
  5. //    Beginning with 1.6.0, the VirtualDub system library is licensed
  6. //    differently than the remainder of VirtualDub.  This particular file is
  7. //    thus licensed as follows (the "zlib" license):
  8. //
  9. //    This software is provided 'as-is', without any express or implied
  10. //    warranty.  In no event will the authors be held liable for any
  11. //    damages arising from the use of this software.
  12. //
  13. //    Permission is granted to anyone to use this software for any purpose,
  14. //    including commercial applications, and to alter it and redistribute it
  15. //    freely, subject to the following restrictions:
  16. //
  17. //    1.    The origin of this software must not be misrepresented; you must
  18. //        not claim that you wrote the original software. If you use this
  19. //        software in a product, an acknowledgment in the product
  20. //        documentation would be appreciated but is not required.
  21. //    2.    Altered source versions must be plainly marked as such, and must
  22. //        not be misrepresented as being the original software.
  23. //    3.    This notice may not be removed or altered from any source
  24. //        distribution.
  25.  
  26. #ifndef f_VD2_SYSTEM_REGISTRY_H
  27. #define f_VD2_SYSTEM_REGISTRY_H
  28.  
  29. #include <vd2/system/VDString.h>
  30.  
  31. class VDRegistryKey {
  32. private:
  33.     void *pHandle;
  34.  
  35. public:
  36.     VDRegistryKey(const char *pszKey, bool global = false, bool write = true);
  37.     ~VDRegistryKey();
  38.  
  39.     void *getRawHandle() const { return pHandle; }
  40.  
  41.     bool isReady() const { return pHandle != 0; }
  42.  
  43.     bool setBool(const char *pszName, bool) const;
  44.     bool setInt(const char *pszName, int) const;
  45.     bool setString(const char *pszName, const char *pszString) const;
  46.     bool setString(const char *pszName, const wchar_t *pszString) const;
  47.     bool setBinary(const char *pszName, const char *data, int len) const;
  48.  
  49.     bool getBool(const char *pszName, bool def=false) const;
  50.     int getInt(const char *pszName, int def=0) const;
  51.     int getEnumInt(const char *pszName, int maxVal, int def=0) const;
  52.     bool getString(const char *pszName, VDStringA& s) const;
  53.     bool getString(const char *pszName, VDStringW& s) const;
  54.  
  55.     int getBinaryLength(const char *pszName) const;
  56.     bool getBinary(const char *pszName, char *buf, int maxlen) const;
  57.  
  58.     bool removeValue(const char *);
  59. };
  60.  
  61. class VDRegistryValueIterator {
  62. public:
  63.     VDRegistryValueIterator(const VDRegistryKey& key);
  64.  
  65.     const char *Next();
  66.  
  67. protected:
  68.     void *mpHandle;
  69.     uint32 mIndex;
  70.     char mName[256];
  71. };
  72.  
  73. class VDRegistryAppKey : public VDRegistryKey {
  74. private:
  75.     static VDString s_appbase;
  76.  
  77. public:
  78.     VDRegistryAppKey();
  79.     VDRegistryAppKey(const char *pszKey, bool write = true);
  80.  
  81.     static void setDefaultKey(const char *pszAppName);
  82. };
  83.  
  84. #endif
  85.