home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / cppbeta / ibmcli / idrgstr.hp_ / IDRGSTR.HPP
Encoding:
C/C++ Source or Header  |  1992-10-26  |  8.2 KB  |  189 lines

  1. #ifndef _IDRGSTR_
  2.   #define _IDRGSTR_
  3. /*--------------------------------------------------------------*/
  4. /* CLASS NAMES:   ITypesString                                  */
  5. /*                IRMFsString                                   */
  6. /*                                                              */
  7. /* DESCRIPTION  : These are Types and RMFs wrap ups.            */
  8. /*                Created to avoid using the incomplete         */
  9. /*                Drg*() APIs for manipulation and verification */
  10. /*                of Types and RMFs                             */
  11. /*                                                              */
  12. /* CHANGE ACTIVITY:                                             */
  13. /* ---------------                                              */
  14. /*   DATE:     INITIAL:       DESCRIPTION:                      */
  15. /* 09/14/92    PHG            Creation                          */
  16. /*                                                              */
  17. /*--------------------------------------------------------------*/
  18. /* Copyright (c) IBM Corporation 1991                           */
  19. /*--------------------------------------------------------------*/
  20. // include ICLUI string support
  21. #ifndef _ISTRING_
  22.   #include <IString.hpp>
  23. #endif
  24.  
  25. #ifndef _IHANDLE_
  26.   #include <IHandle.hpp>
  27. #endif
  28.  
  29. class ITypesString : public IBase {
  30. /**************************************************************************
  31. * This class provides means to manipulate Drag&Drop types strings, which  *
  32. * are strings of one ore more types separated by comas                    *
  33. **************************************************************************/
  34. public:
  35. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------+
  36. | There are 3 ways to construct instances of this class:                  |
  37. |   1. From a string pointer which holds types                            |
  38. |   2. From an IString which holds types                                  |
  39. |   3. From a string handle, which can come from a dragitem               |
  40. +------------------------------------------------------------------------*/
  41.   ITypesString(const char* pszTypes);
  42.   ITypesString(const IString& strTypes);
  43.   ITypesString(const IStringHandle& strhTypes);
  44.  
  45. /*-------------------------------- ACCESSORS -----------------------------+
  46. | These function provide means of getting and setting the accessible      |
  47. | attributes of instances of this class:                                  |
  48. |  count   - returns the count of types in the string                     |
  49. |  type    - returns the nth type in the list (1-based)                   |
  50. |  trueType - returns the true type (first type in the list)              |
  51. |  verifyTrueType - to verify if given type is the True type              |
  52. |  verifyTrueType - return the 1-based index of the true type             |
  53. |                   within the argument string                            |
  54. |  verifyType     - return the 1-based index of the first matching type   |
  55. +------------------------------------------------------------------------*/
  56. unsigned
  57.   count() const;
  58.  
  59. IString
  60.   type(unsigned uIndex) const;
  61.  
  62. IString
  63.   trueType() const;
  64.  
  65.     // verify the True type
  66. Boolean
  67.   verifyTrueType(const char* pszType) const;
  68.  
  69. unsigned
  70.   verifyTrueType(const ITypesString& strTypes) const,
  71.   verifyType(const ITypesString& strTypes) const;
  72.  
  73. /*------------------------- OPERATORS/CONVERTORS -------------------------+
  74. |  operator IString() - convert to a string                               |         |
  75. |  asString           - return a string                                   |
  76. |  operator+=         - concatenate a string                              |
  77. |  asStringHandle     - return as a string handle                         |
  78. +------------------------------------------------------------------------*/
  79.   operator IString() const;
  80. IString
  81.   asString() const;
  82.  
  83. ITypesString&
  84.   operator+=(const IString& strIn);
  85.  
  86. IStringHandle
  87.   asStringHandle() const;
  88.  
  89.  
  90. private:
  91. /*--------------------------- PRIVATE FUNCTIONS --------------------------+
  92. |  normalize - used to put string in normal from, i.e. without blanks     |
  93. +------------------------------------------------------------------------*/
  94. static IString
  95.   normalize(const IString& strIn);
  96.  
  97. /*------------------------------ DATA MEMBERS ----------------------------+
  98. |  strClTypes - types string                                              |
  99. +------------------------------------------------------------------------*/
  100.   IString strClTypes;
  101. }; // ITypesString
  102.  
  103.  
  104. class IRMFsString : public IBase {
  105. /**************************************************************************
  106. * This class provides means to manipulate Drag&Drop Rendering Mechanism   *
  107. * and Format strings, which are expanded to the normal format of pair     *
  108. * separated by comas:                                                     *
  109. *  <M1,F2>,<M3,F4>                                                        *
  110. * Input strings can also be in the cross-product format                   *
  111. *  <M1,M2>x<F4,F5>                                                        *
  112. **************************************************************************/
  113. public:
  114. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------+
  115. | There are 4 ways to construct instances of this class:                  |
  116. |   1. From a non-normalized string pointer                               |
  117. |   2. From a non-normalized IString instance                             |
  118. |   3. From a single pair of Mechanism and Format                         |
  119. |   4. From a string handle as passed in D&D events                       |
  120. +------------------------------------------------------------------------*/
  121.   IRMFsString(const char* pszRMFs);
  122.   IRMFsString(const IString& strRMFs);
  123.   IRMFsString(const char* pszMechanism, const char* pszFormat);
  124.   IRMFsString(const IStringHandle& strhRMFs);
  125.  
  126. /*-------------------------------- ACCESSORS -----------------------------+
  127. | These function provide means of getting and setting the accessible      |
  128. | attributes of instances of this class:                                  |
  129. |  count   - returns the count of RMFs in the string                      |
  130. |  RMF     - returns the nth RMF in the list (1-based)                    |
  131. |  nativeRMF - returns the native RMF (first RMF in the list)             |
  132. |  verifyNativeRMF - to verify if given RMF is the native RMF             |
  133. |  verifyNativeRMF - return the 1-based index of the native RMF           |
  134. |                    within the argument string                           |
  135. |  verifyRMF       - return the 1-based index of the first matching RMF   |
  136. +------------------------------------------------------------------------*/
  137. unsigned
  138.   count() const;
  139.  
  140. IString
  141.   RMF(unsigned uIndex) const;
  142.  
  143. IString
  144.   nativeRMF() const;
  145.  
  146. Boolean
  147.   verifyNativeRMF(const char* pszRMF) const;
  148.  
  149. unsigned
  150.   verifyNativeRMF(const IRMFsString& strRMFs) const;
  151.  
  152. unsigned
  153.   verifyRMF(const IRMFsString& strRMFs) const;
  154.  
  155.  
  156. /*------------------------- OPERATORS/CONVERTORS -------------------------+
  157. |  operator IString() - convert to a string                               |         |
  158. |  asString           - return a string                                   |
  159. |  operator+=         - concatenate a string                              |
  160. |  asStringHandle     - return as a string handle                         |
  161. +------------------------------------------------------------------------*/
  162. operator IString() const;
  163.  
  164. IString
  165.   asString() const;
  166.  
  167. IRMFsString&
  168.   operator+=(const IString& strIn);
  169.  
  170. IStringHandle
  171.   asStringHandle() const;
  172.  
  173.  
  174. private:
  175. /*--------------------------- PRIVATE FUNCTIONS --------------------------+
  176. |  normalize - used to put string in normal from, i.e. without blanks     |
  177. +------------------------------------------------------------------------*/
  178. static IString
  179.   normalize(const IString& strIn);
  180.  
  181. /*------------------------------ DATA MEMBERS ----------------------------+
  182. |  strClRMFs - RMFs string                                                |
  183. +------------------------------------------------------------------------*/
  184.   IString strClRMFs;
  185.  
  186. }; // IRMFsString
  187.  
  188. #endif /* def _IDRGSTR_ */
  189.