]> git.saurik.com Git - wxWidgets.git/blob - samples/richedit/wxlparser.h
2.4 -> 2.5; build in another directory than source one; mention --disable-shared
[wxWidgets.git] / samples / richedit / wxlparser.h
1 /*-*- c++ -*-********************************************************
2 * wxlparser.h : parsers, import/export for wxLayoutList *
3 * *
4 * (C) 1998 by Karsten Ballüder (Ballueder@usa.net) *
5 * *
6 * $Id$
7 *******************************************************************/
8 #ifndef WXLPARSER_H
9 # define WXLPARSER_H
10
11 #ifdef __GNUG__
12 # pragma interface "wxlparser.h"
13 #endif
14
15 #ifndef NULL
16 # define NULL 0
17 #endif
18
19 enum wxLayoutExportType
20 {
21 WXLO_EXPORT_TEXT,
22 WXLO_EXPORT_HTML,
23 WXLO_EXPORT_OBJECT,
24 // this can be caused by empty lines:
25 WXLO_EXPORT_EMPTYLINE
26 };
27
28 enum wxLayoutExportMode
29 {
30 WXLO_EXPORT_AS_TEXT = 0x00,
31 WXLO_EXPORT_AS_TEXT_AND_COMMANDS = 0x01,
32 WXLO_EXPORT_AS_HTML = 0x02,
33 WXLO_EXPORT_AS_OBJECTS = 0x03,
34
35 // non 0:
36 WXLO_EXPORT_WITH_CRLF = 0x10,
37 WXLO_EXPORT_WITH_LF_ONLY = 0x20
38 };
39
40 struct wxLayoutExportObject
41 {
42 wxLayoutExportType type;
43 union
44 {
45 wxString *text;
46 wxLayoutObject *object;
47 }content;
48 ~wxLayoutExportObject()
49 {
50 if(type == WXLO_EXPORT_TEXT || type == WXLO_EXPORT_HTML)
51 delete content.text;
52 }
53 };
54
55
56 struct wxLayoutExportStatus
57 {
58 wxLayoutExportStatus(wxLayoutList *list);
59 wxLayoutLine * m_line;
60 wxLOiterator m_iterator;
61 wxLayoutStyleInfo m_si;
62 bool m_FirstTime;
63 };
64
65 #ifdef OS_WIN
66 # define WXLO_DEFAULT_EXPORT_MODE WXLO_EXPORT_WITH_CRLF
67 #else // Unix
68 # define WXLO_DEFAULT_EXPORT_MODE WXLO_EXPORT_WITH_LF_ONLY
69 #endif // Win/Unix
70
71 /// import text into a wxLayoutList (including linefeeds):
72 void wxLayoutImportText(wxLayoutList *list, wxString const &str);
73
74 /// export text in a given format
75 wxLayoutExportObject *wxLayoutExport(wxLayoutExportStatus *status,
76 int mode = WXLO_EXPORT_AS_TEXT,
77 int flags = WXLO_DEFAULT_EXPORT_MODE);
78
79 #endif //WXLPARSER_H