2 Copyright (C) 2003-2004 SKYRIX Software AG
4 This file is part of SOPE.
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
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.
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
22 #ifndef __NGRuleEngine_NGRuleParser_H__
23 #define __NGRuleEngine_NGRuleParser_H__
25 #import <Foundation/NSObject.h>
26 #import <Foundation/NSString.h>
31 This class parses NGRule objects. The serialization format is:
33 qualifier => assignment [; priority]
35 The qualifier is either the special '*true*' or a serialized EOQualifier
36 and the assignment is a key/value statement, eg "value=blue".
38 We map some special priority "keys":
49 @class NSException, NSString, NSDictionary;
51 @class NGRule, NGRuleModel;
53 @interface NGRuleParser : NSObject
57 NSException *lastException;
58 NSDictionary *priorityMapping; /* maps strings to ints (eg high => 10) */
59 NSDictionary *boolMapping; /* maps strings to bool (eg false => NO) */
62 + (id)sharedRuleParser;
66 - (NSException *)lastException;
70 - (NGRule *)parseRuleFromPropertyList:(id)_plist;
71 - (NGRule *)parseRuleFromString:(NSString *)_plist;
72 - (NGRuleModel *)parseRuleModelFromPropertyList:(id)_plist;
74 /* parsing of the individual parts */
76 - (EOQualifier *)parseQualifierFromString:(NSString *)_s;
77 - (id)parseActionFromString:(NSString *)_s;
78 - (int)parsePriorityFromString:(NSString *)_s;
80 - (BOOL)splitString:(NSString *)_s
81 intoQualifierString:(NSString **)_qs
82 actionString:(NSString **)_as
83 andPriorityString:(NSString **)_ps;
87 #endif /* __NGRuleEngine_NGRuleParser_H__ */