/**************************************************************************** ** ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtXmlPatterns of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the either Technology Preview License Agreement or the ** Beta Release License Agreement. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain ** additional rights. These rights are described in the Nokia Qt LGPL ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this ** package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please ** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. #ifndef Patternist_XsdFacet_H #define Patternist_XsdFacet_H #include "qitem_p.h" #include "qnamedschemacomponent_p.h" #include "qxsdannotated_p.h" #include "qxsdassertion_p.h" #include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE namespace QPatternist { /** * @short Represents a XSD facet object. * * This class represents one of the following XML schema objects: * * * * @see XML Schema API reference * @ingroup Patternist_schema * @author Tobias Koenig */ class XsdFacet : public NamedSchemaComponent, public XsdAnnotated { public: typedef QExplicitlySharedDataPointer Ptr; /** * Describes the type of the facet. */ enum Type { None = 0, ///< An invalid facet. Length = 1 << 0, ///< Match the exact length (Length Definition) MinimumLength = 1 << 1, ///< Match the minimum length (Minimum Length Definition) MaximumLength = 1 << 2, ///< Match the maximum length (Maximum Length Definition) Pattern = 1 << 3, ///< Match a regular expression (Pattern Definition) WhiteSpace = 1 << 4, ///< Match a whitespace rule (White Space Definition) MaximumInclusive = 1 << 5, ///< Match a maximum inclusive (Maximum Inclusive Definition) MaximumExclusive = 1 << 6, ///< Match a maximum exclusive (Maximum Exclusive Definition) MinimumInclusive = 1 << 7, ///< Match a minimum inclusive (Minimum Inclusive Definition) MinimumExclusive = 1 << 8, ///< Match a minimum exclusive (Minimum Exclusive Definition) TotalDigits = 1 << 9, ///< Match some integer digits (Total Digits Definition) FractionDigits = 1 << 10, ///< Match some double digits (Fraction Digits Definition) Enumeration = 1 << 11, ///< Match an enumeration (Enumeration Definition) Assertion = 1 << 12, ///< Match an assertion (Assertion Definition) }; typedef QHash Hash; typedef QHashIterator HashIterator; /** * Creates a new facet object of type None. */ XsdFacet(); /** * Sets the @p type of the facet. * * @see Type */ void setType(Type type); /** * Returns the type of the facet. */ Type type() const; /** * Sets the @p value of the facet. * * Depending on the type of the facet the * value can be a string, interger, double etc. * * @note This method should be used for all types of facets * except Pattern, Enumeration and Assertion. */ void setValue(const AtomicValue::Ptr &value); /** * Returns the value of the facet or an empty pointer if facet * type is Pattern, Enumeration or Assertion. */ AtomicValue::Ptr value() const; /** * Sets the @p value of the facet. * * @note This method should be used for if the type of the * facet is Pattern or Enumeration. */ void setMultiValue(const AtomicValue::List &value); /** * Returns the value of the facet or an empty pointer if facet * type is not of type Pattern or Enumeration. */ AtomicValue::List multiValue() const; /** * Sets the @p assertions of the facet. * * @note This method should be used if the type of the * facet is Assertion. */ void setAssertions(const XsdAssertion::List &assertions); /** * Returns the assertions of the facet or an empty pointer if facet * type is not of type Assertion. */ XsdAssertion::List assertions() const; /** * Sets whether the facet is @p fixed. * * All facets except pattern, enumeration and assertion can be fixed. */ void setFixed(bool fixed); /** * Returns whether the facet is fixed. */ bool fixed() const; /** * Returns the textual description of the facet @p type. */ static QString typeName(Type type); private: Type m_type; AtomicValue::Ptr m_value; AtomicValue::List m_multiValue; XsdAssertion::List m_assertions; bool m_fixed; }; } QT_END_NAMESPACE QT_END_HEADER #endif