Even more spelling fixed
[oweals/cde.git] / cde / programs / dtmail / dtmail / MsgHndArray.hh
1 /*
2  *+SNOTICE
3  *
4  *      $TOG: MsgHndArray.hh /main/9 1998/09/02 15:54:58 mgreess $
5  *
6  *      RESTRICTED CONFIDENTIAL INFORMATION:
7  *      
8  *      The information in this document is subject to special
9  *      restrictions in a confidential disclosure agreement between
10  *      HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
11  *      document outside HP, IBM, Sun, USL, SCO, or Univel without
12  *      Sun's specific written approval.  This document and all copies
13  *      and derivative works thereof must be returned or destroyed at
14  *      Sun's request.
15  *
16  *      Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
17  *
18  *+ENOTICE
19  */
20
21 #ifndef _MSGHNDARRAY_HH
22 #define _MSGHNDARRAY_HH
23
24 #include <stdlib.h>
25 #include <string.h>
26 #if defined(USL) && (OSMAJORVERSION == 2)
27 extern "C" {
28 #endif
29 #if defined(USL) && (OSMAJORVERSION == 2)
30 };
31 #endif
32 #include <DtMail/DtMail.hh>
33
34 class MsgStruct {
35   public:
36     MsgStruct() : indexNumber(0), sessionNumber(0), message_handle(NULL), is_deleted(false) {};
37     ~MsgStruct() {};
38     
39     int indexNumber;
40     int sessionNumber;
41     DtMailMessageHandle message_handle;
42     Boolean is_deleted;
43 };
44
45 class MsgHndArray {
46   protected:
47     int _size;
48     MsgStruct **_contents;
49     int _length;
50
51   public:
52     MsgHndArray(int sz = 1024, int zeroed = 1)
53       {
54           _contents = (MsgStruct**) malloc(sizeof(MsgStruct*)*sz);
55           _size = sz;
56           if (zeroed) memset(_contents, 0, sizeof(MsgStruct *)*sz);
57
58           _length = 0;
59
60       }
61
62     ~MsgHndArray()
63       {
64 //        for (int ent = 0; ent < _length; ent++) {
65 //            delete _contents[ent];
66 //        }
67
68           free((void*) _contents);
69       }
70
71     int         length();
72     MsgStruct*  at(int a_number);
73     int         insert(MsgStruct* a_msg_struct);
74     void        clear();
75     int         indexof(MsgStruct* a_msg_struct);
76     int         indexof(DtMailMessageHandle a_msg_handle);
77     void        remove_entry(int position);
78     void        remove_entry(MsgStruct *ms);
79     void        append(MsgStruct *a_msg_struct);
80     void        mark_for_delete(int position);
81     void        compact(int start_pos);
82     void        replace(int postition, MsgStruct *a_msg_struct);
83 };
84
85 #endif
86     
87