[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: ContentLeafNameTypeVector.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | #if !defined(CONTENTLEAFNAMETYPEVECTOR_HPP) |
---|
| 24 | #define CONTENTLEAFNAMETYPEVECTOR_HPP |
---|
| 25 | |
---|
| 26 | #include <xercesc/validators/common/ContentSpecNode.hpp> |
---|
| 27 | #include <xercesc/framework/MemoryManager.hpp> |
---|
| 28 | |
---|
| 29 | XERCES_CPP_NAMESPACE_BEGIN |
---|
| 30 | |
---|
| 31 | class XMLPARSER_EXPORT ContentLeafNameTypeVector : public XMemory |
---|
| 32 | { |
---|
| 33 | public : |
---|
| 34 | // ----------------------------------------------------------------------- |
---|
| 35 | // Class specific types |
---|
| 36 | // ----------------------------------------------------------------------- |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | // ----------------------------------------------------------------------- |
---|
| 40 | // Constructors and Destructor |
---|
| 41 | // ----------------------------------------------------------------------- |
---|
| 42 | ContentLeafNameTypeVector |
---|
| 43 | ( |
---|
| 44 | MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
---|
| 45 | ); |
---|
| 46 | ContentLeafNameTypeVector |
---|
| 47 | ( |
---|
| 48 | QName** const qName |
---|
| 49 | , ContentSpecNode::NodeTypes* const types |
---|
| 50 | , const unsigned int count |
---|
| 51 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
---|
| 52 | ); |
---|
| 53 | |
---|
| 54 | ~ContentLeafNameTypeVector(); |
---|
| 55 | |
---|
| 56 | ContentLeafNameTypeVector(const ContentLeafNameTypeVector&); |
---|
| 57 | |
---|
| 58 | // ----------------------------------------------------------------------- |
---|
| 59 | // Getter methods |
---|
| 60 | // ----------------------------------------------------------------------- |
---|
| 61 | QName* getLeafNameAt(const unsigned int pos) const; |
---|
| 62 | |
---|
| 63 | const ContentSpecNode::NodeTypes getLeafTypeAt(const unsigned int pos) const; |
---|
| 64 | const unsigned int getLeafCount() const; |
---|
| 65 | |
---|
| 66 | // ----------------------------------------------------------------------- |
---|
| 67 | // Setter methods |
---|
| 68 | // ----------------------------------------------------------------------- |
---|
| 69 | void setValues |
---|
| 70 | ( |
---|
| 71 | QName** const qName |
---|
| 72 | , ContentSpecNode::NodeTypes* const types |
---|
| 73 | , const unsigned int count |
---|
| 74 | ); |
---|
| 75 | |
---|
| 76 | // ----------------------------------------------------------------------- |
---|
| 77 | // Miscellaneous |
---|
| 78 | // ----------------------------------------------------------------------- |
---|
| 79 | |
---|
| 80 | private : |
---|
| 81 | // ----------------------------------------------------------------------- |
---|
| 82 | // Unimplemented constructors and operators |
---|
| 83 | // ----------------------------------------------------------------------- |
---|
| 84 | ContentLeafNameTypeVector& operator=(const ContentLeafNameTypeVector&); |
---|
| 85 | |
---|
| 86 | // ----------------------------------------------------------------------- |
---|
| 87 | // helper methods |
---|
| 88 | // ----------------------------------------------------------------------- |
---|
| 89 | void cleanUp(); |
---|
| 90 | void init(const unsigned int); |
---|
| 91 | |
---|
| 92 | // ----------------------------------------------------------------------- |
---|
| 93 | // Private Data Members |
---|
| 94 | // |
---|
| 95 | // ----------------------------------------------------------------------- |
---|
| 96 | MemoryManager* fMemoryManager; |
---|
| 97 | QName** fLeafNames; |
---|
| 98 | ContentSpecNode::NodeTypes *fLeafTypes; |
---|
| 99 | unsigned int fLeafCount; |
---|
| 100 | }; |
---|
| 101 | |
---|
| 102 | inline void ContentLeafNameTypeVector::cleanUp() |
---|
| 103 | { |
---|
| 104 | fMemoryManager->deallocate(fLeafNames); //delete [] fLeafNames; |
---|
| 105 | fMemoryManager->deallocate(fLeafTypes); //delete [] fLeafTypes; |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | inline void ContentLeafNameTypeVector::init(const unsigned int size) |
---|
| 109 | { |
---|
| 110 | fLeafNames = (QName**) fMemoryManager->allocate(size * sizeof(QName*));//new QName*[size]; |
---|
| 111 | fLeafTypes = (ContentSpecNode::NodeTypes *) fMemoryManager->allocate |
---|
| 112 | ( |
---|
| 113 | size * sizeof(ContentSpecNode::NodeTypes) |
---|
| 114 | ); //new ContentSpecNode::NodeTypes [size]; |
---|
| 115 | fLeafCount = size; |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | XERCES_CPP_NAMESPACE_END |
---|
| 119 | |
---|
| 120 | #endif |
---|