2 Copyright (C) 2000-2005 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 #include "WOXMLMappingProperty.h"
25 @implementation WOXMLMappingProperty
27 - (id)initWithEntity:(WOXMLMappingEntity *)_entity {
28 self->entity = _entity;
34 RELEASE(self->xmlTag);
35 RELEASE(self->codeBasedOn);
36 RELEASE(self->outputTags);
43 if ([self->name length] == 0)
45 if ([self->xmlTag length] == 0)
50 - (WOXMLMappingEntity *)entity {
56 - (void)setName:(NSString *)_name {
57 ASSIGN(self->name, _name);
63 - (void)setXmlTag:(NSString *)_xmlTag {
64 ASSIGN(self->xmlTag, _xmlTag);
66 - (NSString *)xmlTag {
70 - (void)setCodeBasedOn:(NSString *)_codeBasedOn {
71 ASSIGN(self->codeBasedOn, _codeBasedOn);
73 - (NSString *)codeBasedOn {
74 return self->codeBasedOn;
77 - (void)setOutputTags:(NSString *)_tags {
78 ASSIGN(self->outputTags, _tags);
80 - (NSString *)outputTags {
81 return self->outputTags;
84 - (void)setAttribute:(BOOL)_flag {
85 self->attribute = _flag;
88 return self->attribute;
91 - (void)setForceList:(BOOL)_flag {
92 self->forceList = _flag;
95 return self->forceList;
98 - (void)setReportEmptyValues:(BOOL)_flag {
99 self->reportEmptyValues = _flag;
101 - (BOOL)reportEmptyValues {
102 return self->reportEmptyValues;
105 /* XML representation */
107 - (NSString *)xmlStringValue {
110 s = [NSMutableString stringWithCapacity:100];
111 [s appendString:@"<property"];
112 [s appendString:@" name='"];
113 [s appendString:[self name]];
114 [s appendString:@"' xmlTag='"];
115 [s appendString:[self xmlTag]];
116 [s appendString:@"'"];
118 if ([self reportEmptyValues])
119 [s appendString:@" reportEmptyValues='YES'"];
120 if ([self forceList])
121 [s appendString:@" forceList='YES'"];
122 if ([self attribute])
123 [s appendString:@" attribute='YES'"];
125 [s appendString:@"/>\n"];
131 - (NSString *)description {
134 s = [NSMutableString stringWithCapacity:100];
135 [s appendFormat:@"<%@ 0x%08X:", NSStringFromClass([self class]), self];
138 [s appendFormat:@" name=%@", [self name]];
140 [s appendFormat:@" tag=%@", [self xmlTag]];
141 if ([self codeBasedOn])
142 [s appendFormat:@" codeBasedOn=%@", [self codeBasedOn]];
143 if ([self outputTags])
144 [s appendFormat:@" out-tags=%@", [self outputTags]];
146 if ([self attribute])
147 [s appendString:@" attribute"];
148 if ([self forceList])
149 [s appendString:@" forceList"];
150 if ([self reportEmptyValues])
151 [s appendString:@" reportEmptyValues"];
153 [s appendString:@">"];
157 @end /* WOXMLMappingProperty */