Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtinfo / dtinfogen / infolib / etc / StyleTask.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 /* $XConsortium: StyleTask.h /main/3 1996/08/21 15:47:29 drk $ */
24 /* $XConsortium: StyleTask.h /main/3 1996/08/21 15:47:29 drk $ */
25
26 #ifndef __StyleTasks_h
27 #define __StyleTasks_h
28
29 #include "Task.h"
30 #include "FlexBuffer.h"
31 #include "dti_cc/CC_String.h"
32 #include "dti_cc/cc_hdict.h"
33 #include "dti_cc/CC_Stack.h"
34
35 class BookCaseTask;
36 class DataTask;
37 class DB;
38 class DBTable;
39 class FlexBuffer;
40 class OL_Data;
41
42 class imp_die;
43
44 class StyleTask : public ComplexTask{
45
46 public:
47
48   StyleTask();
49   ~StyleTask();
50
51   /*
52    * USE:
53    *   StyleTask t;
54    *      t.markup(...); ... t.data(...); ...
55    *      const char *l = t.locator();
56    */
57   const char * locator() /* throw(Unexpected) */;
58
59   void reset(void);
60
61   void markup(const Token&);
62
63   void data(const char *, size_t );
64
65   int exist( const char * view ); /*
66                                    * Given a view determine if it exists? 
67                                    */
68
69   /*
70    * USE:
71    *   StyleTask st(...);
72    *       st.markup(...); st.data(...); ... // feed stylesheet to the task
73    *       const char *p = st.print();
74    *       const char *o = st.online();
75    */
76   const char *print();
77   int         print_data_size();
78
79   const char *online();
80   int         online_data_size();
81
82 protected:
83   void write_record( void );
84
85       /* comments below to avoid compiler warnings... */
86   virtual void done(const char * /*name*/,
87                     const char * /*online*/, int /*online_len*/,
88                     const char * /*print*/, int /*print_len*/)  {};
89
90 private:
91   int
92      f_base;                  /* tag nesting level of <STYLESHEET> elt */
93   int f_select;
94
95   enum { inPath, startContent, inContent } f_dataMode;
96
97   FlexBuffer
98      *f_buffer,
99      *f_pathbuf,
100      *onlineSS,
101      *printSS;                 /*
102                                 * The style sheet data proper.
103                                 * Need to determine if it gets transformed
104                                 * or not.
105                                 */
106   OL_Data
107      *f_locator;
108
109   hashTable<CC_String,int>
110      *viewset;                         /*
111                                 * List of views,
112                                 * Must be a unique set of names.
113                                 */
114   Stack<int> *feature_depth;
115
116 };
117
118
119 class StyleTaskDB : public StyleTask{
120
121 public:
122
123   StyleTaskDB(BookCaseTask *);
124
125   BookCaseTask *bookcase() { return f_bookcase; };
126
127 protected:
128   virtual void done(const char * name,
129                     const char * online, int online_len,
130                     const char * print, int print_len);
131
132 private:
133   BookCaseTask
134      *f_bookcase;    /* 'parent' bookcase object */
135
136 };
137
138
139 #endif /* __StyleTasks_h */
140