1 | /**************************************************************************
|
---|
2 | *
|
---|
3 | * TextEl.h -- Data structures for parsed documents
|
---|
4 | * Copyright (C) 1999 Rodger McNab
|
---|
5 | *
|
---|
6 | * This program is free software; you can redistribute it and/or modify
|
---|
7 | * it under the terms of the GNU General Public License as published by
|
---|
8 | * the Free Software Foundation; either version 2 of the License, or
|
---|
9 | * (at your option) any later version.
|
---|
10 | *
|
---|
11 | * This program is distributed in the hope that it will be useful,
|
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | * GNU General Public License for more details.
|
---|
15 | *
|
---|
16 | * You should have received a copy of the GNU General Public License
|
---|
17 | * along with this program; if not, write to the Free Software
|
---|
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
19 | *
|
---|
20 | * $Id: TextEl.h 855 2000-01-14 02:17:52Z sjboddie $
|
---|
21 | *
|
---|
22 | **************************************************************************/
|
---|
23 |
|
---|
24 | #ifndef TEXTEL_H
|
---|
25 | #define TEXTEL_H
|
---|
26 |
|
---|
27 | #include "UCArray.h"
|
---|
28 | #include "FileBuf.h"
|
---|
29 |
|
---|
30 |
|
---|
31 | enum TextElType {OpenTagE, CloseTagE, TextE};
|
---|
32 |
|
---|
33 | class TextEl {
|
---|
34 | protected:
|
---|
35 | bool ReadTextTag (FileBuf &buf, TextEl &el);
|
---|
36 | public:
|
---|
37 | TextElType elType;
|
---|
38 | UCArray tagName;
|
---|
39 | UCArray text; // complete text, including tag
|
---|
40 |
|
---|
41 | TextEl () { Clear (); }
|
---|
42 | void Clear ();
|
---|
43 | };
|
---|
44 |
|
---|
45 |
|
---|
46 | typedef vector<TextEl> TextElArray;
|
---|
47 |
|
---|
48 |
|
---|
49 | // compatMode parses documents similar to "old mg" -- ie with
|
---|
50 | // C-b between documents and C-c between paragraphs
|
---|
51 |
|
---|
52 | // returns true if a text element could be read
|
---|
53 | bool ReadTextEl (FileBuf &buf, TextEl &el,
|
---|
54 | bool compatMode, bool &compatInPara);
|
---|
55 |
|
---|
56 | // looks for an opening docTag and reads all text elements up
|
---|
57 | // to a corresponding closing docTag. note that this does not
|
---|
58 | // hierarchically parse the document so you can't nest documents.
|
---|
59 | // returns true if a document could be found
|
---|
60 | bool ReadDoc (FileBuf &buf, const UCArray &docTag,
|
---|
61 | TextElArray &doc, unsigned long &docLen,
|
---|
62 | bool compatMode=false);
|
---|
63 |
|
---|
64 | #endif
|
---|