source: icXML/icXML-devel/src/xercesc/validators/datatype/MonthDatatypeValidator.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.3 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: MonthDatatypeValidator.cpp 471747 2006-11-06 14:31:56Z amassari $
20 */
21
22// ---------------------------------------------------------------------------
23//  Includes
24// ---------------------------------------------------------------------------
25#include <xercesc/validators/datatype/MonthDatatypeValidator.hpp>
26#include <xercesc/util/OutOfMemoryException.hpp>
27
28XERCES_CPP_NAMESPACE_BEGIN
29
30// ---------------------------------------------------------------------------
31//  Constructors and Destructor
32// ---------------------------------------------------------------------------
33MonthDatatypeValidator::MonthDatatypeValidator(MemoryManager* const manager)
34:DateTimeValidator(0, 0, 0, DatatypeValidator::Month, manager)
35{
36    setOrdered(XSSimpleTypeDefinition::ORDERED_PARTIAL);
37}
38
39MonthDatatypeValidator::MonthDatatypeValidator(
40                          DatatypeValidator*            const baseValidator
41                        , RefHashTableOf<KVStringPair>* const facets
42                        , RefArrayVectorOf<XMLCh>*      const enums
43                        , const int                           finalSet
44                        , MemoryManager* const                manager)
45:DateTimeValidator(baseValidator, facets, finalSet, DatatypeValidator::Month, manager)
46{
47    init(enums, manager);
48}
49
50MonthDatatypeValidator::~MonthDatatypeValidator()
51{}
52
53DatatypeValidator* MonthDatatypeValidator::newInstance
54(
55      RefHashTableOf<KVStringPair>* const facets
56    , RefArrayVectorOf<XMLCh>* const      enums
57    , const int                           finalSet
58    , MemoryManager* const                manager
59)
60{
61    return (DatatypeValidator*) new (manager) MonthDatatypeValidator(this, facets, enums, finalSet, manager);
62}
63
64//
65// caller need to release the date created here
66//
67XMLDateTime* MonthDatatypeValidator::parse(const XMLCh* const content, MemoryManager* const manager)
68{
69    XMLDateTime *pRetDate = new (manager) XMLDateTime(content, manager);
70    Janitor<XMLDateTime> jan(pRetDate);
71
72    try
73    {
74        pRetDate->parseMonth();
75    }
76    catch(const OutOfMemoryException&)
77    {
78        jan.release();
79
80        throw;
81    }
82
83    return jan.release();
84}
85
86void MonthDatatypeValidator::parse(XMLDateTime* const pDate)
87{
88    pDate->parseMonth();
89}
90
91
92/***
93 * Support for Serialization/De-serialization
94 ***/
95
96IMPL_XSERIALIZABLE_TOCREATE(MonthDatatypeValidator)
97
98void MonthDatatypeValidator::serialize(XSerializeEngine& serEng)
99{
100    DateTimeValidator::serialize(serEng);
101}
102
103XERCES_CPP_NAMESPACE_END
104
105/**
106  * End of file MonthDatatypeValidator::cpp
107  */
108
Note: See TracBrowser for help on using the repository browser.