home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / VISBUILD / RAPSHEET / CPPOV23 / IARREST.HPP < prev    next >
Text File  |  1995-05-14  |  8KB  |  172 lines

  1. #ifndef _IARREST_
  2. #define _IARREST_
  3. //****************************************************************************
  4. // IArrest Class - C++ Header File (iarrest.hpp)                             *
  5. //                                                                           *
  6. // COPYRIGHT: Copyright (C) International Business Machines Corp., 1994,1995 *
  7. //                                                                           *
  8. // DISCLAIMER OF WARRANTIES:                                                 *
  9. //   The following [enclosed] code is sample code created by IBM             *
  10. //   Corporation.  This sample code is not part of any standard IBM product  *
  11. //   and is provided to you solely for the purpose of assisting you in the   *
  12. //   development of your applications.  The code is provided "AS IS",        *
  13. //   without warranty of any kind.  IBM shall not be liable for any damages  *
  14. //   arising out of your use of the sample code, even if they have been      *
  15. //   advised of the possibility of such damages.                             *
  16. //****************************************************************************
  17. //NOTE: WE RECOMMEND USING A FIXED-SPACE FONT TO LOOK AT THE SOURCE.
  18. //
  19.  
  20. #include <istdntfy.hpp>               //Parent of IArrest
  21. #include <istring.hpp>
  22.  
  23. /*----------------------------------------------------------------------------*/
  24. /* Align classes on four byte boundary.                                       */
  25. /*----------------------------------------------------------------------------*/
  26. #pragma pack(4)
  27.  
  28. //**************************************************************************
  29. // Class:   IArrest
  30. //
  31. // Purpose: Describes IArrest Class.
  32. //   This class defines Arrest objects for use in applications such as the 
  33. //      Police Rap Sheet.
  34. //   These objects hold and manage all the data relevant to an arrest.
  35. //
  36. //**************************************************************************
  37. class _Export IArrest : public IStandardNotifier
  38. {
  39.  
  40. public:
  41.  
  42.  
  43. /*---------------------  CONSTRUCTORS/DESTRUCTORS  ----------------
  44.  *-----------------------------------------------------------------*/
  45. IArrest  ();
  46. virtual  ~IArrest ();
  47.  
  48. /*---------------------  ENUMERATED TYPES  ------------------------
  49.  *-----------------------------------------------------------------*/
  50. /*------------------------------------------------------------------
  51.  | WARNING:  Add new types to the end of the list.
  52.  *-----------------------------------------------------------------*/
  53. enum ICharge {arson,                            // 0
  54.               accomplice_to_murder,             // 1
  55.               assault,                          // 2
  56.               assault_w_deadly_weapon,          // 3
  57.               breaking_and_entering,            // 4
  58.               burglary,                         // 5
  59.               DWI,                              // 6
  60.               embezzlement,                     // 7
  61.               fraud,                            // 8
  62.               hijacking,                        // 9
  63.               hit_and_run,                      // 10
  64.               kidnapping,                       // 11
  65.               manslaughter,                     // 12
  66.               murder,                           // 13
  67.               perjury,                          // 14
  68.               trespassing,                      // 15
  69.               vandalism,                        // 16
  70.               wreckless_driving};               // 17
  71.  
  72. /*------------------------------------------------------------------
  73.  | WARNING:  Add new types to the end of the list.
  74.  *-----------------------------------------------------------------*/
  75. enum IStatus {acquitted,                        // 0
  76.               arrested,                         // 1
  77.               arraigned,                        // 2
  78.               convicted,                        // 3
  79.               dropped,                          // 4
  80.               escaped,                          // 5
  81.               free_on_bond,                     // 6
  82.               released,                         // 7
  83.               released_on_parole,               // 8
  84.               under_suspicion,                  // 9
  85.               wanted};                          // 10
  86.  
  87. /*---------------------  NOTIFICATION EVENTS  ----------------------
  88.  | These INotificationId strings are used for all notifications that 
  89.  | this class provides to its observers:
  90.  |     -chargeId           Notification identifier provided to
  91.  |                         observers when the charge attribute changes.
  92.  |     -statusId           Notification identifier provided to
  93.  |                         observers when the status attribute changes.
  94.  |     -statusDateId       Notification identifier provided to
  95.  |                         observers when the statusDate attribute changes.
  96.  |     -reportId           Notification identifier provided to
  97.  |                         observers when the report attribute changes.
  98.  *-----------------------------------------------------------------*/
  99. static INotificationId chargeId;
  100. static INotificationId statusId;
  101. static INotificationId statusDateId;
  102. static INotificationId reportId;
  103.  
  104.  
  105. virtual IString asDebugInfo() const;
  106.  
  107.  
  108. /*---------------------  ATTRIBUTES  -------------------------------
  109.  | The following members are for accessing the attributes of this class:
  110.  |     -charge                Returns the charge attribute.
  111.  |     -status                Returns the status attribute.
  112.  |     -statusDate            Returns the statusDate attribute.
  113.  |     -report                Returns the arrest report
  114.  |     -chargeAsString        Returns the string value associated with the charge numeric value
  115.  |     -statusAsString        Returns the string value associated with the status numeric value
  116.  |     -setCharge             Sets the charge attribute.
  117.  |     -setStatus             Sets the status attribute.
  118.  |     -setReport             Sets the report
  119.  |     -setStatusDate         Sets the statusDate attribute.
  120.  |     -setChargeFromString   Returns the string value associated with the charge numeric value
  121.  |     -setStatusFromString   Returns the string value associated with the status numeric value
  122.  *-----------------------------------------------------------------*/
  123. virtual unsigned short charge () const;
  124. virtual unsigned short status () const;
  125. virtual IString        statusDate () const;
  126. virtual IString        report () const;
  127. virtual IArrest&       setCharge (const unsigned short iCharge);
  128. virtual IArrest&       setStatus (const unsigned short iStatus);
  129. virtual IArrest&       setStatusDate (const IString & aStatusDate);
  130. virtual IArrest&       setReport (const IString & aReport);
  131. virtual IString        chargeAsString() const;
  132. virtual IArrest&       setChargeFromString(const IString & aCharge);
  133. virtual IString        statusAsString() const;
  134. virtual IArrest&       setStatusFromString(const IString & aStatus);
  135.  
  136.  
  137.  
  138. /*---------------------  ACTIONS   --------------------------------- 
  139.  | asString    Formatted string for listbox and debugging output.
  140.  *-----------------------------------------------------------------*/
  141. virtual IString asString () const;
  142.  
  143.  
  144. /*---------------------  OPERATORS   -------------------------------
  145.  *-----------------------------------------------------------------*/
  146. IArrest & operator= (const IArrest & anArrest);
  147.  
  148. Boolean
  149.   operator == (const IArrest & value) const,
  150.   operator != (const IArrest & value) const,
  151.   operator == (const IArrest * value) const,
  152.   operator != (const IArrest * value) const;
  153.  
  154. protected:
  155.  
  156. private:
  157. /*---------------------  PRIVATE MEMBER DATA  ---------------------
  158.  *-----------------------------------------------------------------*/
  159.   unsigned short dCharge;       // The charge made when arrested.
  160.   unsigned short dStatus;       // The current status of the arrest.
  161.   IString dStatusDate;          // The date the arrest status was last changed.
  162.   IString dReport;              // The arrest report
  163.  
  164. };
  165.  
  166. /*----------------------------------------------------------------------------*/
  167. /* Resume compiler default packing.                                           */
  168. /*----------------------------------------------------------------------------*/
  169. #pragma pack()
  170.  
  171. #endif
  172.