1 /* CardElement.h - this file is part of SOPE
3 * Copyright (C) 2006 Inverse groupe conseil
5 * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
7 * This file is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This file is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
26 #import <Foundation/NSObject.h>
30 @class NSMutableArray;
31 @class NSMutableDictionary;
36 @interface CardElement : NSObject <NSCopying>
39 NSMutableArray *values;
40 NSMutableDictionary *attributes;
45 + (id) elementWithTag: (NSString *) aTag;
47 + (id) simpleElementWithTag: (NSString *) aTag
48 value: (NSString *) aValue;
50 + (id) simpleElementWithTag: (NSString *) aTag
51 singleType: (NSString *) aType
52 value: (NSString *) aValue;
54 + (id) elementWithTag: (NSString *) aTag
55 attributes: (NSDictionary *) someAttributes
56 values: (NSArray *) someValues;
58 - (void) setParent: (CardGroup *) aParent;
59 - (CardGroup *) parent;
61 - (void) setTag: (NSString *) aTag;
63 - (void) setGroup: (NSString *) aGroup;
66 - (void) addValue: (NSString *) aValue;
67 - (void) addValues: (NSArray *) someValues;
69 - (void) setValue: (unsigned int) anInt
70 to: (NSString *) aValue;
71 - (NSString *) value: (unsigned int) anInt;
73 - (void) setNamedValue: (NSString *) aValueName
74 to: (NSString *) aValue;
75 - (NSString *) namedValue: (NSString *) aValueName;
77 - (void) setValue: (unsigned int) anInt
78 ofAttribute: (NSString *) anAttribute
79 to: (NSString *) aValue;
80 - (NSString *) value: (unsigned int) anInt
81 ofAttribute: (NSString *) anAttribute;
83 - (void) addAttribute: (NSString *) anAttribute
84 value: (NSString *) aValue;
85 - (void) addAttributes: (NSDictionary *) someAttributes;
86 - (void) removeValue: (NSString *) aValue
87 fromAttribute: (NSString *) anAttribute;
89 - (void) addType: (NSString *) aType;
93 - (NSDictionary *) attributes;
94 - (BOOL) hasAttribute: (NSString *) aType
95 havingValue: (NSString *) aValue;
99 - (NSString *) versitString;
101 - (CardGroup *) searchParentOfClass: (Class) parentClass;
103 - (CardElement *) elementWithClass: (Class) elementClass;
104 - (void) setValuesAsCopy: (NSMutableArray *) someValues;
105 - (void) setAttributesAsCopy: (NSMutableDictionary *) someAttributes;
109 #define IS_EQUAL(a,b,sel) \
110 _iCalSafeCompareObjects (a, b, @selector(sel))
112 static __inline__ BOOL _iCalSafeCompareObjects(id a, id b, SEL comparator)
116 BOOL (*compm)(id, SEL, id);
118 if((!va && vb) || (va && !vb))
122 compm = (BOOL (*)( id, SEL, id)) [va methodForSelector: comparator];
124 return compm(va, comparator, vb);
127 #endif /* CARDELEMENT_H */