home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1996 November / VPR9611B.ISO / vabasic / ntclnt.exe / DISK8 / data.8 / datab / INCLUDE / PROPVAL.HH < prev    next >
Text File  |  1996-07-29  |  3KB  |  96 lines

  1. //------------------------------------------------------------------------
  2. // $Source: /rcs/crcs/framework/propval.hh,v $
  3. // Checked in by: $Author: cc $
  4. // $Date: 1995/11/11 00:02:30 $             $Revision: 1.5 $
  5. //------------------------------------------------------------------------
  6. //       Copyright(c) 1993, Visual Edge Software Ltd.
  7. //
  8. // ALL RIGHTS RESERVED. This notice is intended as a precaution
  9. // against inadvertent publication, and shall not be deemed to
  10. // constitute an acknowledgment that publication has occurred
  11. // nor to imply any waiver of confidentiality. The year included
  12. // in the notice is the year of the creation of the work.
  13. //------------------------------------------------------------------------
  14. // DESCRIPTION:     Class VePropertyList and VePropValuePair
  15. //------------------------------------------------------------------------
  16.  
  17. #ifndef PROPVAL_HH
  18. #define PROPVAL_HH
  19.  
  20. #include <visedge.hh>
  21. #include <dllclass.hh>
  22. #include <vstring.hh>
  23. #include <srctext.hh>
  24.  
  25. VCLASS VePropValuePair;
  26.  
  27. #ifdef NOTEMPLATES
  28. #    ifndef VPropValuePairListDefined
  29. #        define VPropValuePairListDefined
  30. #        define CLASSNAME VePropValuePairList
  31. #        define ENTRYTYPE VePropValuePair *
  32. #        include <mst/varray.mst>
  33. #    endif
  34. #else
  35. #    include <varray.hh>
  36.     typedef VeArray<VePropValuePair *>      VePropValuePairList;
  37. #endif
  38.  
  39. //------------------------------------------------------------------
  40. // Class VePropertyList maintains a list of VPropValuePairs.
  41. // VePropertyList is reference counted.
  42. //------------------------------------------------------------------
  43.  
  44. VCLASS VePropertyList : public VeDllBasedClass
  45. {
  46. public:
  47.     VOPERDECL VePropertyList();
  48.     VOPERDECL VePropertyList(VePropValuePair);
  49.     VOPERDECL VePropertyList(const VePropertyList &);
  50.  
  51.     VOPERDECL ~VePropertyList();
  52.  
  53.     VMETHODDECL(VePropValuePair &) operator[](unsigned int i);
  54.     VMETHODDECL(VePropertyList&) operator= (const VePropertyList &other);
  55.     VMETHODDECL(unsigned int) Count() const;
  56.     VMETHODDECL(VePropValuePair) AddLast(VePropValuePair);
  57.  
  58. private:
  59.     //-----------------------------------------------------
  60.     // The actual data is shared as often as possible.
  61.     //-----------------------------------------------------
  62.     struct ObjectData {
  63.         unsigned int           refcount;
  64.         VePropValuePairList    propvals;
  65.     
  66.     } * itsRep; 
  67. };
  68.  
  69. //-------------------------------------------------------------------
  70. // Class VePropValuePair keeps a property-value pair.
  71. //------------------------------------------------------------------
  72.  
  73. VCLASS VePropValuePair : public VeDllBasedClass
  74. {
  75. public:
  76.     VOPERDECL VePropValuePair(const char *name, VeSourceText val);
  77.     VOPERDECL VePropValuePair(const VePropValuePair &propval);
  78.     VOPERDECL VePropValuePair();
  79.     VOPERDECL ~VePropValuePair();
  80.  
  81.     VMETHODDECL(VePropValuePair &) operator=(const VePropValuePair &);
  82.  
  83.     VMETHODDECL(const char *) Name() const;
  84.  
  85.     VMETHODDECL(VeSourceText) Value() const; 
  86.  
  87. private:
  88.     struct ObjectData {
  89.         unsigned int refcount;
  90.         VeString    name;
  91.         VeSourceText  value;
  92.     } *itsRep;
  93. };
  94.  
  95. #endif //PROPVAL_HH
  96.