-fpermissive to allow GCC to compile old C++
[oweals/cde.git] / cde / programs / dtmail / dtmail / Node.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /*
24  *+SNOTICE
25  *
26  *      $XConsortium: Node.h /main/4 1996/04/21 19:42:44 drk $
27  *
28  *      RESTRICTED CONFIDENTIAL INFORMATION:
29  *      
30  *      The information in this document is subject to special
31  *      restrictions in a confidential disclosure agreement between
32  *      HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
33  *      document outside HP, IBM, Sun, USL, SCO, or Univel without
34  *      Sun's specific written approval.  This document and all copies
35  *      and derivative works thereof must be returned or destroyed at
36  *      Sun's request.
37  *
38  *      Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
39  *
40  *+ENOTICE
41  */
42
43 #ifndef __NODESERVANT_HH
44 #define __NODESERVANT_HH
45
46 #include <sys/types.h>
47
48 #include <Xm/Xm.h>
49 #include <DtMail/DtMail.hh>
50
51 // Nodes are of critical importance to the MailTool architecture 
52 // since all classes rely heavily on Nodes.
53 // It is possible for the client to maintain a list of Nodes for
54 // each Folder that it is interested in.  Each Folder has a list of
55 // Nodes, a Node for each Message the Folder's mailfile contains.
56 // Each Message has a list of Nodes, a Node for each Attachment the 
57 // Message contains. And so on...
58 // Nodes are circular lists and the root node is the only one that
59 // has a "home-p" set to TRUE.  Each Node has a my_previous_node and
60 // a my_next_node which point to the previous and next nodes in the
61 // circular list.  Each Node has data which is of type CORBA::ObjRef.
62 // The data in the Node depends on which level the node exists - 
63 // Nodes maintained by Folders contain Messages, Nodes maintained by
64 // Messages contain Attachments, ...
65 // This implementation of Nodes is abstract enough for *any* CORBA::ObjRef
66 // to be placed in Nodes.  Hence, it can be easily used or adapted-for-use
67 // in any other environment requiring its functionality.
68 // Semantics:
69 //
70 // set_homep()                  :  Set self to be home-node.
71 // is_homep()                   :  Is self home-node?
72 // get_home()                   :  Traverse through hierarchy until 
73 //                                 home-node is reached.
74 // set/get_data()               :  Set or get Node's data.
75 // next(), prev()               :  Go to next (or previous) Node.
76 // append(), prepend()          :  Append or prepend a Node to self.`
77 // remove()                     :  Remove node from list.  
78 // destroy()                    :  Destroy node, its contents and release objrefs.
79
80
81 class Node {
82
83     public:
84                                 Node();  
85                                 Node(
86                                     DtMailMessageHandle msg_num,
87                                     char * str
88                                 );
89
90                                 ~Node();
91
92         void                    set_homep(
93                                 );
94         boolean                 is_home(
95                                 );
96         Node*                   get_home(
97                                 );
98
99         void                    set_message_handle(
100                                         DtMailMessageHandle a_hndl
101                                 );
102     
103     
104         DtMailMessageHandle             get_message_handle(
105                                 );
106     
107         void                    set_message_header(char* hdr);
108         char*                   get_message_header();
109
110         void                    set_number(int i);
111         int                     get_number();
112
113         Node*                   next(
114                                 );
115
116         Node*                   prev(
117                                 );
118
119         void                    set_previous_node(
120                                         Node* anyNode
121                                 );
122         void                    set_next_node(
123                                         Node* anyNode
124                                 );
125
126         void                    append(
127                                         Node* anyNode
128                                 );
129         void                    prepend(
130                                         Node* anyNode
131                                 );
132        
133         void                    remove(
134                                 );
135
136     private:
137     
138         DtMailMessageHandle             my_message_handle;
139         char*                   my_message_header;
140         int                     bogus_number;
141         boolean                 homep;
142         boolean                 deleted_p;
143         Node*                   my_previous_node;
144         Node*                   my_next_node;
145 };
146
147
148 #endif                  //__NODESERVANT_HH
149
150
151
152