]> err.no Git - sope/blob - sope-core/NGExtensions/NGExtensions/NGRule.h
NGLogEventFormatter.h was marked as project, not public - fixed
[sope] / sope-core / NGExtensions / NGExtensions / NGRule.h
1 /*
2   Copyright (C) 2000-2003 SKYRIX Software AG
3
4   This file is part of OGo
5
6   OGo 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   OGo 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 OGo; 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 // $Id$
22
23 #ifndef __NGRuleEngine_NGRule_H__
24 #define __NGRuleEngine_NGRule_H__
25
26 #import <Foundation/NSObject.h>
27
28 /*
29   NGRule
30
31   This class represents a rule inside the rule-model. A rule conceptually has:
32   - a qualifier - aka lhs (the condition which must be true for the rule)
33   - an action   - aka rhs (the "thing" which is performed when the rule is
34                            triggered)
35   - a priority  - to select a rule if multiple ones match
36   
37   String Representation:
38     qualifer => action [; priority]
39     *true*   => action
40   
41   Example:
42     "(request.isXmlRpcRequest = YES) => dispatcher = XmlRpc ;0"
43 */
44
45 @class EOQualifier;
46
47 @interface NGRule : NSObject
48 {
49   EOQualifier *qualifier;
50   id          action;
51   int         priority;
52 }
53
54 + (id)ruleWithQualifier:(EOQualifier *)_q action:(id)_action priority:(int)_p;
55 + (id)ruleWithQualifier:(EOQualifier *)_q action:(id)_action;
56 - (id)initWithQualifier:(EOQualifier *)_q action:(id)_action priority:(int)_p;
57
58 - (id)initWithPropertyList:(id)_plist;
59 - (id)initWithString:(NSString *)_s;
60
61 /* accessors */
62
63 - (void)setQualifier:(EOQualifier *)_q;
64 - (EOQualifier *)qualifier;
65
66 - (void)setAction:(id)_action;
67 - (id)action;
68
69 - (void)setPriority:(int)_pri;
70 - (int)priority;
71
72 /* operations */
73
74 - (BOOL)isCandidateForKey:(NSString *)_key;
75 - (id)fireInContext:(id)_ctx;
76
77 /* representations */
78
79 - (NSString *)stringValue;
80
81 @end
82
83 @interface NSObject(RuleAction)
84 - (id)fireInContext:(id)_ctx;
85 @end
86
87 #endif /* __NGRuleEngine_NGRule_H__ */