home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / IBMCLASS / IBASE.HPP < prev    next >
C/C++ Source or Header  |  1993-10-22  |  12KB  |  253 lines

  1. #ifndef _IBASE_
  2. #define _IBASE_
  3. /*******************************************************************************
  4. * FILE NAME: ibase.hpp                                                         *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     IBase - Empty "base" class to reduce global name space pollution         *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   Licensed Materials - Property of IBM                                       *
  12. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  13. *   All Rights Reserved                                                        *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  16. *                                                                              *
  17. *******************************************************************************/
  18. #ifndef _IEXCBASE_
  19.   #include <iexcbase.hpp>
  20. #endif
  21.  
  22. /*----------------------------------------------------------------------------*/
  23. /* Align classes on four byte boundary.                                       */
  24. /*----------------------------------------------------------------------------*/
  25. #pragma pack(4)
  26.  
  27. class ostream;
  28.  
  29. class IString;
  30.  
  31.  
  32. class IBase {
  33. /*******************************************************************************
  34. *  The IBase class encapsulates the set of names that otherwise would be       *
  35. *  in global scope.  All other classes in the library inherit from this class. *
  36. *  Thus the types and enumeration values defined here can be used in those     *
  37. *  classes without the qualifying IBase:: prefix.                              *
  38. *                                                                              *
  39. *  Other code, not within the scope of IBase, must use either the qualified    *
  40. *  names or the simplified synonyms declared in ISYNONYM.HPP.                  *
  41. *******************************************************************************/
  42. public:
  43.  
  44. /*------------------------------ Related Types ---------------------------------
  45. | This class declares a global Boolean type and enumeration, both of which     |
  46. | are used throughout the library:                                             |
  47. |                                                                              |
  48. |   Boolean           - General true or false type used as an argument or      |
  49. |                       return value for many member functions.                |
  50. |   BooleanConstants  - Enumeration that defines constant values for false     |
  51. |                       and true.  Never test for equality to be true,         |
  52. |                       because any non-zero value should be considered true.  |
  53. |                       This constant provides a useful mnemonic for setting   |
  54. |                       a Boolean.                                             |
  55. ------------------------------------------------------------------------------*/
  56. typedef int
  57.   Boolean;
  58.  
  59. enum BooleanConstants {
  60.   false = 0,
  61.   true  = 1
  62. };
  63.  
  64. /*------------------------------- Message File ---------------------------------
  65. | The following functions provide access to the message file used to hold      |
  66. | exception text used by the class library for throwing exceptions:            |
  67. |   messageFile    - Returns the name of the message file used to load         |
  68. |                    library exception text.  If setMessageFile has been       |
  69. |                    called with the name of a message file, its name will be  |
  70. |                    returned.  Otherwise, the environment variable            |
  71. |                    "ICLUI MSGFILE" is checked for the name of a message      |
  72. |                    file which is returned.  Set the environment variable     |
  73. |                    using "SET ICLUI MSGFILE=mymsgfile.msg".  (The file       |
  74. |                    extension, typically msg, must be specified.)  Finally,   |
  75. |                    if the environment variable has not been set, the default |
  76. |                    message file DDE4UILE.MSG will be used.                   |
  77. |   setMessageFile - Sets the message file from which the class library        |
  78. |                    exception text is loaded.  The name must include the      |
  79. |                    file extension.                                           |
  80. |   messageText    - Returns the message text associated with the message ID   |
  81. |                    specified.  Up to nine optional text strings can be       |
  82. |                    passed in to be inserted in the message.  The message     |
  83. |                    will be loaded from program if it is found in a message   |
  84. |                    segment that has been bound to the .EXE.  Otherwise it is |
  85. |                    searched for in the current message file described above. |
  86. |                    The search for this file is as follows:                   |
  87. |                          - The system root directory.                        |
  88. |                          - The current working directory.                    |
  89. |                          - Using the DPATH environment setting.              |
  90. |                          - Using the APPEND environment setting.             |
  91. ------------------------------------------------------------------------------*/
  92. static char
  93.  *messageFile ( );
  94.  
  95. static void
  96.   setMessageFile ( const char *msgFileName );
  97.  
  98. static IMessageText
  99.   messageText ( unsigned long messageId,
  100.                 const char*   textInsert1 = 0,
  101.                 const char*   textInsert2 = 0,
  102.                 const char*   textInsert3 = 0,
  103.                 const char*   textInsert4 = 0,
  104.                 const char*   textInsert5 = 0,
  105.                 const char*   textInsert6 = 0,
  106.                 const char*   textInsert7 = 0,
  107.                 const char*   textInsert8 = 0,
  108.                 const char*   textInsert9 = 0 );
  109.  
  110. /*------------------------------- Diagnostics ----------------------------------
  111. | Use the following functions to provide diagnostic information:               |
  112. |                                                                              |
  113. |   operator << - Permits any library object to be dumped to an ostream,       |
  114. |                 such as cout << anObject;.                                   |
  115. |                 Note: IBase cannot provide any useful information about      |
  116. |                       the object, so this function should be overridden in   |
  117. |                       all subclasses.                                        |
  118. |   asString    - Obtains the standard version of an object's contents.        |
  119. |   asDebugInfo - Obtains the diagnostic version of an object's contents.      |
  120. |   Version     - Structure (data type) that defines the version specifier     |
  121. |                 (comprised of major and minor version numbers).              |
  122. |   version     - Static function that returns the library version.            |
  123. ------------------------------------------------------------------------------*/
  124. friend ostream
  125.  &operator << ( ostream     &aStream,
  126.                 const IBase &anObject );
  127.  
  128. IString
  129.   asString    ( ) const,
  130.   asDebugInfo ( ) const;
  131.  
  132. struct Version {
  133. unsigned short
  134.   major,
  135.   minor;
  136. };
  137.  
  138. static Version
  139.   version ( );
  140.  
  141. protected:
  142. /*------------------------------ Implementation --------------------------------
  143. | These data members are provided as synonyms for the IException::Severity     |
  144. | enumeration which is used when constructing an instance of IException or     |
  145. | one of its subclasses:                                                       |
  146. |    unrecoverable -  Synonym for IException::unrecoverable.                   |
  147. |    recoverable   -  Synonym for IException::recoverable.                     |
  148. ------------------------------------------------------------------------------*/
  149. static IException::Severity
  150.   unrecoverable,
  151.   recoverable;
  152.  
  153. private: /*------------------------ PRIVATE ----------------------------------*/
  154. static char
  155.  *msgFile;
  156.  
  157. }; // IBase
  158.  
  159. /*------------------------------ Version Levels --------------------------------
  160. | IC_MAJOR_VERSION - Defines the major version level of the library which is   |
  161. |                    used by IBase::version().  It is incremented by 1 for     |
  162. |                    each new release, and by 100 for each new version.  It    |
  163. |                    can also be used by client applications to conditionally  |
  164. |                    compile their code.                                       |
  165. | IC_MINOR_VERSION - Defines the minor version level of the library which is   |
  166. |                    used by IBase::version().  It starts at 0 for each major  |
  167. |                    version level and is incremented by 1 for each CSD.  It   |
  168. |                    can also be used by client applications to conditionally  |
  169. |                    compile their code.                                       |
  170. ------------------------------------------------------------------------------*/
  171. #define IC_MAJOR_VERSION 201
  172. #define IC_MINOR_VERSION 0
  173.  
  174.  
  175.  
  176. /*-------------------------- Static Object Priority ----------------------------
  177. | IBASE_PRIORITY - Defines the base "static object construction priority"      |
  178. |                  for the library.                                            |
  179. |                  Classes that have static objects that                       |
  180. |                  require construction must define a comparable value,        |
  181. |                  such as IWINDOW_PRIORITY.                                   |
  182. |                  The value must be greater than the priority value           |
  183. |                  of all classes whose static objects                         |
  184. |                  must be constructed first.                                  |
  185. ------------------------------------------------------------------------------*/
  186. #define IBASE_PRIORITY -2147483647 - 1 + 1024
  187.  
  188. #ifdef __BORLANDC__
  189.   #define _System  _syscall
  190.   #define _Optlink _fastcall
  191. #endif
  192.  
  193. #ifdef __ZTC__
  194.   #define _System  pascal far
  195.   #define _Optlink
  196. #endif
  197.  
  198. #ifdef __xlC__
  199.   #define _System
  200.   #define _Optlink
  201. #endif
  202.  
  203. extern "C" {
  204.  
  205. typedef void * _System
  206.   IWinProc ( unsigned long, unsigned long, void *, void * );
  207.  
  208. }
  209.  
  210. #ifndef IC_RUNTIME
  211.   #define IC_RUNTIME
  212. #endif
  213.  
  214. #define IC_TRACE_RUNTIME
  215.  
  216. #ifdef IC_DEVELOP
  217.   #define IC_TRACE_DEVELOP
  218. #endif
  219.  
  220. #ifdef IC_TRACE_ALL
  221.   #define IC_TRACE_DEVELOP
  222. #endif
  223.  
  224. #define IC_UM_BASE            ( 0xFFE0 )
  225. #define IC_UM_DRAGDROP_RENDER ( IC_UM_BASE + 1 )
  226. #define IC_UM_CANVAS_SETFOCUS ( IC_UM_BASE + 2 )
  227. #define IC_UM_CANVAS_PAINT    ( IC_UM_BASE + 3 )
  228.  
  229. #define IContainerObject           ICnrObj
  230. #define IContainerControl          ICnrCtl
  231. #define IDDEClientAcknowledgeEvent IDDECAckEvt
  232. #define IDDEServerAcknowledgeEvent IDDESAckEvt
  233. #define IDDEServerConversation     IDDESConv
  234. #define IDDEServerHotLink          IDDESHotLnk
  235. #define IDDEServerHotLinkItem      IDDESHLItem
  236. #define IDDEActiveServer           IDDEActServ
  237. #define IDDEClientHotLinkEvent     IDDECHLEvt
  238. #define IDDEClosedConversation     IDDEClsConv
  239. #define IRowColumnCanvas           IRCCv
  240. #define AlignmentTag               Tag
  241. #define RowColumn                  RCol
  242.  
  243. /*----------------------------------------------------------------------------*/
  244. /* Resume compiler default packing.                                           */
  245. /*----------------------------------------------------------------------------*/
  246. #pragma pack()
  247.  
  248. #ifndef _ISYNONYM_
  249.   #include <isynonym.hpp>
  250. #endif
  251.  
  252. #endif /* _IBASE_ */
  253.