home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / smarts / ole / wizclass.ct < prev    next >
Encoding:
Text File  |  1996-02-21  |  4.8 KB  |  186 lines

  1. --------------------------------------------------------------------------------
  2. -- FILE NAME: WIZCLASS.CT
  3. --
  4. -- DESCRIPTION:
  5. --   OLE Compound Document Framework class file template
  6. --
  7. -- COPYRIGHT:
  8. --   IBM Open Class Library
  9. --   (C) Copyright International Business Machines Corporation 1992, 1996
  10. --   Licensed Material - Program-Property of IBM - All Rights Reserved.
  11. --   US Government Users Restricted Rights - Use, duplication, or disclosure
  12. --   restricted by GSA ADP Schedule Contract with IBM Corp.
  13. --
  14. --------------------------------------------------------------------------------
  15. <include wizfile.ct>
  16. <define NULL>\</define>
  17. --------------------------------------------------------------------------------
  18. -- Basic class template
  19. --------------------------------------------------------------------------------
  20. <code CLASS>
  21. <define FILE_SRC_CLASSES>
  22. //----------------------------------------------------------------------
  23. //  $CLASS_NAME$ Methods
  24. //----------------------------------------------------------------------
  25. $CLASS_MACROS$\<>
  26. $CLASS_MEMBERS$
  27. $STATIONERY_DEF$
  28. </define>
  29. <clear CLASS_NAME>
  30. <clear CLASS_MACROS>
  31. <clear CLASS_MEMBERS>
  32. <clear CLASS_MEMBERS_NOT_OLE>
  33. <clear CLASS_MEMBERS_OLE>
  34. <clear CLASS_SUPERS>
  35. <clear STATIONERY_DEF>
  36. </code CLASS>
  37.  
  38. -------------------------------------------------------------------------------
  39. -- Standard operations template
  40. --------------------------------------------------------------------------------
  41. --
  42. -- options: 
  43. --    ASSIGNMENT        - if defined include operator=
  44. --    CONSTRUCT_ASSERT  - if defined default and copy ctors assert(false)
  45. --    NO_DEF_CONSTRUCT  - if defined no default ctors
  46. --
  47. <code STANDARD_OPERATIONS>
  48. <define CLASS_MEMBERS>
  49. <if ((!$NO_DEF_CONSTRUCT$) | ($NO_DEF_CONSTRUCT$ == f) )>
  50. $CLASS_NAME$::$CLASS_NAME$()
  51. -- \<>
  52. <if ($DEFAULT_INIT$)>: \<>
  53. </if>
  54. <repeat DEFAULT_INIT separate ,>
  55. $DEFAULT_INIT$
  56. </repeat>
  57. {
  58. <if ($CONSTRUCT_ASSERT$)>
  59.     // default ctor not used
  60.     assert(false);
  61. </if>
  62. }
  63. </if NO_DEF_CONSTRUCT>
  64.  
  65. <if ((!$NO_COPY_CONSTRUCT$) | ($NO_COPY_CONSTRUCT$ == f) )>
  66. $CLASS_NAME$::$CLASS_NAME$( const $CLASS_NAME$ © )
  67. <if ($COPY_INIT$)>: \<>
  68. </if>
  69. <repeat COPY_INIT separate ,>
  70. $COPY_INIT$
  71. </repeat>
  72. {
  73. <if ($CONSTRUCT_ASSERT$)>
  74.     // copy ctor not used
  75.     assert(false);
  76. </if>
  77. }
  78. </if NO_COPY_CONSTRUCT>
  79.  
  80. $CLASS_NAME$::~$CLASS_NAME$()
  81. {
  82. $FINALIZE$\<>
  83. }
  84.  
  85. <if ($ASSIGNMENT$)>
  86. $CLASS_NAME$&
  87. $CLASS_NAME$::operator=( const $CLASS_NAME$& copy )
  88. {
  89. <repeat CLASS_SUPERS>
  90.     $CLASS_SUPERS$::operator=( copy );
  91. </repeat>
  92. $ASSIGN$\<>
  93. }
  94.  
  95. <clear ASSIGNMENT>
  96. </if>
  97. </define CLASS_MEMBERS>
  98. <clear NO_DEF_CONSTRUCT>
  99. <clear NO_COPY_CONSTRUCT>
  100. <clear CONSTRUCT_ASSERT>
  101. <clear DEFAULT_INIT>
  102. <clear COPY_INIT>
  103. <clear ASSIGN>
  104. <clear FINALIZE>
  105. </code STANDARD_OPERATIONS>
  106.  
  107. -------------------------------------------------------------------------------
  108. -- Extended type template
  109. --------------------------------------------------------------------------------
  110. <code TYPE_EXTENSION>
  111. -- public macros
  112. <if ((!$CLASS_MACROS$) | ($CLASS_MACROS$ == $NULL$))>
  113. <define CLASS_MACROS>
  114. TypeExtensionMacro($CLASS_NAME$)
  115.  
  116. </define>
  117. </if>
  118. $STANDARD_OPERATIONS$\<>
  119. </code TYPE_EXTENSION>
  120.  
  121. -------------------------------------------------------------------------------
  122. -- Streaming operators template
  123. --------------------------------------------------------------------------------
  124. <code STREAMING>
  125. $TYPE_EXTENSION$\<>
  126. <define CLASS_MEMBERS_OLE>
  127. IBaseStream&
  128. $CLASS_NAME$::operator>>=( IBaseStream& toWhere ) const
  129. {
  130.     writeVersion( toWhere );
  131. <repeat CLASS_SUPERS>
  132.     $CLASS_SUPERS$::operator>>=( toWhere );
  133. </repeat>
  134. $STREAM_OUT$\<>
  135.     return toWhere;
  136. }
  137.  
  138. IBaseStream&
  139. $CLASS_NAME$::operator<<=( IBaseStream& fromWhere )
  140. {
  141.     switch ( readVersion( fromWhere ) ) {
  142.     case kOriginalVersion:
  143. <repeat CLASS_SUPERS>
  144.         $CLASS_SUPERS$::operator<<=( fromWhere );
  145. </repeat>
  146. $STREAM_IN$\<>
  147.         break;
  148.     default:
  149.         ITHROWLIBRARYERROR(IC_STREAM_VERSION_UNSUPPORTED, 
  150.                            IBaseErrorInfo::invalidRequest,
  151.                            IException::recoverable);
  152.     }
  153.     return fromWhere;
  154. }
  155.  
  156. </define CLASS_MEMBERS_OLE>
  157. -- 
  158. <define CLASS_MEMBERS>
  159. --<if (!$GEN_OLE$)>
  160. --$CLASS_MEMBERS_NOT_OLE$\<>
  161. --<else>
  162. $CLASS_MEMBERS_OLE$\<>
  163. --</if>
  164. </define CLASS_MEMBERS>
  165. <clear STREAM_IN>
  166. <clear STREAM_OUT>
  167. </code STREAMING>
  168.  
  169. --------------------------------------------------------------------------------
  170. -- default definitions
  171. --------------------------------------------------------------------------------
  172. <code CLASS_MACROS>
  173. </code>
  174. <code CLASS_MEMBERS>
  175. </code>
  176. <code ASSIGN>
  177. </code>
  178. <code STREAM_IN>
  179. </code>
  180. <code STREAM_OUT>
  181. </code>
  182. <code STATIONERY_DEF>
  183. </code>
  184. <code FINALIZE>
  185. </code>
  186.