]> err.no Git - sope/blob - sope-xml/STXSaxDriver/ExtraSTX/StructuredText.h
added support for XML-RPC 'nil' type
[sope] / sope-xml / STXSaxDriver / ExtraSTX / StructuredText.h
1 /*
2   Copyright (C) 2004 eXtrapola Srl
3
4   This file is part of SOPE.
5
6   SOPE is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with SOPE; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21
22 #ifndef __StructuredText_H__
23 #define __StructuredText_H__
24
25 #import <Foundation/NSObject.h>
26 #include "StructuredTextDocument.h"
27
28 @class NSString, NSMutableString;
29 @class StructuredLine, StructuredStack;
30 @class StructuredTextHeader, StructuredTextParagraph, StructuredTextList;
31 @class StructuredTextListItem, StructuredTextLiteralBlock;
32
33 #define StructuredTextParserLine_Header       0
34 #define StructuredTextParserLine_Paragraph    1
35 #define StructuredTextParserLine_List         2
36 #define StructuredTextParserLine_LiteralBlock 3
37
38 @interface StructuredText : NSObject
39 {
40   NSString               *_text;
41   StructuredTextDocument *_document;
42   StructuredStack        *_stack;
43
44   StructuredStack        *_paragraphs;
45
46 #if DISABLE_BUG_FIX
47   int                    currentHeaderLevel;
48 #endif
49 }
50
51 + (StructuredTextDocument *)parseText:(NSString *)_txt;
52 - (id)initWithString:(NSString *)_str;
53
54 /* accessors */
55
56 - (NSString *)text;
57 - (StructuredTextDocument *)document;
58 - (StructuredStack *)stack;
59 - (StructuredStack *)paragraphs;
60
61 /* parsing */
62
63 - (void)parse;
64
65 - (int)lineType:(StructuredLine *)_line;
66
67 - (void)separateIntoBlocks;
68 - (void)adjustLineLevels;
69 - (void)buildDocument;
70
71 - (BOOL)checkForHeader:(StructuredLine *)_line;
72 - (BOOL)checkForListItem:(StructuredLine *)_line;
73 - (BOOL)checkForPreformattedStatement:(StructuredLine *)_line;
74 - (BOOL)checkForPreformattedBlock:(StructuredLine *)_line;
75
76 - (StructuredTextHeader *)buildHeader;
77 - (StructuredTextParagraph *)buildParagraph;
78 - (StructuredTextLiteralBlock *)buildLiteralBlock;
79 - (StructuredTextList *)buildList;
80
81 - (int)listItemTypology:(StructuredLine *)_line;
82
83 @end
84
85 #endif /* __StructuredText_H__ */