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.

179 lines
4.6 KiB

  1. /********************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright(c) Microsoft Corp., 1990,1991 **/
  4. /********************************************************************/
  5. /*
  6. newprofi.hxx
  7. Internal details of INI-file handling primitives
  8. The internal include file contains stuff which needs to go before the
  9. class definition of INI_FILE_IMAGE, but which clients of this class
  10. don't need to know about.
  11. FILE HISTORY
  12. jonn 30-May-1991 Created
  13. */
  14. #ifndef _NEWPROFI_HXX_
  15. #define _NEWPROFI_HXX_
  16. #include <slist.hxx>
  17. /*************************************************************************
  18. NAME: PARAMETER
  19. SYNOPSIS: Stores an image of a parameter in an INI file, including
  20. parameter name and parameter value. The PARAMETER class
  21. has the property that, as long as the constructor
  22. succeeds (QueryError() == NERR_Success), no subsequent
  23. method can make the object invalid (short of freeing its
  24. pointers etc.) If any Set or SetParamValue operation fails,
  25. the object snaps back to its original state.
  26. INTERFACE: PARAMETER() - Constructs a parameter.
  27. ~PARAMETER() - Destructs a parameter.
  28. SetParamValue() - Changes the value of the parameter.
  29. Set() - Changes the name and value of the parameter.
  30. QueryParamName()- Asks after the parameter name.
  31. QueryParamValue()- Asks after the parameter value.
  32. PARENT: BASE
  33. CAVEATS: This class is meant to be used internally by
  34. INI_FILE_IMAGE and is not for direct use by the client.
  35. HISTORY:
  36. jonn 30-May-1991 Created
  37. *************************************************************************/
  38. DLL_CLASS PARAMETER: public BASE
  39. {
  40. private:
  41. PSZ _pchParamName;
  42. PSZ _pchParamValue;
  43. public:
  44. // The constructor makes a copy of these strings. Errors are recorded
  45. // in BASE.
  46. PARAMETER(
  47. CPSZ pchParamName,
  48. CPSZ pchParamValue
  49. );
  50. ~PARAMETER();
  51. /*
  52. * error codes:
  53. * ERROR_NOT_ENOUGH_MEMORY
  54. */
  55. APIERR SetParamValue( CPSZ pchParamValue );
  56. APIERR Set( CPSZ pchParamName, CPSZ pchParamValue );
  57. CPSZ QueryParamName() const { return _pchParamName; }
  58. CPSZ QueryParamValue() const { return _pchParamValue; }
  59. };
  60. /*************************************************************************
  61. NAME: COMPONENT
  62. SYNOPSIS: Stores an image of a component in an INI file, including
  63. component name and parameter list. The COMPONENT class
  64. has the property that, as long as the constructor
  65. succeeds (QueryError() == NERR_Success), no subsequent
  66. method can make the object invalid (short of freeing its
  67. pointers etc.) If any AppendParam or RemoveParam operation
  68. fails, the object snaps back to its original state.
  69. INTERFACE: COMPONENT() - Constructs a component.
  70. ~COMPONENT() - Destructs a component.
  71. AppendParam() - Adds a parameter to the component.
  72. RemoveParam() - Removes a parameter from the component.
  73. QueryCompName() - Asks after the name of the component.
  74. PARENT: BASE
  75. CAVEATS: This class is meant to be used internally by
  76. INI_FILE_IMAGE and is not for direct use by the client.
  77. HISTORY:
  78. jonn 30-May-1991 Created
  79. *************************************************************************/
  80. DECLARE_SLIST_OF(PARAMETER)
  81. DLL_CLASS ITER_OF_PARAM;
  82. DLL_CLASS COMPONENT: public BASE
  83. {
  84. friend ITER_OF_PARAM;
  85. private:
  86. PSZ _pchCompName;
  87. SLIST_OF(PARAMETER) _slparam;
  88. public:
  89. COMPONENT( CPSZ pchCompName ); // as PARAMETER
  90. ~COMPONENT();
  91. PARAMETER * FindParameter( CPSZ pchParamName ) const;
  92. APIERR AppendParam( const PARAMETER * pparameter );
  93. PARAMETER * RemoveParam( PARAMETER * pparameter );
  94. CPSZ QueryCompName() const { return _pchCompName; }
  95. };
  96. DECLARE_SLIST_OF(COMPONENT)
  97. /*************************************************************************
  98. NAME: ITER_OF_PARAM
  99. SYNOPSIS: ITER_OF_PARAM iterates through the parameter list in a
  100. component. It is a thin shell over SL_ITER.
  101. INTERFACE: ITER_OF_PARAM() - Constructs an iterator.
  102. ~ITER_OF_PARAM()- Destructs an iterator.
  103. PARENT: ITER_SL
  104. CAVEATS: This class is meant to be used internally by
  105. INI_FILE_IMAGE and is not for direct use by the client.
  106. HISTORY:
  107. jonn 30-May-1991 Created
  108. *************************************************************************/
  109. DLL_CLASS ITER_OF_PARAM : public ITER_SL_OF(PARAMETER)
  110. {
  111. public:
  112. ITER_OF_PARAM::ITER_OF_PARAM( const COMPONENT& component )
  113. : ITER_SL_OF(PARAMETER) (component._slparam)
  114. {}
  115. };
  116. #endif // _NEWPROFI_HXX_ - end of file