2 Copyright (C) 2000-2004 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
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
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.
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
23 #include "WOXMLMappingProperty.h"
26 @implementation WOXMLMappingProperty
28 - (id)initWithEntity:(WOXMLMappingEntity *)_entity {
29 self->entity = _entity;
35 RELEASE(self->xmlTag);
36 RELEASE(self->codeBasedOn);
37 RELEASE(self->outputTags);
44 if ([self->name length] == 0)
46 if ([self->xmlTag length] == 0)
51 - (WOXMLMappingEntity *)entity {
57 - (void)setName:(NSString *)_name {
58 ASSIGN(self->name, _name);
64 - (void)setXmlTag:(NSString *)_xmlTag {
65 ASSIGN(self->xmlTag, _xmlTag);
67 - (NSString *)xmlTag {
71 - (void)setCodeBasedOn:(NSString *)_codeBasedOn {
72 ASSIGN(self->codeBasedOn, _codeBasedOn);
74 - (NSString *)codeBasedOn {
75 return self->codeBasedOn;
78 - (void)setOutputTags:(NSString *)_tags {
79 ASSIGN(self->outputTags, _tags);
81 - (NSString *)outputTags {
82 return self->outputTags;
85 - (void)setAttribute:(BOOL)_flag {
86 self->attribute = _flag;
89 return self->attribute;
92 - (void)setForceList:(BOOL)_flag {
93 self->forceList = _flag;
96 return self->forceList;
99 - (void)setReportEmptyValues:(BOOL)_flag {
100 self->reportEmptyValues = _flag;
102 - (BOOL)reportEmptyValues {
103 return self->reportEmptyValues;
106 /* XML representation */
108 - (NSString *)xmlStringValue {
111 s = [NSMutableString stringWithCapacity:100];
112 [s appendString:@"<property"];
113 [s appendString:@" name='"];
114 [s appendString:[self name]];
115 [s appendString:@"' xmlTag='"];
116 [s appendString:[self xmlTag]];
117 [s appendString:@"'"];
119 if ([self reportEmptyValues])
120 [s appendString:@" reportEmptyValues='YES'"];
121 if ([self forceList])
122 [s appendString:@" forceList='YES'"];
123 if ([self attribute])
124 [s appendString:@" attribute='YES'"];
126 [s appendString:@"/>\n"];
132 - (NSString *)description {
135 s = [NSMutableString stringWithCapacity:100];
136 [s appendFormat:@"<%@ 0x%08X:", NSStringFromClass([self class]), self];
139 [s appendFormat:@" name=%@", [self name]];
141 [s appendFormat:@" tag=%@", [self xmlTag]];
142 if ([self codeBasedOn])
143 [s appendFormat:@" codeBasedOn=%@", [self codeBasedOn]];
144 if ([self outputTags])
145 [s appendFormat:@" out-tags=%@", [self outputTags]];
147 if ([self attribute])
148 [s appendString:@" attribute"];
149 if ([self forceList])
150 [s appendString:@" forceList"];
151 if ([self reportEmptyValues])
152 [s appendString:@" reportEmptyValues"];
154 [s appendString:@">"];
158 @end /* WOXMLMappingProperty */