[2674] | 1 | /* |
---|
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
---|
| 3 | * contributor license agreements. See the NOTICE file distributed with |
---|
| 4 | * this work for additional information regarding copyright ownership. |
---|
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
| 6 | * (the "License"); you may not use this file except in compliance with |
---|
| 7 | * the License. You may obtain a copy of the License at |
---|
| 8 | * |
---|
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 10 | * |
---|
| 11 | * Unless required by applicable law or agreed to in writing, software |
---|
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 14 | * See the License for the specific language governing permissions and |
---|
| 15 | * limitations under the License. |
---|
| 16 | */ |
---|
| 17 | |
---|
| 18 | /* |
---|
| 19 | * $Id: XMLAttDef.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | #if !defined(ATTDEF_HPP) |
---|
| 23 | #define ATTDEF_HPP |
---|
| 24 | |
---|
| 25 | #include <xercesc/util/PlatformUtils.hpp> |
---|
| 26 | #include <xercesc/util/XMLString.hpp> |
---|
| 27 | #include <xercesc/util/XMemory.hpp> |
---|
| 28 | #include <xercesc/internal/XSerializable.hpp> |
---|
| 29 | |
---|
| 30 | XERCES_CPP_NAMESPACE_BEGIN |
---|
| 31 | |
---|
| 32 | class XMLAttr; |
---|
| 33 | |
---|
| 34 | /** Represents the core information of an atribute definition |
---|
| 35 | * |
---|
| 36 | * This class defines the basic characteristics of an attribute, no matter |
---|
| 37 | * what type of validator is used. If a particular schema associates more |
---|
| 38 | * information with an attribute it will create a derivative of this class. |
---|
| 39 | * So this class provides an abstract way to get basic information on |
---|
| 40 | * attributes from any type of validator. |
---|
| 41 | * |
---|
| 42 | * This class supports keyed collection semantics on the fully qualified |
---|
| 43 | * attribute name, by providing a getKey() method to extract the key string. |
---|
| 44 | * getKey(), in this case, just calls the virtual method getFullName() to |
---|
| 45 | * get the fully qualified name, as defined by the derived class. |
---|
| 46 | * |
---|
| 47 | * Note that the 'value' of an attribute type definition is the default or |
---|
| 48 | * of fixed value given to it in its definition. If the attribute is of the |
---|
| 49 | * enumerated or notation type, it will have an 'enumeration value' as well |
---|
| 50 | * which is a space separated list of its possible vlaues. |
---|
| 51 | */ |
---|
| 52 | class XMLPARSER_EXPORT XMLAttDef : public XSerializable, public XMemory |
---|
| 53 | { |
---|
| 54 | public: |
---|
| 55 | // ----------------------------------------------------------------------- |
---|
| 56 | // Class specific types |
---|
| 57 | // |
---|
| 58 | // AttTypes |
---|
| 59 | // The list of possible types that an attribute can have, according |
---|
| 60 | // to the XML 1.0 spec and schema. |
---|
| 61 | // |
---|
| 62 | // DefAttTypes |
---|
| 63 | // The modifiers that an attribute decl can have, which indicates |
---|
| 64 | // whether instances of that attributes are required, implied, etc.. |
---|
| 65 | // |
---|
| 66 | // CreateReasons |
---|
| 67 | // This type is used to store how an attribute declaration got into |
---|
| 68 | // the elementdecl's attribute pool. |
---|
| 69 | // |
---|
| 70 | // ----------------------------------------------------------------------- |
---|
| 71 | enum AttTypes |
---|
| 72 | { |
---|
| 73 | CData = 0 |
---|
| 74 | , ID = 1 |
---|
| 75 | , IDRef = 2 |
---|
| 76 | , IDRefs = 3 |
---|
| 77 | , Entity = 4 |
---|
| 78 | , Entities = 5 |
---|
| 79 | , NmToken = 6 |
---|
| 80 | , NmTokens = 7 |
---|
| 81 | , Notation = 8 |
---|
| 82 | , Enumeration = 9 |
---|
| 83 | , Simple = 10 |
---|
| 84 | , Any_Any = 11 |
---|
| 85 | , Any_Other = 12 |
---|
| 86 | , Any_List = 13 |
---|
| 87 | |
---|
| 88 | , AttTypes_Count |
---|
| 89 | , AttTypes_Min = 0 |
---|
| 90 | , AttTypes_Max = 13 |
---|
| 91 | , AttTypes_Unknown = -1 |
---|
| 92 | }; |
---|
| 93 | |
---|
| 94 | enum DefAttTypes |
---|
| 95 | { |
---|
| 96 | Default = 0 |
---|
| 97 | , Fixed = 1 |
---|
| 98 | , Required = 2 |
---|
| 99 | , Required_And_Fixed = 3 |
---|
| 100 | , Implied = 4 |
---|
| 101 | , ProcessContents_Skip = 5 |
---|
| 102 | , ProcessContents_Lax = 6 |
---|
| 103 | , ProcessContents_Strict = 7 |
---|
| 104 | , Prohibited = 8 |
---|
| 105 | |
---|
| 106 | , DefAttTypes_Count |
---|
| 107 | , DefAttTypes_Min = 0 |
---|
| 108 | , DefAttTypes_Max = 8 |
---|
| 109 | , DefAttTypes_Unknown = -1 |
---|
| 110 | }; |
---|
| 111 | |
---|
| 112 | enum CreateReasons |
---|
| 113 | { |
---|
| 114 | NoReason |
---|
| 115 | , JustFaultIn |
---|
| 116 | }; |
---|
| 117 | |
---|
| 118 | // ----------------------------------------------------------------------- |
---|
| 119 | // Public static data members |
---|
| 120 | // ----------------------------------------------------------------------- |
---|
| 121 | static const unsigned int fgInvalidAttrId; |
---|
| 122 | |
---|
| 123 | |
---|
| 124 | // ----------------------------------------------------------------------- |
---|
| 125 | // Public, static methods |
---|
| 126 | // ----------------------------------------------------------------------- |
---|
| 127 | |
---|
| 128 | /** @name Public, static methods */ |
---|
| 129 | //@{ |
---|
| 130 | |
---|
| 131 | /** Get a string representation of the passed attribute type enum |
---|
| 132 | * |
---|
| 133 | * This method allows you to get a textual representation of an attriubte |
---|
| 134 | * type, mostly for debug or display. |
---|
| 135 | * |
---|
| 136 | * @param attrType The attribute type value to get the string for. |
---|
| 137 | * @param manager The MemoryManager to use to allocate objects |
---|
| 138 | * @return A const pointer to the static string that holds the text |
---|
| 139 | * description of the passed type. |
---|
| 140 | */ |
---|
| 141 | static const XMLCh* getAttTypeString(const AttTypes attrType |
---|
| 142 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
---|
| 143 | |
---|
| 144 | /** Get a string representation of the passed def attribute type enum |
---|
| 145 | * |
---|
| 146 | * This method allows you to get a textual representation of an default |
---|
| 147 | * attributetype, mostly for debug or display. |
---|
| 148 | * |
---|
| 149 | * @param attrType The default attribute type value to get the string for. |
---|
| 150 | * @param manager The MemoryManager to use to allocate objects |
---|
| 151 | * @return A const pointer to the static string that holds the text |
---|
| 152 | * description of the passed default type. |
---|
| 153 | */ |
---|
| 154 | static const XMLCh* getDefAttTypeString(const DefAttTypes attrType |
---|
| 155 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
---|
| 156 | |
---|
| 157 | //@} |
---|
| 158 | |
---|
| 159 | |
---|
| 160 | // ----------------------------------------------------------------------- |
---|
| 161 | // Destructor |
---|
| 162 | // ----------------------------------------------------------------------- |
---|
| 163 | |
---|
| 164 | /** @name Destructor */ |
---|
| 165 | //@{ |
---|
| 166 | |
---|
| 167 | /** |
---|
| 168 | * Destructor |
---|
| 169 | */ |
---|
| 170 | virtual ~XMLAttDef(); |
---|
| 171 | //@} |
---|
| 172 | |
---|
| 173 | |
---|
| 174 | // ----------------------------------------------------------------------- |
---|
| 175 | // The virtual attribute def interface |
---|
| 176 | // ----------------------------------------------------------------------- |
---|
| 177 | |
---|
| 178 | /** @name Virtual interface */ |
---|
| 179 | //@{ |
---|
| 180 | |
---|
| 181 | /** Get the full name of this attribute type |
---|
| 182 | * |
---|
| 183 | * The derived class should return a const pointer to the full name of |
---|
| 184 | * this attribute. This will vary depending on the type of validator in |
---|
| 185 | * use. |
---|
| 186 | * |
---|
| 187 | * @return A const pointer to the full name of this attribute type. |
---|
| 188 | */ |
---|
| 189 | virtual const XMLCh* getFullName() const = 0; |
---|
| 190 | |
---|
| 191 | /** |
---|
| 192 | * The derived class should implement any cleaning up required between |
---|
| 193 | * each use of an instance of this class for validation |
---|
| 194 | */ |
---|
| 195 | virtual void reset() = 0; |
---|
| 196 | |
---|
| 197 | //@} |
---|
| 198 | |
---|
| 199 | |
---|
| 200 | // ----------------------------------------------------------------------- |
---|
| 201 | // Getter methods |
---|
| 202 | // ----------------------------------------------------------------------- |
---|
| 203 | |
---|
| 204 | /** @name Getter methods */ |
---|
| 205 | //@{ |
---|
| 206 | |
---|
| 207 | /** Get the default type of this attribute type |
---|
| 208 | * |
---|
| 209 | * This method returns the 'default type' of the attribute. Default |
---|
| 210 | * type in this case refers to the XML concept of a default type for |
---|
| 211 | * an attribute, i.e. #FIXED, #IMPLIED, etc... |
---|
| 212 | * |
---|
| 213 | * @return The default type enum for this attribute type. |
---|
| 214 | */ |
---|
| 215 | DefAttTypes getDefaultType() const; |
---|
| 216 | |
---|
| 217 | /** Get the enumeration value (if any) of this attribute type |
---|
| 218 | * |
---|
| 219 | * If the attribute is of an enumeration or notatin type, then this |
---|
| 220 | * method will return a const reference to a string that contains the |
---|
| 221 | * space separated values that can the attribute can have. |
---|
| 222 | * |
---|
| 223 | * @return A const pointer to a string that contains the space separated |
---|
| 224 | * legal values for this attribute. |
---|
| 225 | */ |
---|
| 226 | const XMLCh* getEnumeration() const; |
---|
| 227 | |
---|
| 228 | /** Get the pool id of this attribute type |
---|
| 229 | * |
---|
| 230 | * This method will return the id of this attribute in the validator's |
---|
| 231 | * attribute pool. It was set by the validator when this attribute was |
---|
| 232 | * created. |
---|
| 233 | * |
---|
| 234 | * @return The pool id of this attribute type. |
---|
| 235 | */ |
---|
| 236 | unsigned int getId() const; |
---|
| 237 | |
---|
| 238 | /** Query whether the attribute was explicitly provided. |
---|
| 239 | * |
---|
| 240 | * When the scanner scans a start tag, it will ask the element decl |
---|
| 241 | * object of the element type of that start tag to clear the 'provided' |
---|
| 242 | * flag on all its attributes. As the scanner sees explicitly provided |
---|
| 243 | * attributes, its turns on this flag to indicate that this attribute |
---|
| 244 | * has been provided. In this way, the scanner can catch duplicated |
---|
| 245 | * attributes and required attributes that aren't provided, and default |
---|
| 246 | * in fixed/default valued attributes that are not explicitly provided. |
---|
| 247 | * |
---|
| 248 | * @return Returns a boolean value that indicates whether this attribute |
---|
| 249 | * was explicitly provided. |
---|
| 250 | * @deprecated |
---|
| 251 | */ |
---|
| 252 | bool getProvided() const; |
---|
| 253 | |
---|
| 254 | /** Get the type of this attribute |
---|
| 255 | * |
---|
| 256 | * Gets the type of this attribute. This type is represented by an enum |
---|
| 257 | * that convers the types of attributes allowed by XML, e.g. CDATA, NMTOKEN, |
---|
| 258 | * NOTATION, etc... |
---|
| 259 | * |
---|
| 260 | * @return The attribute type enumeration value for this type of |
---|
| 261 | * attribute. |
---|
| 262 | */ |
---|
| 263 | AttTypes getType() const; |
---|
| 264 | |
---|
| 265 | /** Get the default/fixed value of this attribute (if any.) |
---|
| 266 | * |
---|
| 267 | * If the attribute defined a default/fixed value, then it is stored |
---|
| 268 | * and this method will retrieve it. If it has non, then a null pointer |
---|
| 269 | * is returned. |
---|
| 270 | * |
---|
| 271 | * @return A const pointer to the default/fixed value for this attribute |
---|
| 272 | * type. |
---|
| 273 | */ |
---|
| 274 | const XMLCh* getValue() const; |
---|
| 275 | |
---|
| 276 | /** Get the create reason for this attribute |
---|
| 277 | * |
---|
| 278 | * This method returns an enumeration which indicates why this attribute |
---|
| 279 | * declaration exists. |
---|
| 280 | * |
---|
| 281 | * @return An enumerated value that indicates the reason why this attribute |
---|
| 282 | * was added to the attribute table. |
---|
| 283 | */ |
---|
| 284 | CreateReasons getCreateReason() const; |
---|
| 285 | |
---|
| 286 | /** Indicate whether this attribute has been declared externally |
---|
| 287 | * |
---|
| 288 | * This method returns a boolean that indicates whether this attribute |
---|
| 289 | * has been declared externally. |
---|
| 290 | * |
---|
| 291 | * @return true if this attribute has been declared externally, else false. |
---|
| 292 | */ |
---|
| 293 | bool isExternal() const; |
---|
| 294 | |
---|
| 295 | /** Get the plugged-in memory manager |
---|
| 296 | * |
---|
| 297 | * This method returns the plugged-in memory manager user for dynamic |
---|
| 298 | * memory allocation/deallocation. |
---|
| 299 | * |
---|
| 300 | * @return the plugged-in memory manager |
---|
| 301 | */ |
---|
| 302 | MemoryManager* getMemoryManager() const; |
---|
| 303 | |
---|
| 304 | |
---|
| 305 | /** |
---|
| 306 | * @return the uri part of DOM Level 3 TypeInfo |
---|
| 307 | * @deprecated |
---|
| 308 | */ |
---|
| 309 | virtual const XMLCh* getDOMTypeInfoUri() const = 0; |
---|
| 310 | |
---|
| 311 | /** |
---|
| 312 | * @return the name part of DOM Level 3 TypeInfo |
---|
| 313 | * @deprecated |
---|
| 314 | */ |
---|
| 315 | virtual const XMLCh* getDOMTypeInfoName() const = 0; |
---|
| 316 | |
---|
| 317 | //@} |
---|
| 318 | |
---|
| 319 | |
---|
| 320 | // ----------------------------------------------------------------------- |
---|
| 321 | // Setter methods |
---|
| 322 | // ----------------------------------------------------------------------- |
---|
| 323 | |
---|
| 324 | /** @name Setter methods */ |
---|
| 325 | //@{ |
---|
| 326 | |
---|
| 327 | /** Set the default attribute type |
---|
| 328 | * |
---|
| 329 | * This method sets the default attribute type for this attribute. |
---|
| 330 | * This setting controls whether the attribute is required, fixed, |
---|
| 331 | * implied, etc... |
---|
| 332 | * |
---|
| 333 | * @param newValue The new default attribute to set |
---|
| 334 | */ |
---|
| 335 | void setDefaultType(const XMLAttDef::DefAttTypes newValue); |
---|
| 336 | |
---|
| 337 | /** Set the pool id for this attribute type. |
---|
| 338 | * |
---|
| 339 | * This method sets the pool id of this attribute type. This is usually |
---|
| 340 | * called by the validator that creates the actual instance (which is of |
---|
| 341 | * a derived type known only by the validator.) |
---|
| 342 | * |
---|
| 343 | * @param newId The new pool id to set. |
---|
| 344 | */ |
---|
| 345 | void setId(const unsigned int newId); |
---|
| 346 | |
---|
| 347 | /** Set or clear the 'provided' flag. |
---|
| 348 | * |
---|
| 349 | * This method will set or clear the 'provided' flag. This is called |
---|
| 350 | * by the scanner as it is scanning a start tag and marking off the |
---|
| 351 | * attributes that have been explicitly provided. |
---|
| 352 | * |
---|
| 353 | * @param newValue The new provided state to set |
---|
| 354 | * @deprecated |
---|
| 355 | */ |
---|
| 356 | void setProvided(const bool newValue); |
---|
| 357 | |
---|
| 358 | /** Set the type of this attribute type. |
---|
| 359 | * |
---|
| 360 | * This method will set the type of the attribute. The type of an attribute |
---|
| 361 | * controls how it is normalized and what kinds of characters it can hold. |
---|
| 362 | * |
---|
| 363 | * @param newValue The new attribute type to set |
---|
| 364 | */ |
---|
| 365 | void setType(const XMLAttDef::AttTypes newValue); |
---|
| 366 | |
---|
| 367 | /** Set the default/fixed value of this attribute type. |
---|
| 368 | * |
---|
| 369 | * This method set the fixed/default value for the attribute. This value |
---|
| 370 | * will be used when instances of this attribute type are faulted in. It |
---|
| 371 | * <b>must</b> be a valid value for the type set by setType(). If the |
---|
| 372 | * type is enumeration or notation, this must be one of the valid values |
---|
| 373 | * set in the setEnumeration() call. |
---|
| 374 | * |
---|
| 375 | * @param newValue The new fixed/default value to set. |
---|
| 376 | */ |
---|
| 377 | void setValue(const XMLCh* const newValue); |
---|
| 378 | |
---|
| 379 | /** Set the enumerated value of this attribute type. |
---|
| 380 | * |
---|
| 381 | * This method sets the enumerated/notation value list for this attribute |
---|
| 382 | * type. It is a space separated set of possible values. These values must |
---|
| 383 | * meet the constrains of the XML spec for such values of this type of |
---|
| 384 | * attribute. This should only be set if the setType() method is used to |
---|
| 385 | * set the type to the enumeration or notation types. |
---|
| 386 | * |
---|
| 387 | * @param newValue The new enumerated/notation value list to set. |
---|
| 388 | */ |
---|
| 389 | void setEnumeration(const XMLCh* const newValue); |
---|
| 390 | |
---|
| 391 | /** Update the create reason for this attribute type. |
---|
| 392 | * |
---|
| 393 | * This method will update the 'create reason' field for this attribute |
---|
| 394 | * decl object. |
---|
| 395 | * |
---|
| 396 | * @param newReason The new create reason. |
---|
| 397 | */ |
---|
| 398 | void setCreateReason(const CreateReasons newReason); |
---|
| 399 | |
---|
| 400 | /** |
---|
| 401 | * Set the attribute decl to indicate external declaration |
---|
| 402 | * |
---|
| 403 | * @param aValue The new value to indicate external declaration. |
---|
| 404 | */ |
---|
| 405 | void setExternalAttDeclaration(const bool aValue); |
---|
| 406 | |
---|
| 407 | //@} |
---|
| 408 | |
---|
| 409 | /*** |
---|
| 410 | * Support for Serialization/De-serialization |
---|
| 411 | ***/ |
---|
| 412 | DECL_XSERIALIZABLE(XMLAttDef) |
---|
| 413 | |
---|
| 414 | protected : |
---|
| 415 | // ----------------------------------------------------------------------- |
---|
| 416 | // Hidden constructors |
---|
| 417 | // ----------------------------------------------------------------------- |
---|
| 418 | XMLAttDef |
---|
| 419 | ( |
---|
| 420 | const AttTypes type = CData |
---|
| 421 | , const DefAttTypes defType= Implied |
---|
| 422 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
---|
| 423 | ); |
---|
| 424 | XMLAttDef |
---|
| 425 | ( |
---|
| 426 | const XMLCh* const attValue |
---|
| 427 | , const AttTypes type |
---|
| 428 | , const DefAttTypes defType |
---|
| 429 | , const XMLCh* const enumValues = 0 |
---|
| 430 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
---|
| 431 | ); |
---|
| 432 | |
---|
| 433 | |
---|
| 434 | private : |
---|
| 435 | // ----------------------------------------------------------------------- |
---|
| 436 | // Unimplemented constructors and operators |
---|
| 437 | // ----------------------------------------------------------------------- |
---|
| 438 | XMLAttDef(const XMLAttDef&); |
---|
| 439 | XMLAttDef& operator=(const XMLAttDef&); |
---|
| 440 | |
---|
| 441 | |
---|
| 442 | // ----------------------------------------------------------------------- |
---|
| 443 | // Private helper methods |
---|
| 444 | // ----------------------------------------------------------------------- |
---|
| 445 | void cleanUp(); |
---|
| 446 | |
---|
| 447 | |
---|
| 448 | // ----------------------------------------------------------------------- |
---|
| 449 | // Private data members |
---|
| 450 | // |
---|
| 451 | // fDefaultType |
---|
| 452 | // Indicates what, if any, default stuff this attribute has. |
---|
| 453 | // |
---|
| 454 | // fEnumeration |
---|
| 455 | // If its an enumeration, this is the list of values as space |
---|
| 456 | // separated values. |
---|
| 457 | // |
---|
| 458 | // fId |
---|
| 459 | // This is the unique id of this attribute, given to it when its put |
---|
| 460 | // into the validator's attribute decl pool. It defaults to the |
---|
| 461 | // special value XMLAttrDef::fgInvalidAttrId. |
---|
| 462 | // |
---|
| 463 | // fProvided |
---|
| 464 | // This field is really for use by the scanner. It is used to track |
---|
| 465 | // which of the attributes of an element were provided. Any marked |
---|
| 466 | // as not provided (after scanning the start tag) and having a |
---|
| 467 | // default type of Required, is in error. |
---|
| 468 | // |
---|
| 469 | // fType |
---|
| 470 | // The type of attribute, which is one of the AttTypes values. |
---|
| 471 | // |
---|
| 472 | // fValue |
---|
| 473 | // This is the value of the attribute, which is the default value |
---|
| 474 | // given in the attribute declaration. |
---|
| 475 | // |
---|
| 476 | // fCreateReason |
---|
| 477 | // This flag tells us how this attribute got created. Sometimes even |
---|
| 478 | // the attribute was not declared for the element, we want to fault |
---|
| 479 | // fault it into the pool to avoid lots of redundant errors. |
---|
| 480 | // |
---|
| 481 | // fExternalAttribute |
---|
| 482 | // This flag indicates whether or not the attribute was declared externally. |
---|
| 483 | // ----------------------------------------------------------------------- |
---|
| 484 | DefAttTypes fDefaultType; |
---|
| 485 | AttTypes fType; |
---|
| 486 | CreateReasons fCreateReason; |
---|
| 487 | bool fProvided; |
---|
| 488 | bool fExternalAttribute; |
---|
| 489 | unsigned int fId; |
---|
| 490 | XMLCh* fValue; |
---|
| 491 | XMLCh* fEnumeration; |
---|
| 492 | MemoryManager* fMemoryManager; |
---|
| 493 | }; |
---|
| 494 | |
---|
| 495 | |
---|
| 496 | // --------------------------------------------------------------------------- |
---|
| 497 | // Getter methods |
---|
| 498 | // --------------------------------------------------------------------------- |
---|
| 499 | inline XMLAttDef::DefAttTypes XMLAttDef::getDefaultType() const |
---|
| 500 | { |
---|
| 501 | return fDefaultType; |
---|
| 502 | } |
---|
| 503 | |
---|
| 504 | inline const XMLCh* XMLAttDef::getEnumeration() const |
---|
| 505 | { |
---|
| 506 | return fEnumeration; |
---|
| 507 | } |
---|
| 508 | |
---|
| 509 | inline unsigned int XMLAttDef::getId() const |
---|
| 510 | { |
---|
| 511 | return fId; |
---|
| 512 | } |
---|
| 513 | |
---|
| 514 | inline bool XMLAttDef::getProvided() const |
---|
| 515 | { |
---|
| 516 | return fProvided; |
---|
| 517 | } |
---|
| 518 | |
---|
| 519 | inline XMLAttDef::AttTypes XMLAttDef::getType() const |
---|
| 520 | { |
---|
| 521 | return fType; |
---|
| 522 | } |
---|
| 523 | |
---|
| 524 | inline const XMLCh* XMLAttDef::getValue() const |
---|
| 525 | { |
---|
| 526 | return fValue; |
---|
| 527 | } |
---|
| 528 | |
---|
| 529 | inline XMLAttDef::CreateReasons XMLAttDef::getCreateReason() const |
---|
| 530 | { |
---|
| 531 | return fCreateReason; |
---|
| 532 | } |
---|
| 533 | |
---|
| 534 | inline bool XMLAttDef::isExternal() const |
---|
| 535 | { |
---|
| 536 | return fExternalAttribute; |
---|
| 537 | } |
---|
| 538 | |
---|
| 539 | inline MemoryManager* XMLAttDef::getMemoryManager() const |
---|
| 540 | { |
---|
| 541 | return fMemoryManager; |
---|
| 542 | } |
---|
| 543 | |
---|
| 544 | // --------------------------------------------------------------------------- |
---|
| 545 | // XMLAttDef: Setter methods |
---|
| 546 | // --------------------------------------------------------------------------- |
---|
| 547 | inline void XMLAttDef::setDefaultType(const XMLAttDef::DefAttTypes newValue) |
---|
| 548 | { |
---|
| 549 | fDefaultType = newValue; |
---|
| 550 | } |
---|
| 551 | |
---|
| 552 | inline void XMLAttDef::setEnumeration(const XMLCh* const newValue) |
---|
| 553 | { |
---|
| 554 | if (fEnumeration) |
---|
| 555 | fMemoryManager->deallocate(fEnumeration); |
---|
| 556 | |
---|
| 557 | fEnumeration = XMLString::replicate(newValue, fMemoryManager); |
---|
| 558 | } |
---|
| 559 | |
---|
| 560 | inline void XMLAttDef::setId(const unsigned int newId) |
---|
| 561 | { |
---|
| 562 | fId = newId; |
---|
| 563 | } |
---|
| 564 | |
---|
| 565 | inline void XMLAttDef::setProvided(const bool newValue) |
---|
| 566 | { |
---|
| 567 | fProvided = newValue; |
---|
| 568 | } |
---|
| 569 | |
---|
| 570 | inline void XMLAttDef::setType(const XMLAttDef::AttTypes newValue) |
---|
| 571 | { |
---|
| 572 | fType = newValue; |
---|
| 573 | } |
---|
| 574 | |
---|
| 575 | inline void XMLAttDef::setValue(const XMLCh* const newValue) |
---|
| 576 | { |
---|
| 577 | if (fValue) |
---|
| 578 | fMemoryManager->deallocate(fValue); |
---|
| 579 | |
---|
| 580 | fValue = XMLString::replicate(newValue, fMemoryManager); |
---|
| 581 | } |
---|
| 582 | |
---|
| 583 | inline void |
---|
| 584 | XMLAttDef::setCreateReason(const XMLAttDef::CreateReasons newReason) |
---|
| 585 | { |
---|
| 586 | fCreateReason = newReason; |
---|
| 587 | } |
---|
| 588 | |
---|
| 589 | inline void XMLAttDef::setExternalAttDeclaration(const bool aValue) |
---|
| 590 | { |
---|
| 591 | fExternalAttribute = aValue; |
---|
| 592 | } |
---|
| 593 | |
---|
| 594 | XERCES_CPP_NAMESPACE_END |
---|
| 595 | |
---|
| 596 | #endif |
---|