From 2fc01f7a270d76177e8653e2b74f8ca1b7711cc3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 17 Mar 2010 13:10:42 +0200 Subject: Partial support for simple type facet validation For now only certain types and facets are supported. --- .../cxx/parser/validating/xml-schema-pskel.hxx | 180 ++++++++++++++++++++- 1 file changed, 174 insertions(+), 6 deletions(-) (limited to 'libxsde/xsde/cxx/parser/validating/xml-schema-pskel.hxx') diff --git a/libxsde/xsde/cxx/parser/validating/xml-schema-pskel.hxx b/libxsde/xsde/cxx/parser/validating/xml-schema-pskel.hxx index 1c82e00..24a7759 100644 --- a/libxsde/xsde/cxx/parser/validating/xml-schema-pskel.hxx +++ b/libxsde/xsde/cxx/parser/validating/xml-schema-pskel.hxx @@ -159,13 +159,40 @@ namespace xsde _dynamic_type () const; #endif -#ifdef XSDE_REUSE_STYLE_TIEIN unsigned_byte_pskel (); + +#ifdef XSDE_REUSE_STYLE_TIEIN unsigned_byte_pskel (unsigned_byte_pskel* impl, void*); protected: unsigned_byte_pskel* unsigned_byte_impl_; #endif + // Facets. + // + public: + void + _max_facet (unsigned char, bool inclusive); + + void + _min_facet (unsigned char, bool inclusive); + + protected: + struct facets + { + unsigned char min_; + unsigned char max_; + + unsigned int min_set_ : 1; + unsigned int min_inc_ : 1; + unsigned int max_set_ : 1; + unsigned int max_inc_ : 1; + }; + + const facets& + _facets () const; + + private: + facets facets_; }; @@ -185,13 +212,40 @@ namespace xsde _dynamic_type () const; #endif -#ifdef XSDE_REUSE_STYLE_TIEIN short_pskel (); + +#ifdef XSDE_REUSE_STYLE_TIEIN short_pskel (short_pskel* impl, void*); protected: short_pskel* short_impl_; #endif + // Facets. + // + public: + void + _max_facet (short, bool inclusive); + + void + _min_facet (short, bool inclusive); + + protected: + struct facets + { + short min_; + short max_; + + unsigned int min_set_ : 1; + unsigned int min_inc_ : 1; + unsigned int max_set_ : 1; + unsigned int max_inc_ : 1; + }; + + const facets& + _facets () const; + + private: + facets facets_; }; struct unsigned_short_pskel: simple_content @@ -207,13 +261,40 @@ namespace xsde _dynamic_type () const; #endif -#ifdef XSDE_REUSE_STYLE_TIEIN unsigned_short_pskel (); + +#ifdef XSDE_REUSE_STYLE_TIEIN unsigned_short_pskel (unsigned_short_pskel* impl, void*); protected: unsigned_short_pskel* unsigned_short_impl_; #endif + // Facets. + // + public: + void + _max_facet (unsigned short, bool inclusive); + + void + _min_facet (unsigned short, bool inclusive); + + protected: + struct facets + { + unsigned short min_; + unsigned short max_; + + unsigned int min_set_ : 1; + unsigned int min_inc_ : 1; + unsigned int max_set_ : 1; + unsigned int max_inc_ : 1; + }; + + const facets& + _facets () const; + + private: + facets facets_; }; @@ -255,13 +336,40 @@ namespace xsde _dynamic_type () const; #endif -#ifdef XSDE_REUSE_STYLE_TIEIN unsigned_int_pskel (); + +#ifdef XSDE_REUSE_STYLE_TIEIN unsigned_int_pskel (unsigned_int_pskel* impl, void*); protected: unsigned_int_pskel* unsigned_int_impl_; #endif + // Facets. + // + public: + void + _max_facet (unsigned int, bool inclusive); + + void + _min_facet (unsigned int, bool inclusive); + + protected: + struct facets + { + unsigned int min_; + unsigned int max_; + + unsigned int min_set_ : 1; + unsigned int min_inc_ : 1; + unsigned int max_set_ : 1; + unsigned int max_inc_ : 1; + }; + + const facets& + _facets () const; + + private: + facets facets_; }; @@ -562,13 +670,43 @@ namespace xsde _dynamic_type () const; #endif -#ifdef XSDE_REUSE_STYLE_TIEIN string_pskel (); + +#ifdef XSDE_REUSE_STYLE_TIEIN string_pskel (string_pskel* impl, void*); protected: string_pskel* string_impl_; #endif + // Facets. + // + public: + void + _length_facet (size_t); + + void + _max_length_facet (size_t); + + void + _min_length_facet (size_t); + + protected: + struct facets + { + size_t length_; + size_t min_length_; + size_t max_length_; + + unsigned int length_set_ : 1; + unsigned int min_length_set_ : 1; + unsigned int max_length_set_ : 1; + }; + + const facets& + _facets () const; + + private: + facets facets_; }; struct normalized_string_pskel: simple_content @@ -853,13 +991,43 @@ namespace xsde _dynamic_type () const; #endif -#ifdef XSDE_REUSE_STYLE_TIEIN string_pskel (); + +#ifdef XSDE_REUSE_STYLE_TIEIN string_pskel (string_pskel* impl, void*); protected: string_pskel* string_impl_; #endif + // Facets. + // + public: + void + _length_facet (size_t); + + void + _max_length_facet (size_t); + + void + _min_length_facet (size_t); + + protected: + struct facets + { + size_t length_; + size_t min_length_; + size_t max_length_; + + unsigned int length_set_ : 1; + unsigned int min_length_set_ : 1; + unsigned int max_length_set_ : 1; + }; + + const facets& + _facets () const; + + private: + facets facets_; }; struct normalized_string_pskel: simple_content -- cgit v1.1