Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.7 KiB

  1. /*---------------------------------------------------------------------------
  2. File: VarData.h
  3. Comments: This class makes up one level of data in the VarSet.
  4. A CVarData consists of a variant value, and a (possibly empty) set of children.
  5. (c) Copyright 1995-1998, Mission Critical Software, Inc., All Rights Reserved
  6. Proprietary and confidential to Mission Critical Software, Inc.
  7. REVISION LOG ENTRY
  8. Revision By: Christy Boles
  9. Revised on 11/19/98 17:29:30
  10. ---------------------------------------------------------------------------
  11. */
  12. #ifndef __CBBVAROBJ_HPP__
  13. #define __CBBVAROBJ_HPP__
  14. #define CVARDATA_CASE_SENSITIVE (0x01)
  15. #define CVARDATA_INDEXED (0x02)
  16. #define CVARDATA_ALLOWREHASH (0x04)
  17. #include <atlbase.h>
  18. class CMapStringToVar;
  19. class CVarData //: public CObject
  20. {
  21. CComAutoCriticalSection m_cs;
  22. CComVariant m_var;
  23. CMapStringToVar * m_children;
  24. BYTE m_options;
  25. public:
  26. // CVarData() : m_children(NULL) {m_options = CVARDATA_CASE_SENSITIVE | CVARDATA_INDEXED | CVARDATA_ALLOWREHASH; };
  27. // Gene Allen 99.04.22 Changed default from Case sensitive to case insensitive
  28. CVarData() : m_children(NULL) {m_options = CVARDATA_INDEXED | CVARDATA_ALLOWREHASH; };
  29. ~CVarData() { RemoveAll(); }
  30. // Variant data functions
  31. CComVariant * GetData() { return &m_var; }
  32. int SetData(CString name,VARIANT * var,BOOL bCoerce, HRESULT * pReturnCode); // returns the number of new items (& subitems) added to the VarSet
  33. // Property settings
  34. BOOL IsCaseSensitive() { return m_options & CVARDATA_CASE_SENSITIVE; }
  35. BOOL IsIndexed() { return m_options & CVARDATA_INDEXED; }
  36. BOOL AllowRehashing() { return m_options & CVARDATA_ALLOWREHASH; }
  37. void SetIndexed(BOOL v);
  38. void SetCaseSensitive(BOOL nVal); // only applies to child items
  39. void SetAllowRehashing(BOOL v); // only applies to child items
  40. // sub-element map functions
  41. BOOL HasChildren();
  42. BOOL HasData() { return m_var.vt != VT_EMPTY; }
  43. CMapStringToVar * GetChildren() { return m_children; }
  44. void RemoveAll(); // deletes all children
  45. BOOL Lookup(LPCTSTR key,CVarData *& rValue);
  46. void SetAt(LPCTSTR key, CVarData * newValue);
  47. long CountItems();
  48. // Stream i/o functions
  49. HRESULT ReadFromStream(LPSTREAM pStr);
  50. HRESULT WriteToStream(LPSTREAM pStr);
  51. DWORD CalculateStreamedLength();
  52. void McLogInternalDiagnostics(CString keyName);
  53. //DECLARE_SERIAL(CVarData)
  54. };
  55. #endif //__CBBVAROBJ_HPP__