source: icXML/icXML-devel/src/xercesc/validators/schema/XercesGroupInfo.cpp @ 2722

Last change on this file since 2722 was 2722, checked in by cameron, 6 years ago

Original Xerces files with import mods for icxercesc

File size: 3.9 KB
Line 
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: XercesGroupInfo.cpp 471747 2006-11-06 14:31:56Z amassari $
20 */
21
22// ---------------------------------------------------------------------------
23//  Includes
24// ---------------------------------------------------------------------------
25#include <xercesc/validators/schema/XercesGroupInfo.hpp>
26#include <xercesc/validators/common/ContentSpecNode.hpp>
27#include <xercesc/validators/schema/XSDLocator.hpp>
28
29#include <xercesc/internal/XTemplateSerializer.hpp>
30
31XERCES_CPP_NAMESPACE_BEGIN
32
33// ---------------------------------------------------------------------------
34//  XercesGroupInfo: Constructors and Destructor
35// ---------------------------------------------------------------------------
36XercesGroupInfo::XercesGroupInfo(MemoryManager* const manager)
37    : fCheckElementConsistency(true)
38    , fScope(Grammar::TOP_LEVEL_SCOPE)
39    , fNameId(0)
40    , fNamespaceId(0)
41    , fContentSpec(0)
42    , fElements(0)
43    , fBaseGroup(0)
44    , fLocator(0)
45{
46    fElements = new (manager) RefVectorOf<SchemaElementDecl>(4, false, manager);
47}
48
49XercesGroupInfo::XercesGroupInfo(unsigned int groupNameId,
50                                 unsigned int groupNamespaceId,
51                                 MemoryManager* const manager)
52    : fCheckElementConsistency(true)
53    , fScope(Grammar::TOP_LEVEL_SCOPE)
54    , fNameId(groupNameId)
55    , fNamespaceId(groupNamespaceId)
56    , fContentSpec(0)
57    , fElements(0)
58    , fBaseGroup(0)
59    , fLocator(0)
60{
61    fElements = new (manager) RefVectorOf<SchemaElementDecl>(4, false, manager);
62}
63
64
65XercesGroupInfo::~XercesGroupInfo()
66{
67    delete fElements;
68    delete fContentSpec;
69    delete fLocator;
70}
71
72
73// ---------------------------------------------------------------------------
74//  XercesGroupInfo: Constructors and Destructor
75// ---------------------------------------------------------------------------
76void XercesGroupInfo::setLocator(XSDLocator* const aLocator) {
77
78    if (fLocator)
79        delete fLocator;
80
81    fLocator = aLocator;
82}
83
84/***
85 * Support for Serialization/De-serialization
86 ***/
87
88IMPL_XSERIALIZABLE_TOCREATE(XercesGroupInfo)
89
90void XercesGroupInfo::serialize(XSerializeEngine& serEng)
91{
92    if (serEng.isStoring())
93    {   
94        serEng<<fCheckElementConsistency;
95        serEng<<fScope;
96        serEng<<fNameId;
97        serEng<<fNamespaceId;
98        serEng<<fContentSpec;
99
100        /***
101         *
102         * Serialize RefVectorOf<SchemaElementDecl>* fElements;
103         *
104         ***/
105
106        XTemplateSerializer::storeObject(fElements, serEng);
107
108        serEng<<fBaseGroup;
109
110        //don't serialize     XSDLocator* fLocator;
111    }
112    else
113    {
114        serEng>>fCheckElementConsistency;
115        serEng>>fScope;
116        serEng>>fNameId;
117        serEng>>fNamespaceId;
118        serEng>>fContentSpec;
119
120        /***
121         *
122         * Deserialize RefVectorOf<SchemaElementDecl>*    fElements;
123         *
124         ***/
125        XTemplateSerializer::loadObject(&fElements, 4, false, serEng);
126
127        serEng>>fBaseGroup;
128
129        //don't serialize     XSDLocator* fLocator;
130        fLocator = 0;
131    }
132
133}
134
135XERCES_CPP_NAMESPACE_END
136
137/**
138  * End of file XercesGroupInfo.cpp
139  */
140
141
Note: See TracBrowser for help on using the repository browser.