You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by pe...@apache.org on 2001/11/07 20:18:52 UTC
cvs commit: xml-xerces/c/src/validators/datatype DateDatatypeValidator.cpp DateDatatypeValidator.hpp DateTimeDatatypeValidator.cpp DateTimeDatatypeValidator.hpp DateTimeValidator.cpp DateTimeValidator.hpp DayDatatypeValidator.cpp DayDatatypeValidator.hpp DurationDatatypeValidator.cpp DurationDatatypeValidator.hpp MonthDatatypeValidator.cpp MonthDatatypeValidator.hpp MonthDayDatatypeValidator.cpp MonthDayDatatypeValidator.hpp TimeDatatypeValidator.cpp TimeDatatypeValidator.hpp YearDatatypeValidator.cpp YearDatatypeValidator.hpp YearMonthDatatypeValidator.cpp YearMonthDatatypeValidator.hpp DatatypeValidatorFactory.cpp Makefile.in
peiyongz 01/11/07 11:18:52
Modified: c/src/validators/datatype DatatypeValidatorFactory.cpp
Makefile.in
Added: c/src/validators/datatype DateDatatypeValidator.cpp
DateDatatypeValidator.hpp
DateTimeDatatypeValidator.cpp
DateTimeDatatypeValidator.hpp DateTimeValidator.cpp
DateTimeValidator.hpp DayDatatypeValidator.cpp
DayDatatypeValidator.hpp
DurationDatatypeValidator.cpp
DurationDatatypeValidator.hpp
MonthDatatypeValidator.cpp
MonthDatatypeValidator.hpp
MonthDayDatatypeValidator.cpp
MonthDayDatatypeValidator.hpp
TimeDatatypeValidator.cpp TimeDatatypeValidator.hpp
YearDatatypeValidator.cpp YearDatatypeValidator.hpp
YearMonthDatatypeValidator.cpp
YearMonthDatatypeValidator.hpp
Log:
DateTime Port
Revision Changes Path
1.26 +29 -6 xml-xerces/c/src/validators/datatype/DatatypeValidatorFactory.cpp
Index: DatatypeValidatorFactory.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/datatype/DatatypeValidatorFactory.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- DatatypeValidatorFactory.cpp 2001/10/25 15:06:49 1.25
+++ DatatypeValidatorFactory.cpp 2001/11/07 19:18:52 1.26
@@ -56,6 +56,9 @@
/*
* $Log: DatatypeValidatorFactory.cpp,v $
+ * Revision 1.26 2001/11/07 19:18:52 peiyongz
+ * DateTime Port
+ *
* Revision 1.25 2001/10/25 15:06:49 tng
* Thread safe the static instance.
*
@@ -163,6 +166,15 @@
#include <validators/datatype/FloatDatatypeValidator.hpp>
#include <validators/datatype/AnyURIDatatypeValidator.hpp>
#include <validators/datatype/AnySimpleTypeDatatypeValidator.hpp>
+#include <validators/datatype/DateTimeDatatypeValidator.hpp>
+#include <validators/datatype/DateDatatypeValidator.hpp>
+#include <validators/datatype/TimeDatatypeValidator.hpp>
+#include <validators/datatype/DayDatatypeValidator.hpp>
+#include <validators/datatype/MonthDatatypeValidator.hpp>
+#include <validators/datatype/MonthDayDatatypeValidator.hpp>
+#include <validators/datatype/YearDatatypeValidator.hpp>
+#include <validators/datatype/YearMonthDatatypeValidator.hpp>
+#include <validators/datatype/DurationDatatypeValidator.hpp>
#include <util/PlatformUtils.hpp>
#include <util/XMLRegisterCleanup.hpp>
@@ -450,14 +462,25 @@
new NameDatatypeValidator());
fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_NCNAME,
new NCNameDatatypeValidator());
- /*
- fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_DURATION,
- new DurationDatatypeValidator());
- fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_DAY,
- new DayDatatypeValidator());
+
+ fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_DATETIME,
+ new DateTimeDatatypeValidator());
+ fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_DATE,
+ new DateDatatypeValidator());
fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_TIME,
new TimeDatatypeValidator());
- */
+ fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_DAY,
+ new DayDatatypeValidator());
+ fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_MONTH,
+ new MonthDatatypeValidator());
+ fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_MONTHDAY,
+ new MonthDayDatatypeValidator());
+ fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_YEAR,
+ new YearDatatypeValidator());
+ fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_YEARMONTH,
+ new YearMonthDatatypeValidator());
+ fBuiltInRegistry->put((void*) SchemaSymbols::fgDT_DURATION,
+ new DurationDatatypeValidator());
// REVISIT
// We are creating a lot of Hashtables for the facets of the different
1.22 +25 -2 xml-xerces/c/src/validators/datatype/Makefile.in
Index: Makefile.in
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/datatype/Makefile.in,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- Makefile.in 2001/10/01 16:14:22 1.21
+++ Makefile.in 2001/11/07 19:18:52 1.22
@@ -55,6 +55,9 @@
#
#
# $Log: Makefile.in,v $
+# Revision 1.22 2001/11/07 19:18:52 peiyongz
+# DateTime Port
+#
# Revision 1.21 2001/10/01 16:14:22 peiyongz
# DTV Reorganization:new classes: AbstractNumericFactValidator/ AbstractNumericValidator
#
@@ -168,7 +171,17 @@
AnySimpleTypeDatatypeValidator.hpp \
AbstractNumericFacetValidator.hpp \
AbstractNumericValidator.hpp \
- AbstractStringValidator.hpp
+ AbstractStringValidator.hpp \
+ DateTimeValidator.hpp \
+ DateTimeDatatypeValidator.hpp \
+ DateDatatypeValidator.hpp \
+ TimeDatatypeValidator.hpp \
+ DayDatatypeValidator.hpp \
+ MonthDatatypeValidator.hpp \
+ MonthDayDatatypeValidator.hpp \
+ YearDatatypeValidator.hpp \
+ YearMonthDatatypeValidator.hpp \
+ DurationDatatypeValidator.hpp
VALIDATORS_DATATYPE_CPP_PRIVHEADERS =
@@ -197,7 +210,17 @@
AnySimpleTypeDatatypeValidator.$(TO) \
AbstractNumericFacetValidator.$(TO) \
AbstractNumericValidator.$(TO) \
- AbstractStringValidator.$(TO)
+ AbstractStringValidator.$(TO) \
+ DateTimeValidator.$(TO) \
+ DateTimeDatatypeValidator.$(TO) \
+ DateDatatypeValidator.$(TO) \
+ TimeDatatypeValidator.$(TO) \
+ DayDatatypeValidator.$(TO) \
+ MonthDatatypeValidator.$(TO) \
+ MonthDayDatatypeValidator.$(TO) \
+ YearDatatypeValidator.$(TO) \
+ YearMonthDatatypeValidator.$(TO) \
+ DurationDatatypeValidator.$(TO)
all:: includes $(VALIDATORS_DATATYPE_CPP_OBJECTS)
1.1 xml-xerces/c/src/validators/datatype/DateDatatypeValidator.cpp
Index: DateDatatypeValidator.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: DateDatatypeValidator.cpp,v 1.1 2001/11/07 19:18:52 peiyongz Exp $
* $Log: DateDatatypeValidator.cpp,v $
* Revision 1.1 2001/11/07 19:18:52 peiyongz
* DateTime Port
*
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#include <validators/datatype/DateDatatypeValidator.hpp>
// ---------------------------------------------------------------------------
// Constructors and Destructor
// ---------------------------------------------------------------------------
DateDatatypeValidator::DateDatatypeValidator()
:DateTimeValidator(0, 0, 0, DatatypeValidator::Date)
{}
DateDatatypeValidator::DateDatatypeValidator(
DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet)
:DateTimeValidator(baseValidator, facets, finalSet, DatatypeValidator::Date)
{
init(enums);
}
DateDatatypeValidator::~DateDatatypeValidator()
{}
DatatypeValidator* DateDatatypeValidator::newInstance(
RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet)
{
return (DatatypeValidator*) new DateDatatypeValidator(this, facets, enums, finalSet);
}
//
// caller need to release the date created here
//
XMLDateTime* DateDatatypeValidator::parse(const XMLCh* const content)
{
XMLDateTime *pRetDate = new XMLDateTime(content);
try
{
pRetDate->parseDate();
}
catch (...)
{
delete pRetDate;
throw;
}
return pRetDate;
}
/**
* End of file DateDatatypeValidator::cpp
*/
1.1 xml-xerces/c/src/validators/datatype/DateDatatypeValidator.hpp
Index: DateDatatypeValidator.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: DateDatatypeValidator.hpp,v 1.1 2001/11/07 19:18:52 peiyongz Exp $
* $Log: DateDatatypeValidator.hpp,v $
* Revision 1.1 2001/11/07 19:18:52 peiyongz
* DateTime Port
*
*/
#if !defined(DATE_DATATYPE_VALIDATOR_HPP)
#define DATE_DATATYPE_VALIDATOR_HPP
#include <validators/datatype/DateTimeValidator.hpp>
class VALIDATORS_EXPORT DateDatatypeValidator : public DateTimeValidator
{
public:
// -----------------------------------------------------------------------
// Public ctor/dtor
// -----------------------------------------------------------------------
/** @name Constructor. */
//@{
DateDatatypeValidator();
DateDatatypeValidator(DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet);
~DateDatatypeValidator();
//@}
/**
* Returns an instance of the base datatype validator class
* Used by the DatatypeValidatorFactory.
*/
virtual DatatypeValidator* newInstance(RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet);
protected:
// -----------------------------------------------------------------------
// implementation of (DateTimeValidator's) virtual interface
// -----------------------------------------------------------------------
virtual XMLDateTime* parse(const XMLCh* const);
};
/**
* End of file DateDatatypeValidator.hpp
*/
#endif
1.1 xml-xerces/c/src/validators/datatype/DateTimeDatatypeValidator.cpp
Index: DateTimeDatatypeValidator.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: DateTimeDatatypeValidator.cpp,v 1.1 2001/11/07 19:18:52 peiyongz Exp $
* $Log: DateTimeDatatypeValidator.cpp,v $
* Revision 1.1 2001/11/07 19:18:52 peiyongz
* DateTime Port
*
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#include <validators/datatype/DateTimeDatatypeValidator.hpp>
// ---------------------------------------------------------------------------
// Constructors and Destructor
// ---------------------------------------------------------------------------
DateTimeDatatypeValidator::DateTimeDatatypeValidator()
:DateTimeValidator(0, 0, 0, DatatypeValidator::DateTime)
{}
DateTimeDatatypeValidator::DateTimeDatatypeValidator(
DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet)
:DateTimeValidator(baseValidator, facets, finalSet, DatatypeValidator::DateTime)
{
init(enums);
}
DateTimeDatatypeValidator::~DateTimeDatatypeValidator()
{}
DatatypeValidator* DateTimeDatatypeValidator::newInstance(
RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet)
{
return (DatatypeValidator*) new DateTimeDatatypeValidator(this, facets, enums, finalSet);
}
//
// caller need to release the date created here
//
XMLDateTime* DateTimeDatatypeValidator::parse(const XMLCh* const content)
{
XMLDateTime *pRetDate = new XMLDateTime(content);
try
{
pRetDate->parseDateTime();
}
catch (...)
{
delete pRetDate;
throw;
}
return pRetDate;
}
/**
* End of file DateTimeDatatypeValidator::cpp
*/
1.1 xml-xerces/c/src/validators/datatype/DateTimeDatatypeValidator.hpp
Index: DateTimeDatatypeValidator.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: DateTimeDatatypeValidator.hpp,v 1.1 2001/11/07 19:18:52 peiyongz Exp $
* $Log: DateTimeDatatypeValidator.hpp,v $
* Revision 1.1 2001/11/07 19:18:52 peiyongz
* DateTime Port
*
*/
#if !defined(DATETIME_DATATYPE_VALIDATOR_HPP)
#define DATETIME_DATATYPE_VALIDATOR_HPP
#include <validators/datatype/DateTimeValidator.hpp>
class VALIDATORS_EXPORT DateTimeDatatypeValidator : public DateTimeValidator
{
public:
// -----------------------------------------------------------------------
// Public ctor/dtor
// -----------------------------------------------------------------------
/** @name Constructor. */
//@{
DateTimeDatatypeValidator();
DateTimeDatatypeValidator(DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet);
~DateTimeDatatypeValidator();
//@}
/**
* Returns an instance of the base datatype validator class
* Used by the DatatypeValidatorFactory.
*/
virtual DatatypeValidator* newInstance(RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet);
protected:
// -----------------------------------------------------------------------
// implementation of (DateTimeValidator's) virtual interface
// -----------------------------------------------------------------------
virtual XMLDateTime* parse(const XMLCh* const);
};
/**
* End of file DateTimeDatatypeValidator.hpp
*/
#endif
1.1 xml-xerces/c/src/validators/datatype/DateTimeValidator.cpp
Index: DateTimeValidator.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: DateTimeValidator.cpp,v 1.1 2001/11/07 19:18:52 peiyongz Exp $
* $Log: DateTimeValidator.cpp,v $
* Revision 1.1 2001/11/07 19:18:52 peiyongz
* DateTime Port
*
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#include <validators/datatype/DateTimeValidator.hpp>
#include <validators/datatype/InvalidDatatypeFacetException.hpp>
#include <validators/datatype/InvalidDatatypeValueException.hpp>
#include <validators/schema/SchemaSymbols.hpp>
static const int BUF_LEN = 64;
static XMLCh value1[BUF_LEN+1];
static XMLCh value2[BUF_LEN+1];
// ---------------------------------------------------------------------------
// Macro
// ---------------------------------------------------------------------------
#define REPORT_VALUE_ERROR(val1, val2, except_code) \
XMLCh* value1 = (val1)->toString(); \
ArrayJanitor<XMLCh> jan1(value1); \
XMLCh* value2 = (val2)->toString(); \
ArrayJanitor<XMLCh> jan2(value2); \
ThrowXML2(InvalidDatatypeValueException \
, except_code \
, value1 \
, value2);
// ---------------------------------------------------------------------------
// Constructors and Destructor
// ---------------------------------------------------------------------------
DateTimeValidator::~DateTimeValidator()
{}
DateTimeValidator::DateTimeValidator(
DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, const int finalSet
, const ValidatorType type)
:AbstractNumericFacetValidator(baseValidator, facets, finalSet, type)
{
//do not invoke init() here !!!
}
void DateTimeValidator::validate(const XMLCh* const content)
{
checkContent(content, false);
}
int DateTimeValidator::compare(const XMLCh* const value1
, const XMLCh* const value2)
{
try
{
XMLDateTime *pDate1 = parse(value1);
Janitor<XMLDateTime> jName1(pDate1);
XMLDateTime *pDate2 = parse(value2);
Janitor<XMLDateTime> jName2(pDate2);
int result = compareDates(pDate1, pDate2, true);
return (result==INDETERMINATE)? -1 : result;
}
catch (...) // RuntimeException e
{
return -1; // revisit after implement compareDates()
}
}
void DateTimeValidator::initializeValues()
{
}
void DateTimeValidator::assignAdditionalFacet( const XMLCh* const key
, const XMLCh* const)
{
ThrowXML1(InvalidDatatypeFacetException
, XMLExcepts::FACET_Invalid_Tag
, key);
}
void DateTimeValidator::inheritAdditionalFacet()
{}
void DateTimeValidator::checkAdditionalFacetConstraints() const
{}
void DateTimeValidator::checkAdditionalFacetConstraintsBase() const
{}
void DateTimeValidator::checkContent(const XMLCh* const content
, bool asBase)
{
//validate against base validator if any
DateTimeValidator *pBaseValidator = (DateTimeValidator*) this->getBaseValidator();
if (pBaseValidator)
pBaseValidator->checkContent(content, true);
int thisFacetsDefined = getFacetsDefined();
// we check pattern first
if ( (thisFacetsDefined & DatatypeValidator::FACET_PATTERN ) != 0 )
{
// lazy construction
if (getRegex() ==0) {
try {
setRegex(new RegularExpression(getPattern(), SchemaSymbols::fgRegEx_XOption));
}
catch (XMLException &e)
{
ThrowXML1(InvalidDatatypeValueException, XMLExcepts::RethrowError, e.getMessage());
}
}
if (getRegex()->matches(content) ==false)
{
ThrowXML2(InvalidDatatypeValueException
, XMLExcepts::VALUE_NotMatch_Pattern
, content
, getPattern());
}
}
// if this is a base validator, we only need to check pattern facet
// all other facet were inherited by the derived type
if (asBase)
return;
try
{
// the derived classes' parse() method constructs an
// XMLDateTime object anc invokes appropriate XMLDateTime's
// parser to parse the content.
XMLDateTime *theDate = parse(content);
Janitor<XMLDateTime> jname(theDate);
int result;
// must be < MaxExclusive
if ( (thisFacetsDefined & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0 )
{
result = compareValues(theDate, getMaxExclusive());
if ( result != XMLDateTime::LESS_THAN )
{
REPORT_VALUE_ERROR(theDate
, getMaxExclusive()
, XMLExcepts::VALUE_exceed_maxExcl)
}
}
// must be <= MaxInclusive
if ( (thisFacetsDefined & DatatypeValidator::FACET_MAXINCLUSIVE) != 0 )
{
result = compareValues(theDate, getMaxInclusive());
if ( result == XMLDateTime::GREATER_THAN || result == XMLDateTime::INDETERMINATE )
{
REPORT_VALUE_ERROR(theDate
, getMaxInclusive()
, XMLExcepts::VALUE_exceed_maxIncl)
}
}
// must be >= MinInclusive
if ( (thisFacetsDefined & DatatypeValidator::FACET_MININCLUSIVE) != 0 )
{
result = compareValues(theDate, getMinInclusive());
if (result == XMLDateTime::LESS_THAN || result == XMLDateTime::INDETERMINATE )
{
REPORT_VALUE_ERROR(theDate
, getMinInclusive()
, XMLExcepts::VALUE_exceed_minIncl)
}
}
// must be > MinExclusive
if ( (thisFacetsDefined & DatatypeValidator::FACET_MINEXCLUSIVE) != 0 )
{
result = compareValues(theDate, getMinExclusive());
if (result != XMLDateTime::GREATER_THAN)
{
REPORT_VALUE_ERROR(theDate
, getMinExclusive()
, XMLExcepts::VALUE_exceed_minExcl)
}
}
if ((thisFacetsDefined & DatatypeValidator::FACET_ENUMERATION) != 0 &&
(getEnumeration() != 0))
{
int i=0;
int enumLength = getEnumeration()->size();
for ( ; i < enumLength; i++)
{
if (compareValues(theDate, getEnumeration()->elementAt(i)) == XMLDateTime::EQUAL)
break;
}
if (i == enumLength)
ThrowXML1(InvalidDatatypeValueException, XMLExcepts::VALUE_NotIn_Enumeration, content);
}
}
catch ( RuntimeException e )
{
ThrowXML1(InvalidDatatypeValueException, XMLExcepts::VALUE_NotIn_Enumeration, content);
// new error message needed here
//("Value '"+content+ "' is not legal value for current datatype. " +e.getMessage() );
}
}
//
// Comparision methods
//
int DateTimeValidator::compareValues(const XMLNumber* const lValue
, const XMLNumber* const rValue)
{
return compareDates((XMLDateTime*) lValue, (XMLDateTime*) rValue, true);
}
/**
* Compare algorithm described in dateDime (3.2.7).
* Duration datatype overwrites this method
*
* @param date1 normalized date representation of the first value
* @param date2 normalized date representation of the second value
* @param strict
* @return less, greater, less_equal, greater_equal, equal
*/
int DateTimeValidator::compareDates(const XMLDateTime* const date1
, const XMLDateTime* const date2
, bool strict)
{
return XMLDateTime::compare(date1, date2);
}
//
// In fact, the proper way of the following set*() shall be
// {
// if (fMaxInclusive)
// delete fMaxInclusive;
//
// fMaxInclusive = parse(value);
//
// }
//
// But we know this function is invoked once and only once
// since there is no duplicated facet passed in, therefore
// fMaxInclusive is alwasy zero before, so for the
// sake of performance, we do not do the checking/delete.
//
void DateTimeValidator::setMaxInclusive(const XMLCh* const value)
{
fMaxInclusive = parse(value);
}
void DateTimeValidator::setMaxExclusive(const XMLCh* const value)
{
fMaxExclusive = parse(value);
}
void DateTimeValidator::setMinInclusive(const XMLCh* const value)
{
fMinInclusive = parse(value);
}
void DateTimeValidator::setMinExclusive(const XMLCh* const value)
{
fMinExclusive = parse(value);
}
void DateTimeValidator::setEnumeration()
{
// to do: do we need to check against base value space???
if (!fStrEnumeration)
return;
int enumLength = fStrEnumeration->size();
fEnumeration = new RefVectorOf<XMLNumber>(enumLength, true);
fEnumerationInherited = false;
for ( int i = 0; i < enumLength; i++)
fEnumeration->insertElementAt(parse(fStrEnumeration->elementAt(i)), i);
}
/**
* End of file DateTimeValidator::cpp
*/
1.1 xml-xerces/c/src/validators/datatype/DateTimeValidator.hpp
Index: DateTimeValidator.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: DateTimeValidator.hpp,v 1.1 2001/11/07 19:18:52 peiyongz Exp $
* $Log: DateTimeValidator.hpp,v $
* Revision 1.1 2001/11/07 19:18:52 peiyongz
* DateTime Port
*
*/
#if !defined(DATETIME_VALIDATOR_HPP)
#define DATETIME_VALIDATOR_HPP
#include <validators/datatype/AbstractNumericFacetValidator.hpp>
#include <util/XMLDateTime.hpp>
class VALIDATORS_EXPORT DateTimeValidator : public AbstractNumericFacetValidator
{
public:
// -----------------------------------------------------------------------
// Public dtor
// -----------------------------------------------------------------------
/** @name Constructor. */
//@{
virtual ~DateTimeValidator();
//@}
virtual void validate(const XMLCh* const content);
virtual int compare(const XMLCh* const value1
, const XMLCh* const value2);
protected:
// -----------------------------------------------------------------------
// ctor used by derived class
// -----------------------------------------------------------------------
DateTimeValidator(DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, const int finalSet
, const ValidatorType type);
//
// Abstract interface
//
virtual void initializeValues();
virtual void assignAdditionalFacet(const XMLCh* const key
, const XMLCh* const value);
virtual void inheritAdditionalFacet();
virtual void checkAdditionalFacetConstraints() const;
virtual void checkAdditionalFacetConstraintsBase() const;
virtual int compareValues(const XMLNumber* const lValue
, const XMLNumber* const rValue);
virtual void checkContent(const XMLCh* const content
, bool asBase);
virtual void setMaxInclusive(const XMLCh* const);
virtual void setMaxExclusive(const XMLCh* const);
virtual void setMinInclusive(const XMLCh* const);
virtual void setMinExclusive(const XMLCh* const);
virtual void setEnumeration();
protected:
// -----------------------------------------------------------------------
// helper interface: to be implemented/overwritten by derived class
// -----------------------------------------------------------------------
virtual XMLDateTime* parse(const XMLCh* const) = 0;
// to be overwritten by duration
virtual int compareDates(const XMLDateTime* const lValue
, const XMLDateTime* const rValue
, bool strict);
};
/**
* End of file DateTimeValidator.hpp
*/
#endif
1.1 xml-xerces/c/src/validators/datatype/DayDatatypeValidator.cpp
Index: DayDatatypeValidator.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: DayDatatypeValidator.cpp,v 1.1 2001/11/07 19:18:52 peiyongz Exp $
* $Log: DayDatatypeValidator.cpp,v $
* Revision 1.1 2001/11/07 19:18:52 peiyongz
* DateTime Port
*
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#include <validators/datatype/DayDatatypeValidator.hpp>
// ---------------------------------------------------------------------------
// Constructors and Destructor
// ---------------------------------------------------------------------------
DayDatatypeValidator::DayDatatypeValidator()
:DateTimeValidator(0, 0, 0, DatatypeValidator::Day)
{}
DayDatatypeValidator::DayDatatypeValidator(
DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet)
:DateTimeValidator(baseValidator, facets, finalSet, DatatypeValidator::Day)
{
init(enums);
}
DayDatatypeValidator::~DayDatatypeValidator()
{}
DatatypeValidator* DayDatatypeValidator::newInstance(
RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet)
{
return (DatatypeValidator*) new DayDatatypeValidator(this, facets, enums, finalSet);
}
//
// caller need to release the date created here
//
XMLDateTime* DayDatatypeValidator::parse(const XMLCh* const content)
{
XMLDateTime *pRetDate = new XMLDateTime(content);
try
{
pRetDate->parseDay();
}
catch (...)
{
delete pRetDate;
throw;
}
return pRetDate;
}
/**
* End of file DayDatatypeValidator::cpp
*/
1.1 xml-xerces/c/src/validators/datatype/DayDatatypeValidator.hpp
Index: DayDatatypeValidator.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: DayDatatypeValidator.hpp,v 1.1 2001/11/07 19:18:52 peiyongz Exp $
* $Log: DayDatatypeValidator.hpp,v $
* Revision 1.1 2001/11/07 19:18:52 peiyongz
* DateTime Port
*
*/
#if !defined(DAY_DATATYPE_VALIDATOR_HPP)
#define DAY_DATATYPE_VALIDATOR_HPP
#include <validators/datatype/DateTimeValidator.hpp>
class VALIDATORS_EXPORT DayDatatypeValidator : public DateTimeValidator
{
public:
// -----------------------------------------------------------------------
// Public ctor/dtor
// -----------------------------------------------------------------------
/** @name Constructor. */
//@{
DayDatatypeValidator();
DayDatatypeValidator(DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet);
~DayDatatypeValidator();
//@}
/**
* Returns an instance of the base datatype validator class
* Used by the DatatypeValidatorFactory.
*/
virtual DatatypeValidator* newInstance(RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet);
protected:
// -----------------------------------------------------------------------
// implementation of (DateTimeValidator's) virtual interface
// -----------------------------------------------------------------------
virtual XMLDateTime* parse(const XMLCh* const);
};
/**
* End of file DayDatatypeValidator.hpp
*/
#endif
1.1 xml-xerces/c/src/validators/datatype/DurationDatatypeValidator.cpp
Index: DurationDatatypeValidator.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: DurationDatatypeValidator.cpp,v 1.1 2001/11/07 19:18:52 peiyongz Exp $
* $Log: DurationDatatypeValidator.cpp,v $
* Revision 1.1 2001/11/07 19:18:52 peiyongz
* DateTime Port
*
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#include <validators/datatype/DurationDatatypeValidator.hpp>
// ---------------------------------------------------------------------------
// Constructors and Destructor
// ---------------------------------------------------------------------------
DurationDatatypeValidator::DurationDatatypeValidator()
:DateTimeValidator(0, 0, 0, DatatypeValidator::Duration)
{}
DurationDatatypeValidator::DurationDatatypeValidator(
DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet)
:DateTimeValidator(baseValidator, facets, finalSet, DatatypeValidator::Duration)
{
init(enums);
}
DurationDatatypeValidator::~DurationDatatypeValidator()
{}
DatatypeValidator* DurationDatatypeValidator::newInstance(
RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet)
{
return (DatatypeValidator*) new DurationDatatypeValidator(this, facets, enums, finalSet);
}
//
// caller need to release the date created here
//
XMLDateTime* DurationDatatypeValidator::parse(const XMLCh* const content)
{
XMLDateTime *pRetDate = new XMLDateTime(content);
try
{
pRetDate->parseDuration();
}
catch (...)
{
delete pRetDate;
throw;
}
return pRetDate;
}
int DurationDatatypeValidator::compareDates(const XMLDateTime* const date1
, const XMLDateTime* const date2
, bool strict)
{
return XMLDateTime::compare(date1, date2, strict);
}
/**
* End of file DurationDatatypeValidator::cpp
*/
1.1 xml-xerces/c/src/validators/datatype/DurationDatatypeValidator.hpp
Index: DurationDatatypeValidator.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: DurationDatatypeValidator.hpp,v 1.1 2001/11/07 19:18:52 peiyongz Exp $
* $Log: DurationDatatypeValidator.hpp,v $
* Revision 1.1 2001/11/07 19:18:52 peiyongz
* DateTime Port
*
*/
#if !defined(DURATION_DATATYPE_VALIDATOR_HPP)
#define DURATION_DATATYPE_VALIDATOR_HPP
#include <validators/datatype/DateTimeValidator.hpp>
class VALIDATORS_EXPORT DurationDatatypeValidator : public DateTimeValidator
{
public:
// -----------------------------------------------------------------------
// Public ctor/dtor
// -----------------------------------------------------------------------
/** @name Constructor. */
//@{
DurationDatatypeValidator();
DurationDatatypeValidator(DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet);
~DurationDatatypeValidator();
//@}
/**
* Returns an instance of the base datatype validator class
* Used by the DatatypeValidatorFactory.
*/
virtual DatatypeValidator* newInstance(RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet);
protected:
// -----------------------------------------------------------------------
// implementation of (DateTimeValidator's) virtual interface
// -----------------------------------------------------------------------
virtual XMLDateTime* parse(const XMLCh* const);
virtual int compareDates(const XMLDateTime* const
, const XMLDateTime* const
, bool );
};
/**
* End of file DurationDatatypeValidator.hpp
*/
#endif
1.1 xml-xerces/c/src/validators/datatype/MonthDatatypeValidator.cpp
Index: MonthDatatypeValidator.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: MonthDatatypeValidator.cpp,v 1.1 2001/11/07 19:18:52 peiyongz Exp $
* $Log: MonthDatatypeValidator.cpp,v $
* Revision 1.1 2001/11/07 19:18:52 peiyongz
* DateTime Port
*
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#include <validators/datatype/MonthDatatypeValidator.hpp>
// ---------------------------------------------------------------------------
// Constructors and Destructor
// ---------------------------------------------------------------------------
MonthDatatypeValidator::MonthDatatypeValidator()
:DateTimeValidator(0, 0, 0, DatatypeValidator::Month)
{}
MonthDatatypeValidator::MonthDatatypeValidator(
DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet)
:DateTimeValidator(baseValidator, facets, finalSet, DatatypeValidator::Month)
{
init(enums);
}
MonthDatatypeValidator::~MonthDatatypeValidator()
{}
DatatypeValidator* MonthDatatypeValidator::newInstance(
RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet)
{
return (DatatypeValidator*) new MonthDatatypeValidator(this, facets, enums, finalSet);
}
//
// caller need to release the date created here
//
XMLDateTime* MonthDatatypeValidator::parse(const XMLCh* const content)
{
XMLDateTime *pRetDate = new XMLDateTime(content);
try
{
pRetDate->parseMonth();
}
catch (...)
{
delete pRetDate;
throw;
}
return pRetDate;
}
/**
* End of file MonthDatatypeValidator::cpp
*/
1.1 xml-xerces/c/src/validators/datatype/MonthDatatypeValidator.hpp
Index: MonthDatatypeValidator.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: MonthDatatypeValidator.hpp,v 1.1 2001/11/07 19:18:52 peiyongz Exp $
* $Log: MonthDatatypeValidator.hpp,v $
* Revision 1.1 2001/11/07 19:18:52 peiyongz
* DateTime Port
*
*/
#if !defined(MONTH_DATATYPE_VALIDATOR_HPP)
#define MONTH_DATATYPE_VALIDATOR_HPP
#include <validators/datatype/DateTimeValidator.hpp>
class VALIDATORS_EXPORT MonthDatatypeValidator : public DateTimeValidator
{
public:
// -----------------------------------------------------------------------
// Public ctor/dtor
// -----------------------------------------------------------------------
/** @name Constructor. */
//@{
MonthDatatypeValidator();
MonthDatatypeValidator(DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet);
~MonthDatatypeValidator();
//@}
/**
* Returns an instance of the base datatype validator class
* Used by the DatatypeValidatorFactory.
*/
virtual DatatypeValidator* newInstance(RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet);
protected:
// -----------------------------------------------------------------------
// implementation of (DateTimeValidator's) virtual interface
// -----------------------------------------------------------------------
virtual XMLDateTime* parse(const XMLCh* const);
};
/**
* End of file MonthDatatypeValidator.hpp
*/
#endif
1.1 xml-xerces/c/src/validators/datatype/MonthDayDatatypeValidator.cpp
Index: MonthDayDatatypeValidator.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: MonthDayDatatypeValidator.cpp,v 1.1 2001/11/07 19:18:52 peiyongz Exp $
* $Log: MonthDayDatatypeValidator.cpp,v $
* Revision 1.1 2001/11/07 19:18:52 peiyongz
* DateTime Port
*
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#include <validators/datatype/MonthDayDatatypeValidator.hpp>
// ---------------------------------------------------------------------------
// Constructors and Destructor
// ---------------------------------------------------------------------------
MonthDayDatatypeValidator::MonthDayDatatypeValidator()
:DateTimeValidator(0, 0, 0, DatatypeValidator::MonthDay)
{}
MonthDayDatatypeValidator::MonthDayDatatypeValidator(
DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet)
:DateTimeValidator(baseValidator, facets, finalSet, DatatypeValidator::MonthDay)
{
init(enums);
}
MonthDayDatatypeValidator::~MonthDayDatatypeValidator()
{}
DatatypeValidator* MonthDayDatatypeValidator::newInstance(
RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet)
{
return (DatatypeValidator*) new MonthDayDatatypeValidator(this, facets, enums, finalSet);
}
//
// caller need to release the date created here
//
XMLDateTime* MonthDayDatatypeValidator::parse(const XMLCh* const content)
{
XMLDateTime *pRetDate = new XMLDateTime(content);
try
{
pRetDate->parseMonthDay();
}
catch (...)
{
delete pRetDate;
throw;
}
return pRetDate;
}
/**
* End of file MonthDayDatatypeValidator::cpp
*/
1.1 xml-xerces/c/src/validators/datatype/MonthDayDatatypeValidator.hpp
Index: MonthDayDatatypeValidator.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: MonthDayDatatypeValidator.hpp,v 1.1 2001/11/07 19:18:52 peiyongz Exp $
* $Log: MonthDayDatatypeValidator.hpp,v $
* Revision 1.1 2001/11/07 19:18:52 peiyongz
* DateTime Port
*
*/
#if !defined(MONTHDAY_DATATYPE_VALIDATOR_HPP)
#define MONTHDAY_DATATYPE_VALIDATOR_HPP
#include <validators/datatype/DateTimeValidator.hpp>
class VALIDATORS_EXPORT MonthDayDatatypeValidator : public DateTimeValidator
{
public:
// -----------------------------------------------------------------------
// Public ctor/dtor
// -----------------------------------------------------------------------
/** @name Constructor. */
//@{
MonthDayDatatypeValidator();
MonthDayDatatypeValidator(DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet);
~MonthDayDatatypeValidator();
//@}
/**
* Returns an instance of the base datatype validator class
* Used by the DatatypeValidatorFactory.
*/
virtual DatatypeValidator* newInstance(RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet);
protected:
// -----------------------------------------------------------------------
// implementation of (DateTimeValidator's) virtual interface
// -----------------------------------------------------------------------
virtual XMLDateTime* parse(const XMLCh* const);
};
/**
* End of file MonthDayDatatypeValidator.hpp
*/
#endif
1.1 xml-xerces/c/src/validators/datatype/TimeDatatypeValidator.cpp
Index: TimeDatatypeValidator.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: TimeDatatypeValidator.cpp,v 1.1 2001/11/07 19:18:52 peiyongz Exp $
* $Log: TimeDatatypeValidator.cpp,v $
* Revision 1.1 2001/11/07 19:18:52 peiyongz
* DateTime Port
*
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#include <validators/datatype/TimeDatatypeValidator.hpp>
// ---------------------------------------------------------------------------
// Constructors and Destructor
// ---------------------------------------------------------------------------
TimeDatatypeValidator::TimeDatatypeValidator()
:DateTimeValidator(0, 0, 0, DatatypeValidator::Time)
{}
TimeDatatypeValidator::TimeDatatypeValidator(
DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet)
:DateTimeValidator(baseValidator, facets, finalSet, DatatypeValidator::Time)
{
init(enums);
}
TimeDatatypeValidator::~TimeDatatypeValidator()
{}
DatatypeValidator* TimeDatatypeValidator::newInstance(
RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet)
{
return (DatatypeValidator*) new TimeDatatypeValidator(this, facets, enums, finalSet);
}
//
// caller need to release the date created here
//
XMLDateTime* TimeDatatypeValidator::parse(const XMLCh* const content)
{
XMLDateTime *pRetDate = new XMLDateTime(content);
try
{
pRetDate->parseTime();
}
catch (...)
{
delete pRetDate;
throw;
}
return pRetDate;
}
/**
* End of file TimeDatatypeValidator::cpp
*/
1.1 xml-xerces/c/src/validators/datatype/TimeDatatypeValidator.hpp
Index: TimeDatatypeValidator.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: TimeDatatypeValidator.hpp,v 1.1 2001/11/07 19:18:52 peiyongz Exp $
* $Log: TimeDatatypeValidator.hpp,v $
* Revision 1.1 2001/11/07 19:18:52 peiyongz
* DateTime Port
*
*/
#if !defined(TIME_DATATYPE_VALIDATOR_HPP)
#define TIME_DATATYPE_VALIDATOR_HPP
#include <validators/datatype/DateTimeValidator.hpp>
#include <util/RefVectorOf.hpp>
class VALIDATORS_EXPORT TimeDatatypeValidator : public DateTimeValidator
{
public:
// -----------------------------------------------------------------------
// Public ctor/dtor
// -----------------------------------------------------------------------
/** @name Constructor. */
//@{
TimeDatatypeValidator();
TimeDatatypeValidator(DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet);
~TimeDatatypeValidator();
//@}
/**
* Returns an instance of the base datatype validator class
* Used by the DatatypeValidatorFactory.
*/
virtual DatatypeValidator* newInstance(RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet);
protected:
// -----------------------------------------------------------------------
// implementation of (DateTimeValidator's) virtual interface
// -----------------------------------------------------------------------
virtual XMLDateTime* parse(const XMLCh* const);
};
/**
* End of file TimeDatatypeValidator.hpp
*/
#endif
1.1 xml-xerces/c/src/validators/datatype/YearDatatypeValidator.cpp
Index: YearDatatypeValidator.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: YearDatatypeValidator.cpp,v 1.1 2001/11/07 19:18:52 peiyongz Exp $
* $Log: YearDatatypeValidator.cpp,v $
* Revision 1.1 2001/11/07 19:18:52 peiyongz
* DateTime Port
*
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#include <validators/datatype/YearDatatypeValidator.hpp>
// ---------------------------------------------------------------------------
// Constructors and Destructor
// ---------------------------------------------------------------------------
YearDatatypeValidator::YearDatatypeValidator()
:DateTimeValidator(0, 0, 0, DatatypeValidator::Year)
{}
YearDatatypeValidator::YearDatatypeValidator(
DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet)
:DateTimeValidator(baseValidator, facets, finalSet, DatatypeValidator::Year)
{
init(enums);
}
YearDatatypeValidator::~YearDatatypeValidator()
{}
DatatypeValidator* YearDatatypeValidator::newInstance(
RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet)
{
return (DatatypeValidator*) new YearDatatypeValidator(this, facets, enums, finalSet);
}
//
// caller need to release the date created here
//
XMLDateTime* YearDatatypeValidator::parse(const XMLCh* const content)
{
XMLDateTime *pRetDate = new XMLDateTime(content);
try
{
pRetDate->parseYear();
}
catch (...)
{
delete pRetDate;
throw;
}
return pRetDate;
}
/**
* End of file YearDatatypeValidator::cpp
*/
1.1 xml-xerces/c/src/validators/datatype/YearDatatypeValidator.hpp
Index: YearDatatypeValidator.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: YearDatatypeValidator.hpp,v 1.1 2001/11/07 19:18:52 peiyongz Exp $
* $Log: YearDatatypeValidator.hpp,v $
* Revision 1.1 2001/11/07 19:18:52 peiyongz
* DateTime Port
*
*/
#if !defined(YEAR_DATATYPE_VALIDATOR_HPP)
#define YEAR_DATATYPE_VALIDATOR_HPP
#include <validators/datatype/DateTimeValidator.hpp>
class VALIDATORS_EXPORT YearDatatypeValidator : public DateTimeValidator
{
public:
// -----------------------------------------------------------------------
// Public ctor/dtor
// -----------------------------------------------------------------------
/** @name Constructor. */
//@{
YearDatatypeValidator();
YearDatatypeValidator(DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet);
~YearDatatypeValidator();
//@}
/**
* Returns an instance of the base datatype validator class
* Used by the DatatypeValidatorFactory.
*/
virtual DatatypeValidator* newInstance(RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet);
protected:
// -----------------------------------------------------------------------
// implementation of (DateTimeValidator's) virtual interface
// -----------------------------------------------------------------------
virtual XMLDateTime* parse(const XMLCh* const);
};
/**
* End of file YearDatatypeValidator.hpp
*/
#endif
1.1 xml-xerces/c/src/validators/datatype/YearMonthDatatypeValidator.cpp
Index: YearMonthDatatypeValidator.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: YearMonthDatatypeValidator.cpp,v 1.1 2001/11/07 19:18:52 peiyongz Exp $
* $Log: YearMonthDatatypeValidator.cpp,v $
* Revision 1.1 2001/11/07 19:18:52 peiyongz
* DateTime Port
*
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#include <validators/datatype/YearMonthDatatypeValidator.hpp>
// ---------------------------------------------------------------------------
// Constructors and Destructor
// ---------------------------------------------------------------------------
YearMonthDatatypeValidator::YearMonthDatatypeValidator()
:DateTimeValidator(0, 0, 0, DatatypeValidator::YearMonth)
{}
YearMonthDatatypeValidator::YearMonthDatatypeValidator(
DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet)
:DateTimeValidator(baseValidator, facets, finalSet, DatatypeValidator::YearMonth)
{
init(enums);
}
YearMonthDatatypeValidator::~YearMonthDatatypeValidator()
{}
DatatypeValidator* YearMonthDatatypeValidator::newInstance(
RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet)
{
return (DatatypeValidator*) new YearMonthDatatypeValidator(this, facets, enums, finalSet);
}
//
// caller need to release the date created here
//
XMLDateTime* YearMonthDatatypeValidator::parse(const XMLCh* const content)
{
XMLDateTime *pRetDate = new XMLDateTime(content);
try
{
pRetDate->parseYearMonth();
}
catch (...)
{
delete pRetDate;
throw;
}
return pRetDate;
}
/**
* End of file YearMonthDatatypeValidator::cpp
*/
1.1 xml-xerces/c/src/validators/datatype/YearMonthDatatypeValidator.hpp
Index: YearMonthDatatypeValidator.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: YearMonthDatatypeValidator.hpp,v 1.1 2001/11/07 19:18:52 peiyongz Exp $
* $Log: YearMonthDatatypeValidator.hpp,v $
* Revision 1.1 2001/11/07 19:18:52 peiyongz
* DateTime Port
*
*/
#if !defined(YEARMONTH_DATATYPE_VALIDATOR_HPP)
#define YEARMONTH_DATATYPE_VALIDATOR_HPP
#include <validators/datatype/DateTimeValidator.hpp>
class VALIDATORS_EXPORT YearMonthDatatypeValidator : public DateTimeValidator
{
public:
// -----------------------------------------------------------------------
// Public ctor/dtor
// -----------------------------------------------------------------------
/** @name Constructor. */
//@{
YearMonthDatatypeValidator();
YearMonthDatatypeValidator(DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet);
~YearMonthDatatypeValidator();
//@}
/**
* Returns an instance of the base datatype validator class
* Used by the DatatypeValidatorFactory.
*/
virtual DatatypeValidator* newInstance(RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet);
protected:
// -----------------------------------------------------------------------
// implementation of (DateTimeValidator's) virtual interface
// -----------------------------------------------------------------------
virtual XMLDateTime* parse(const XMLCh* const);
};
/**
* End of file YearMonthDatatypeValidator.hpp
*/
#endif
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org