/usr/include/GNUstep/Renaissance/GSMarkupDecoder.h is in librenaissance0-dev 0.9.0-4build7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | /* -*-objc-*-
GSMarkupDecoder.h
Copyright (C) 2002 Free Software Foundation, Inc.
Author: Nicola Pero <n.pero@mi.flashnet.it>
Date: March 2002
This file is part of GNUstep Renaissance
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _GNUstep_H_GSMarkupDecoder
#define _GNUstep_H_GSMarkupDecoder
#ifndef GNUSTEP
# include <Foundation/Foundation.h>
#else
# include <Foundation/NSObject.h>
#endif
@class NSMutableDictionary;
@class NSString;
@class GSMarkupDecoderBackend;
@class NSMutableArray;
@interface GSMarkupDecoder : NSObject
{
/* The backend parser. */
GSMarkupDecoderBackend *_backend;
/* If we are inside an <objects> section. */
BOOL _isInsideObjects;
/* If we are inside a <connectors> section. */
BOOL _isInsideConnectors;
/* The stack of pending open tags. Each time we find a start tag,
* we add the tag to the stack. We save the attribute dictionary
* and any children tag in the tag object. Each time we find a
* closing tag, we remove the tag from the stack, process it, and
* add the resulting decoded objects to the content of the parent
* tag, or to the objects or connectors arrays if the stack is
* empty. */
NSMutableArray *_stack;
/* The objects which we have decoded. */
NSMutableArray *_objects;
/* The connectors which we have decoded. Connectors are object which
* represent connections between other objects (between the decoded
* objects and other objects in the application as well). */
NSMutableArray *_connectors;
/* The name table which we have decoded, mapping id names to
* objects. This is used because the connectors refer to objects by
* name. This table maps names to objects in the objects array.
* The application might supply additional objects with additional
* names not found in this nameTable - to allow connecting decoded
* objects to/from other objects in the application. */
NSMutableDictionary *_nameTable;
/* A number starting from 0, used when generating internal idNames
* used to connect objects which don't have a name in the file but
* are to be connected using implicit outlets. This number is
* increased by 1 for each generated internal idName, to make sure
* we never generate the same idNames twice. */
int _idNameCount;
/* Instance specific mapping from tag names to classes inside
* <objects>; normally empty, can be modified by calling
* setObjectClassForTagName:.
*/
NSMutableDictionary *_tagNameToObjectClass;
/* Instance specific mapping from tag names to classes inside
* <connectors>; normally empty, can be modified by calling
* setConnectorClassForTagName:.
*/
NSMutableDictionary *_tagNameToConnectorClass;
}
+ (id) decoderWithContentsOfFile: (NSString *)file;
- (id) initWithContentsOfFile: (NSString *)file;
- (id) initWithData: (NSData*)data;
- (void) parse;
/* The SAX-like callbacks. Called by the backend parser when
* stuff is parsed. */
/* Called when a start tag is found. */
- (void) foundStartElement: (NSString*)elementName
withAttributes: (NSDictionary*)elementAttributes;
/* Called when an end tag is found. */
- (void) foundEndElement: (NSString*) elementName;
/* Called when some free text is found. name should have been already
* trimmed (and merged with previous or following strings etc) by the
* backend; name should not be empty (the backend should simply not
* bother us with empty stuff). */
- (void) foundFreeString: (NSString*) name;
/* Methods composing mostly an internal API. */
- (void) error: (NSString *)problem;
- (void) warning: (NSString *)problem;
/* Return the class to be used to decode the tag with name tagName
* found inside the <objects> section. Return Nil if no appropriate
* class is found, in which case the tag is ignored.
*
* The default implementation looks up classes using on the following
* algorithm: Suppose that tagName is 'button'. We first try the
* instance specific mapping table. If nothing is found, we try the
* following classes in the order:
*
* GSMarkupButtonTag
*
* GSMarkupTagButton
*
* GSButtonTag
*
* GSTagButton
*
* ButtonTag
*
* TagButton
*
* Subclass it and override in the subclass to use a different
* algorithm.
*/
- (Class) objectClassForTagName: (NSString *)tagName;
/* Return the class to be used to decode the tag with name tagName
* found inside the <connectors> section. Return Nil if no
* appropriate class is found, in which case the tag is ignored.
* The default implementation looks up classes using the following
* algorithm: we first try the instance specific mapping table. If
* nothing is found, 'action' and 'control' are mapped to
* GSMarkupControlConnector; 'connector' and 'outlet' are mapped to
* GSMarkupOutletConnector.
*
* If still not found, say that the tagName is 'other'. We search the
* following classe:
*
* GSMarkupOtherConnector
*
* GSMarkupConnectorOther
*
* GSOtherConnector
*
* GSConnectorOther
*
* OtherConnector
*
* ConnectorOther
*
* If still not found, we return Nil.
*/
- (Class) connectorClassForTagName: (NSString *)tagName;
/* Hardcode a mapping from tagName --> class for tags found inside
* <objects>. This overrides any other algorithm. */
- (void) setObjectClass: (NSString *)className
forTagName: (NSString *)tagName;
/* Hardcode a mapping from tagName --> class for tags found inside
* <connectors>. This overrides any other algorithm. */
- (void) setConnectorClass: (NSString *)className
forTagName: (NSString *)tagName;
/* To be called at the end of parsing - return the objects array. */
- (NSArray *) objects;
/* To be called at the end of parsing - return the connectors array. */
- (NSArray *) connectors;
/* To be called at the end of parsing - return the name table. */
- (NSDictionary *) nameTable;
@end
#endif /* _GNUstep_H_GSMarkupDecoder */
|