home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / visbuild / rapsheet / cppwv23 / iarrest.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-09  |  8.9 KB  |  179 lines

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