diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-10-12 11:26:08 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-10-12 11:26:08 +0200 |
commit | 51231f66aee0bbbd14d361d9e8e0009e99d57974 (patch) | |
tree | 00bf887154f994e6156108c4e79b747007af8efa /libxsde | |
parent | 9553149aa6b6561c49981adf2848607a43765054 (diff) |
Finish {min,max}{Exclusive,Inclusive} facets support
New test: hybrid/facets.
Diffstat (limited to 'libxsde')
32 files changed, 2129 insertions, 78 deletions
diff --git a/libxsde/xsde/cxx/parser/validating/byte.cxx b/libxsde/xsde/cxx/parser/validating/byte.cxx index c592f43..9e611b1 100644 --- a/libxsde/xsde/cxx/parser/validating/byte.cxx +++ b/libxsde/xsde/cxx/parser/validating/byte.cxx @@ -54,6 +54,24 @@ namespace xsde value_ = neg ? static_cast<signed char> (-static_cast<short> (ul)) : static_cast<signed char> (ul); + + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } } else _schema_error (schema_error::invalid_byte_value); @@ -68,4 +86,3 @@ namespace xsde } } } - diff --git a/libxsde/xsde/cxx/parser/validating/decimal.cxx b/libxsde/xsde/cxx/parser/validating/decimal.cxx index 5ce64e5..3fa3166 100644 --- a/libxsde/xsde/cxx/parser/validating/decimal.cxx +++ b/libxsde/xsde/cxx/parser/validating/decimal.cxx @@ -58,6 +58,24 @@ namespace xsde if (sign_ == minus) value_ = -value_; } + + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } } else _schema_error (schema_error::invalid_decimal_value); diff --git a/libxsde/xsde/cxx/parser/validating/double.cxx b/libxsde/xsde/cxx/parser/validating/double.cxx index 0d1acfd..fbb7072 100644 --- a/libxsde/xsde/cxx/parser/validating/double.cxx +++ b/libxsde/xsde/cxx/parser/validating/double.cxx @@ -83,6 +83,24 @@ namespace xsde if (sign_ == minus) value_ = -value_; } + + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } } else _schema_error (schema_error::invalid_double_value); diff --git a/libxsde/xsde/cxx/parser/validating/float.cxx b/libxsde/xsde/cxx/parser/validating/float.cxx index 4a7cf72..7a5d1f6 100644 --- a/libxsde/xsde/cxx/parser/validating/float.cxx +++ b/libxsde/xsde/cxx/parser/validating/float.cxx @@ -102,6 +102,24 @@ namespace xsde if (sign_ == minus) value_ = -value_; } + + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } } else _schema_error (schema_error::invalid_float_value); diff --git a/libxsde/xsde/cxx/parser/validating/int.cxx b/libxsde/xsde/cxx/parser/validating/int.cxx index bf96032..531883e 100644 --- a/libxsde/xsde/cxx/parser/validating/int.cxx +++ b/libxsde/xsde/cxx/parser/validating/int.cxx @@ -59,6 +59,25 @@ namespace xsde ? (-2147483647 - 1) : -static_cast<int> (ul)) : static_cast<int> (ul); + + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } + } else _schema_error (schema_error::invalid_int_value); diff --git a/libxsde/xsde/cxx/parser/validating/integer.cxx b/libxsde/xsde/cxx/parser/validating/integer.cxx index a2c3314..e85b9a2 100644 --- a/libxsde/xsde/cxx/parser/validating/integer.cxx +++ b/libxsde/xsde/cxx/parser/validating/integer.cxx @@ -59,6 +59,24 @@ namespace xsde ? (ul == static_cast<unsigned long> (LONG_MIN) ? LONG_MIN: -static_cast<long> (ul)) : static_cast<long> (ul); + + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } } else _schema_error (schema_error::invalid_integer_value); diff --git a/libxsde/xsde/cxx/parser/validating/long-long.cxx b/libxsde/xsde/cxx/parser/validating/long-long.cxx index ecb3b57..4bb3247 100644 --- a/libxsde/xsde/cxx/parser/validating/long-long.cxx +++ b/libxsde/xsde/cxx/parser/validating/long-long.cxx @@ -59,6 +59,24 @@ namespace xsde ? (-9223372036854775807LL - 1) : -static_cast<long long> (ull)) : static_cast<long long> (ull); + + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } } else _schema_error (schema_error::invalid_long_value); diff --git a/libxsde/xsde/cxx/parser/validating/long.cxx b/libxsde/xsde/cxx/parser/validating/long.cxx index 675312f..1bafc06 100644 --- a/libxsde/xsde/cxx/parser/validating/long.cxx +++ b/libxsde/xsde/cxx/parser/validating/long.cxx @@ -59,6 +59,24 @@ namespace xsde ? (-2147483647 - 1) : -static_cast<long> (ul)) : static_cast<long> (ul); + + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } } else _schema_error (schema_error::invalid_long_value); diff --git a/libxsde/xsde/cxx/parser/validating/negative-integer.cxx b/libxsde/xsde/cxx/parser/validating/negative-integer.cxx index 3087558..1cfbdcd 100644 --- a/libxsde/xsde/cxx/parser/validating/negative-integer.cxx +++ b/libxsde/xsde/cxx/parser/validating/negative-integer.cxx @@ -55,6 +55,24 @@ namespace xsde value_ = ul == static_cast<unsigned long> (LONG_MIN) ? LONG_MIN : -static_cast<long> (ul); + + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } } else _schema_error (schema_error::invalid_negative_integer_value); diff --git a/libxsde/xsde/cxx/parser/validating/non-negative-integer.cxx b/libxsde/xsde/cxx/parser/validating/non-negative-integer.cxx index 215028a..531c1e2 100644 --- a/libxsde/xsde/cxx/parser/validating/non-negative-integer.cxx +++ b/libxsde/xsde/cxx/parser/validating/non-negative-integer.cxx @@ -50,6 +50,24 @@ namespace xsde get_errno () != 0 || (sign_ == minus && value_ != 0)) _schema_error (schema_error::invalid_non_negative_integer_value); + + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } } else _schema_error (schema_error::invalid_non_negative_integer_value); diff --git a/libxsde/xsde/cxx/parser/validating/non-positive-integer.cxx b/libxsde/xsde/cxx/parser/validating/non-positive-integer.cxx index c834698..3d817e7 100644 --- a/libxsde/xsde/cxx/parser/validating/non-positive-integer.cxx +++ b/libxsde/xsde/cxx/parser/validating/non-positive-integer.cxx @@ -55,6 +55,24 @@ namespace xsde value_ = ul == static_cast<unsigned long> (LONG_MIN) ? LONG_MIN : -static_cast<long> (ul); + + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } } else _schema_error (schema_error::invalid_non_positive_integer_value); diff --git a/libxsde/xsde/cxx/parser/validating/positive-integer.cxx b/libxsde/xsde/cxx/parser/validating/positive-integer.cxx index 5eb020d..bd11b3a 100644 --- a/libxsde/xsde/cxx/parser/validating/positive-integer.cxx +++ b/libxsde/xsde/cxx/parser/validating/positive-integer.cxx @@ -48,6 +48,24 @@ namespace xsde if (*p != '\0' || get_errno () != 0 || value_ == 0) _schema_error (schema_error::invalid_positive_integer_value); + + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } } else _schema_error (schema_error::invalid_positive_integer_value); diff --git a/libxsde/xsde/cxx/parser/validating/unsigned-long-long.cxx b/libxsde/xsde/cxx/parser/validating/unsigned-long-long.cxx index 69305fe..9ab1a8a 100644 --- a/libxsde/xsde/cxx/parser/validating/unsigned-long-long.cxx +++ b/libxsde/xsde/cxx/parser/validating/unsigned-long-long.cxx @@ -48,6 +48,24 @@ namespace xsde if (*p != '\0' || get_errno () != 0) _schema_error (schema_error::invalid_unsigned_long_value); + + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } } else _schema_error (schema_error::invalid_unsigned_long_value); diff --git a/libxsde/xsde/cxx/parser/validating/unsigned-long.cxx b/libxsde/xsde/cxx/parser/validating/unsigned-long.cxx index 7c7297b..9e90601 100644 --- a/libxsde/xsde/cxx/parser/validating/unsigned-long.cxx +++ b/libxsde/xsde/cxx/parser/validating/unsigned-long.cxx @@ -48,6 +48,24 @@ namespace xsde if (*p != '\0' || get_errno () != 0) _schema_error (schema_error::invalid_unsigned_long_value); + + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } } else _schema_error (schema_error::invalid_unsigned_long_value); diff --git a/libxsde/xsde/cxx/parser/validating/xml-schema-pskel.hxx b/libxsde/xsde/cxx/parser/validating/xml-schema-pskel.hxx index 8823846..f794188 100644 --- a/libxsde/xsde/cxx/parser/validating/xml-schema-pskel.hxx +++ b/libxsde/xsde/cxx/parser/validating/xml-schema-pskel.hxx @@ -140,14 +140,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + byte_pskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - byte_pskel (); byte_pskel (byte_pskel* impl, void*); protected: byte_pskel* byte_impl_; #endif + // Facets. + // + public: + void + _max_facet (signed char, bool inclusive); + + void + _min_facet (signed char, bool inclusive); + + protected: + struct facets + { + signed char min_; + signed 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_; }; struct unsigned_byte_pskel: simple_content @@ -317,14 +343,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + int_pskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - int_pskel (); int_pskel (int_pskel* impl, void*); protected: int_pskel* int_impl_; #endif + // Facets. + // + public: + void + _max_facet (int, bool inclusive); + + void + _min_facet (int, bool inclusive); + + protected: + struct facets + { + int min_; + 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_; }; struct unsigned_int_pskel: simple_content @@ -393,14 +445,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + long_pskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - long_pskel (); long_pskel (long_pskel* impl, void*); protected: long_pskel* long_impl_; #endif + // Facets. + // + public: + void + _max_facet (long long, bool inclusive); + + void + _min_facet (long long, bool inclusive); + + protected: + struct facets + { + long long min_; + long long 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_long_pskel: simple_content @@ -415,14 +493,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + unsigned_long_pskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - unsigned_long_pskel (); unsigned_long_pskel (unsigned_long_pskel* impl, void*); protected: unsigned_long_pskel* unsigned_long_impl_; #endif + // Facets. + // + public: + void + _max_facet (unsigned long long, bool inclusive); + + void + _min_facet (unsigned long long, bool inclusive); + + protected: + struct facets + { + unsigned long long min_; + unsigned long long 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_; }; #else @@ -439,14 +543,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + long_pskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - long_pskel (); long_pskel (long_pskel* impl, void*); protected: long_pskel* long_impl_; #endif + // Facets. + // + public: + void + _max_facet (long, bool inclusive); + + void + _min_facet (long, bool inclusive); + + protected: + struct facets + { + long min_; + long 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_long_pskel: simple_content @@ -461,14 +591,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + unsigned_long_pskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - unsigned_long_pskel (); unsigned_long_pskel (unsigned_long_pskel* impl, void*); protected: unsigned_long_pskel* unsigned_long_impl_; #endif + // Facets. + // + public: + void + _max_facet (unsigned long, bool inclusive); + + void + _min_facet (unsigned long, bool inclusive); + + protected: + struct facets + { + unsigned long min_; + unsigned long 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_; }; #endif @@ -488,14 +644,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + integer_pskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - integer_pskel (); integer_pskel (integer_pskel* impl, void*); protected: integer_pskel* integer_impl_; #endif + // Facets. + // + public: + void + _max_facet (long, bool inclusive); + + void + _min_facet (long, bool inclusive); + + protected: + struct facets + { + long min_; + long 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 negative_integer_pskel: simple_content @@ -510,14 +692,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + negative_integer_pskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - negative_integer_pskel (); negative_integer_pskel (negative_integer_pskel* impl, void*); protected: negative_integer_pskel* negative_integer_impl_; #endif + // Facets. + // + public: + void + _max_facet (long, bool inclusive); + + void + _min_facet (long, bool inclusive); + + protected: + struct facets + { + long min_; + long 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 non_positive_integer_pskel: simple_content @@ -532,14 +740,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + non_positive_integer_pskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - non_positive_integer_pskel (); non_positive_integer_pskel (non_positive_integer_pskel* impl, void*); protected: non_positive_integer_pskel* non_positive_integer_impl_; #endif + // Facets. + // + public: + void + _max_facet (long, bool inclusive); + + void + _min_facet (long, bool inclusive); + + protected: + struct facets + { + long min_; + long 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 positive_integer_pskel: simple_content @@ -554,14 +788,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + positive_integer_pskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - positive_integer_pskel (); positive_integer_pskel (positive_integer_pskel* impl, void*); protected: positive_integer_pskel* positive_integer_impl_; #endif + // Facets. + // + public: + void + _max_facet (unsigned long, bool inclusive); + + void + _min_facet (unsigned long, bool inclusive); + + protected: + struct facets + { + unsigned long min_; + unsigned long 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 non_negative_integer_pskel: simple_content @@ -576,14 +836,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + non_negative_integer_pskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - non_negative_integer_pskel (); non_negative_integer_pskel (non_negative_integer_pskel* impl, void*); protected: non_negative_integer_pskel* non_negative_integer_impl_; #endif + // Facets. + // + public: + void + _max_facet (unsigned long, bool inclusive); + + void + _min_facet (unsigned long, bool inclusive); + + protected: + struct facets + { + unsigned long min_; + unsigned long 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_; }; @@ -602,14 +888,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + float_pskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - float_pskel (); float_pskel (float_pskel* impl, void*); protected: float_pskel* float_impl_; #endif + // Facets. + // + public: + void + _max_facet (float, bool inclusive); + + void + _min_facet (float, bool inclusive); + + protected: + struct facets + { + float min_; + float 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 double_pskel: simple_content @@ -624,14 +936,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + double_pskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - double_pskel (); double_pskel (double_pskel* impl, void*); protected: double_pskel* double_impl_; #endif + // Facets. + // + public: + void + _max_facet (double, bool inclusive); + + void + _min_facet (double, bool inclusive); + + protected: + struct facets + { + double min_; + double 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 decimal_pskel: simple_content @@ -646,14 +984,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + decimal_pskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - decimal_pskel (); decimal_pskel (decimal_pskel* impl, void*); protected: decimal_pskel* decimal_impl_; #endif + // Facets. + // + public: + void + _max_facet (double, bool inclusive); + + void + _min_facet (double, bool inclusive); + + protected: + struct facets + { + double min_; + double 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_; }; diff --git a/libxsde/xsde/cxx/parser/validating/xml-schema-pskel.ixx b/libxsde/xsde/cxx/parser/validating/xml-schema-pskel.ixx index a9d01f1..8cc8597 100644 --- a/libxsde/xsde/cxx/parser/validating/xml-schema-pskel.ixx +++ b/libxsde/xsde/cxx/parser/validating/xml-schema-pskel.ixx @@ -61,20 +61,53 @@ namespace xsde // byte_pskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline byte_pskel:: byte_pskel () - : byte_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + byte_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline byte_pskel:: byte_pskel (byte_pskel* impl, void*) : simple_content (impl, 0), byte_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; } #endif + inline void byte_pskel:: + _max_facet (signed char v, bool inc) + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void byte_pskel:: + _min_facet (signed char v, bool inc) + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; + } + + inline const byte_pskel::facets& byte_pskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const byte_pskel&> (*parent_).facets_; + else +#endif + return facets_; + } + // unsigned_byte_pskel // inline unsigned_byte_pskel:: @@ -223,20 +256,53 @@ namespace xsde // int_pskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline int_pskel:: int_pskel () - : int_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + int_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline int_pskel:: int_pskel (int_pskel* impl, void*) : simple_content (impl, 0), int_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; } #endif + inline void int_pskel:: + _max_facet (int v, bool inc) + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void int_pskel:: + _min_facet (int v, bool inc) + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; + } + + inline const int_pskel::facets& int_pskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const int_pskel&> (*parent_).facets_; + else +#endif + return facets_; + } + // unsigned_int_pskel // inline unsigned_int_pskel:: @@ -288,163 +354,508 @@ namespace xsde // long_pskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline long_pskel:: long_pskel () - : long_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + long_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline long_pskel:: long_pskel (long_pskel* impl, void*) : simple_content (impl, 0), long_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; + } +#endif + + inline void long_pskel:: +#ifdef XSDE_LONGLONG + _max_facet (long long v, bool inc) +#else + _max_facet (long v, bool inc) +#endif + + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; } + + inline void long_pskel:: +#ifdef XSDE_LONGLONG + _min_facet (long long v, bool inc) +#else + _min_facet (long v, bool inc) #endif + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; + } + + inline const long_pskel::facets& long_pskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const long_pskel&> (*parent_).facets_; + else +#endif + return facets_; + } // unsigned_long_pskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline unsigned_long_pskel:: unsigned_long_pskel () - : unsigned_long_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + unsigned_long_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline unsigned_long_pskel:: unsigned_long_pskel (unsigned_long_pskel* impl, void*) : simple_content (impl, 0), unsigned_long_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; + } +#endif + + inline void unsigned_long_pskel:: +#ifdef XSDE_LONGLONG + _max_facet (unsigned long long v, bool inc) +#else + _max_facet (unsigned long v, bool inc) +#endif + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void unsigned_long_pskel:: +#ifdef XSDE_LONGLONG + _min_facet (unsigned long long v, bool inc) +#else + _min_facet (unsigned long v, bool inc) +#endif + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; } + + inline const unsigned_long_pskel::facets& unsigned_long_pskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const unsigned_long_pskel&> (*parent_).facets_; + else #endif + return facets_; + } // integer_pskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline integer_pskel:: integer_pskel () - : integer_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + integer_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline integer_pskel:: integer_pskel (integer_pskel* impl, void*) : simple_content (impl, 0), integer_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; + } +#endif + inline void integer_pskel:: + _max_facet (long v, bool inc) + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void integer_pskel:: + _min_facet (long v, bool inc) + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; } + + inline const integer_pskel::facets& integer_pskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const integer_pskel&> (*parent_).facets_; + else #endif + return facets_; + } // negative_integer_pskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline negative_integer_pskel:: negative_integer_pskel () - : negative_integer_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + negative_integer_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline negative_integer_pskel:: negative_integer_pskel (negative_integer_pskel* impl, void*) : simple_content (impl, 0), negative_integer_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; } #endif + inline void negative_integer_pskel:: + _max_facet (long v, bool inc) + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void negative_integer_pskel:: + _min_facet (long v, bool inc) + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; + } + + inline const negative_integer_pskel::facets& negative_integer_pskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const negative_integer_pskel&> ( + *parent_).facets_; + else +#endif + return facets_; + } // non_positive_integer_pskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline non_positive_integer_pskel:: non_positive_integer_pskel () - : non_positive_integer_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + non_positive_integer_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline non_positive_integer_pskel:: non_positive_integer_pskel (non_positive_integer_pskel* impl, void*) : simple_content (impl, 0), non_positive_integer_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; + } +#endif + inline void non_positive_integer_pskel:: + _max_facet (long v, bool inc) + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void non_positive_integer_pskel:: + _min_facet (long v, bool inc) + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; } + + inline const non_positive_integer_pskel::facets& + non_positive_integer_pskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const non_positive_integer_pskel&> ( + *parent_).facets_; + else #endif + return facets_; + } // positive_integer_pskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline positive_integer_pskel:: positive_integer_pskel () - : positive_integer_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + positive_integer_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline positive_integer_pskel:: positive_integer_pskel (positive_integer_pskel* impl, void*) : simple_content (impl, 0), positive_integer_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; + } +#endif + inline void positive_integer_pskel:: + _max_facet (unsigned long v, bool inc) + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; } + + inline void positive_integer_pskel:: + _min_facet (unsigned long v, bool inc) + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; + } + + inline const positive_integer_pskel::facets& positive_integer_pskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const positive_integer_pskel&> ( + *parent_).facets_; + else #endif + return facets_; + } // non_negative_integer_pskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline non_negative_integer_pskel:: non_negative_integer_pskel () - : non_negative_integer_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + non_negative_integer_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline non_negative_integer_pskel:: non_negative_integer_pskel (non_negative_integer_pskel* impl, void*) : simple_content (impl, 0), non_negative_integer_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; + } +#endif + inline void non_negative_integer_pskel:: + _max_facet (unsigned long v, bool inc) + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void non_negative_integer_pskel:: + _min_facet (unsigned long v, bool inc) + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; } + + inline const non_negative_integer_pskel::facets& + non_negative_integer_pskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const non_negative_integer_pskel&> ( + *parent_).facets_; + else #endif + return facets_; + } // float_pskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline float_pskel:: float_pskel () - : float_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + float_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline float_pskel:: float_pskel (float_pskel* impl, void*) : simple_content (impl, 0), float_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; + } +#endif + inline void float_pskel:: + _max_facet (float v, bool inc) + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void float_pskel:: + _min_facet (float v, bool inc) + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; } + + inline const float_pskel::facets& float_pskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const float_pskel&> (*parent_).facets_; + else #endif + return facets_; + } // double_pskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline double_pskel:: double_pskel () - : double_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + double_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline double_pskel:: double_pskel (double_pskel* impl, void*) : simple_content (impl, 0), double_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; + } +#endif + inline void double_pskel:: + _max_facet (double v, bool inc) + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void double_pskel:: + _min_facet (double v, bool inc) + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; } + + inline const double_pskel::facets& double_pskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const double_pskel&> (*parent_).facets_; + else #endif + return facets_; + } // decimal_pskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline decimal_pskel:: decimal_pskel () - : decimal_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + decimal_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline decimal_pskel:: decimal_pskel (decimal_pskel* impl, void*) : simple_content (impl, 0), decimal_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; + } +#endif + inline void decimal_pskel:: + _max_facet (double v, bool inc) + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void decimal_pskel:: + _min_facet (double v, bool inc) + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; } + + inline const decimal_pskel::facets& decimal_pskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const decimal_pskel&> (*parent_).facets_; + else #endif + return facets_; + } // string_facets // diff --git a/libxsde/xsde/cxx/serializer/validating/byte.cxx b/libxsde/xsde/cxx/serializer/validating/byte.cxx index 2b672b5..d3884d3 100644 --- a/libxsde/xsde/cxx/serializer/validating/byte.cxx +++ b/libxsde/xsde/cxx/serializer/validating/byte.cxx @@ -24,6 +24,24 @@ namespace xsde void byte_simpl:: _serialize_content () { + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } + // We only need strlen("-128") + 1 characters to hold all // representations of signed byte. // diff --git a/libxsde/xsde/cxx/serializer/validating/decimal.cxx b/libxsde/xsde/cxx/serializer/validating/decimal.cxx index f7fddae..70c645b 100644 --- a/libxsde/xsde/cxx/serializer/validating/decimal.cxx +++ b/libxsde/xsde/cxx/serializer/validating/decimal.cxx @@ -24,6 +24,24 @@ namespace xsde void decimal_simpl:: _serialize_content () { + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } + // Assume double values cannot be longer than 127 characters. // char str[128]; diff --git a/libxsde/xsde/cxx/serializer/validating/double.cxx b/libxsde/xsde/cxx/serializer/validating/double.cxx index 7ec2ae6..0d1ab54 100644 --- a/libxsde/xsde/cxx/serializer/validating/double.cxx +++ b/libxsde/xsde/cxx/serializer/validating/double.cxx @@ -24,6 +24,24 @@ namespace xsde void double_simpl:: _serialize_content () { + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } + // Assume double values cannot be longer than 127 characters. // char str[128]; diff --git a/libxsde/xsde/cxx/serializer/validating/float.cxx b/libxsde/xsde/cxx/serializer/validating/float.cxx index f224a25..f31b248 100644 --- a/libxsde/xsde/cxx/serializer/validating/float.cxx +++ b/libxsde/xsde/cxx/serializer/validating/float.cxx @@ -24,6 +24,24 @@ namespace xsde void float_simpl:: _serialize_content () { + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } + // Assume float values cannot be longer than 127 characters. // char str[128]; diff --git a/libxsde/xsde/cxx/serializer/validating/int.cxx b/libxsde/xsde/cxx/serializer/validating/int.cxx index a97b926..4ae17b3 100644 --- a/libxsde/xsde/cxx/serializer/validating/int.cxx +++ b/libxsde/xsde/cxx/serializer/validating/int.cxx @@ -24,6 +24,24 @@ namespace xsde void int_simpl:: _serialize_content () { + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } + // We only need strlen("-2147483649") + 1 characters to hold all // representations of int. // diff --git a/libxsde/xsde/cxx/serializer/validating/integer.cxx b/libxsde/xsde/cxx/serializer/validating/integer.cxx index ebcba69..5e26dbd 100644 --- a/libxsde/xsde/cxx/serializer/validating/integer.cxx +++ b/libxsde/xsde/cxx/serializer/validating/integer.cxx @@ -24,6 +24,24 @@ namespace xsde void integer_simpl:: _serialize_content () { + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } + // We only need strlen("-9223372036854775808") + 1 characters to // hold all representations of (possibly 64-bit) long. // diff --git a/libxsde/xsde/cxx/serializer/validating/long-long.cxx b/libxsde/xsde/cxx/serializer/validating/long-long.cxx index 8464ac3..25cbf53 100644 --- a/libxsde/xsde/cxx/serializer/validating/long-long.cxx +++ b/libxsde/xsde/cxx/serializer/validating/long-long.cxx @@ -24,6 +24,24 @@ namespace xsde void long_simpl:: _serialize_content () { + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } + // We only need strlen("-9223372036854775808") + 1 characters to // hold all representations of long long. // diff --git a/libxsde/xsde/cxx/serializer/validating/long.cxx b/libxsde/xsde/cxx/serializer/validating/long.cxx index 19c7ee4..43a8733 100644 --- a/libxsde/xsde/cxx/serializer/validating/long.cxx +++ b/libxsde/xsde/cxx/serializer/validating/long.cxx @@ -24,6 +24,24 @@ namespace xsde void long_simpl:: _serialize_content () { + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } + // We only need strlen("-9223372036854775808") + 1 characters to // hold all representations of (possibly 64-bit) long. // diff --git a/libxsde/xsde/cxx/serializer/validating/negative-integer.cxx b/libxsde/xsde/cxx/serializer/validating/negative-integer.cxx index adc9ead..bdbc948 100644 --- a/libxsde/xsde/cxx/serializer/validating/negative-integer.cxx +++ b/libxsde/xsde/cxx/serializer/validating/negative-integer.cxx @@ -30,6 +30,24 @@ namespace xsde return; } + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } + // We only need strlen("-9223372036854775808") + 1 characters to // hold all representations of (possibly 64-bit) long. // diff --git a/libxsde/xsde/cxx/serializer/validating/non-negative-integer.cxx b/libxsde/xsde/cxx/serializer/validating/non-negative-integer.cxx index 53e46ea..8bf7fe7 100644 --- a/libxsde/xsde/cxx/serializer/validating/non-negative-integer.cxx +++ b/libxsde/xsde/cxx/serializer/validating/non-negative-integer.cxx @@ -24,6 +24,24 @@ namespace xsde void non_negative_integer_simpl:: _serialize_content () { + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } + // We only need strlen("18446744073709551615") + 1 characters to // hold all representations of (possibly 64-bit) unsigned long. // diff --git a/libxsde/xsde/cxx/serializer/validating/non-positive-integer.cxx b/libxsde/xsde/cxx/serializer/validating/non-positive-integer.cxx index f0d8d55..46c7bcd 100644 --- a/libxsde/xsde/cxx/serializer/validating/non-positive-integer.cxx +++ b/libxsde/xsde/cxx/serializer/validating/non-positive-integer.cxx @@ -30,6 +30,24 @@ namespace xsde return; } + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } + // We only need strlen("-9223372036854775808") + 1 characters to // hold all representations of (possibly 64-bit) long. // diff --git a/libxsde/xsde/cxx/serializer/validating/positive-integer.cxx b/libxsde/xsde/cxx/serializer/validating/positive-integer.cxx index d35ab15..e7ec2ff 100644 --- a/libxsde/xsde/cxx/serializer/validating/positive-integer.cxx +++ b/libxsde/xsde/cxx/serializer/validating/positive-integer.cxx @@ -30,6 +30,24 @@ namespace xsde return; } + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } + // We only need strlen("18446744073709551615") + 1 characters to // hold all representations of (possibly 64-bit) unsigned long. // diff --git a/libxsde/xsde/cxx/serializer/validating/unsigned-long-long.cxx b/libxsde/xsde/cxx/serializer/validating/unsigned-long-long.cxx index f417e11..b48e205 100644 --- a/libxsde/xsde/cxx/serializer/validating/unsigned-long-long.cxx +++ b/libxsde/xsde/cxx/serializer/validating/unsigned-long-long.cxx @@ -24,6 +24,24 @@ namespace xsde void unsigned_long_simpl:: _serialize_content () { + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } + // We only need strlen("18446744073709551615") + 1 characters to // hold all representations of unsigned long long. // diff --git a/libxsde/xsde/cxx/serializer/validating/unsigned-long.cxx b/libxsde/xsde/cxx/serializer/validating/unsigned-long.cxx index 903efa1..52dc5c8 100644 --- a/libxsde/xsde/cxx/serializer/validating/unsigned-long.cxx +++ b/libxsde/xsde/cxx/serializer/validating/unsigned-long.cxx @@ -24,6 +24,24 @@ namespace xsde void unsigned_long_simpl:: _serialize_content () { + // Check facets. + // + const facets& f = _facets (); + + if (f.min_set_ && + (value_ < f.min_ || (!f.min_inc_ && value_ == f.min_))) + { + _schema_error (schema_error::value_less_than_min); + return; + } + + if (f.max_set_ && + (value_ > f.max_ || (!f.max_inc_ && value_ == f.max_))) + { + _schema_error (schema_error::value_greater_than_max); + return; + } + // We only need strlen("18446744073709551615") + 1 characters to // hold all representations of (possibly 64-bit) unsigned long. // diff --git a/libxsde/xsde/cxx/serializer/validating/xml-schema-sskel.hxx b/libxsde/xsde/cxx/serializer/validating/xml-schema-sskel.hxx index b93012d..c8e7466 100644 --- a/libxsde/xsde/cxx/serializer/validating/xml-schema-sskel.hxx +++ b/libxsde/xsde/cxx/serializer/validating/xml-schema-sskel.hxx @@ -130,14 +130,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + byte_sskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - byte_sskel (); byte_sskel (byte_sskel* impl, void*); protected: byte_sskel* byte_impl_; #endif + // Facets. + // + public: + void + _max_facet (signed char, bool inclusive); + + void + _min_facet (signed char, bool inclusive); + + protected: + struct facets + { + signed char min_; + signed 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_; }; struct unsigned_byte_sskel: simple_content @@ -152,7 +178,6 @@ namespace xsde virtual const char* _dynamic_type () const; #endif - unsigned_byte_sskel (); #ifdef XSDE_REUSE_STYLE_TIEIN @@ -306,14 +331,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + int_sskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - int_sskel (); int_sskel (int_sskel* impl, void*); protected: int_sskel* int_impl_; #endif + // Facets. + // + public: + void + _max_facet (int, bool inclusive); + + void + _min_facet (int, bool inclusive); + + protected: + struct facets + { + int min_; + 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_; }; struct unsigned_int_sskel: simple_content @@ -381,14 +432,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + long_sskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - long_sskel (); long_sskel (long_sskel* impl, void*); protected: long_sskel* long_impl_; #endif + // Facets. + // + public: + void + _max_facet (long long, bool inclusive); + + void + _min_facet (long long, bool inclusive); + + protected: + struct facets + { + long long min_; + long long 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_long_sskel: simple_content @@ -403,14 +480,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + unsigned_long_sskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - unsigned_long_sskel (); unsigned_long_sskel (unsigned_long_sskel* impl, void*); protected: unsigned_long_sskel* unsigned_long_impl_; #endif + // Facets. + // + public: + void + _max_facet (unsigned long long, bool inclusive); + + void + _min_facet (unsigned long long, bool inclusive); + + protected: + struct facets + { + unsigned long long min_; + unsigned long long 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_; }; #else struct long_sskel: simple_content @@ -425,14 +528,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + long_sskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - long_sskel (); long_sskel (long_sskel* impl, void*); protected: long_sskel* long_impl_; #endif + // Facets. + // + public: + void + _max_facet (long, bool inclusive); + + void + _min_facet (long, bool inclusive); + + protected: + struct facets + { + long min_; + long 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_long_sskel: simple_content @@ -447,14 +576,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + unsigned_long_sskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - unsigned_long_sskel (); unsigned_long_sskel (unsigned_long_sskel* impl, void*); protected: unsigned_long_sskel* unsigned_long_impl_; #endif + // Facets. + // + public: + void + _max_facet (unsigned long, bool inclusive); + + void + _min_facet (unsigned long, bool inclusive); + + protected: + struct facets + { + unsigned long min_; + unsigned long 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_; }; #endif @@ -473,14 +628,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + integer_sskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - integer_sskel (); integer_sskel (integer_sskel* impl, void*); protected: integer_sskel* integer_impl_; #endif + // Facets. + // + public: + void + _max_facet (long, bool inclusive); + + void + _min_facet (long, bool inclusive); + + protected: + struct facets + { + long min_; + long 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 negative_integer_sskel: simple_content @@ -495,14 +676,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + negative_integer_sskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - negative_integer_sskel (); negative_integer_sskel (negative_integer_sskel* impl, void*); protected: negative_integer_sskel* negative_integer_impl_; #endif + // Facets. + // + public: + void + _max_facet (long, bool inclusive); + + void + _min_facet (long, bool inclusive); + + protected: + struct facets + { + long min_; + long 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 non_positive_integer_sskel: simple_content @@ -517,14 +724,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + non_positive_integer_sskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - non_positive_integer_sskel (); non_positive_integer_sskel (non_positive_integer_sskel* impl, void*); protected: non_positive_integer_sskel* non_positive_integer_impl_; #endif + // Facets. + // + public: + void + _max_facet (long, bool inclusive); + + void + _min_facet (long, bool inclusive); + + protected: + struct facets + { + long min_; + long 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 positive_integer_sskel: simple_content @@ -539,14 +772,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + positive_integer_sskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - positive_integer_sskel (); positive_integer_sskel (positive_integer_sskel* impl, void*); protected: positive_integer_sskel* positive_integer_impl_; #endif + // Facets. + // + public: + void + _max_facet (unsigned long, bool inclusive); + + void + _min_facet (unsigned long, bool inclusive); + + protected: + struct facets + { + unsigned long min_; + unsigned long 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 non_negative_integer_sskel: simple_content @@ -561,14 +820,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + non_negative_integer_sskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - non_negative_integer_sskel (); non_negative_integer_sskel (non_negative_integer_sskel* impl, void*); protected: non_negative_integer_sskel* non_negative_integer_impl_; #endif + // Facets. + // + public: + void + _max_facet (unsigned long, bool inclusive); + + void + _min_facet (unsigned long, bool inclusive); + + protected: + struct facets + { + unsigned long min_; + unsigned long 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_; }; // Floats. @@ -586,14 +871,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + float_sskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - float_sskel (); float_sskel (float_sskel* impl, void*); protected: float_sskel* float_impl_; #endif + // Facets. + // + public: + void + _max_facet (float, bool inclusive); + + void + _min_facet (float, bool inclusive); + + protected: + struct facets + { + float min_; + float 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 double_sskel: simple_content @@ -608,14 +919,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + double_sskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - double_sskel (); double_sskel (double_sskel* impl, void*); protected: double_sskel* double_impl_; #endif + // Facets. + // + public: + void + _max_facet (double, bool inclusive); + + void + _min_facet (double, bool inclusive); + + protected: + struct facets + { + double min_; + double 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 decimal_sskel: simple_content @@ -630,14 +967,40 @@ namespace xsde virtual const char* _dynamic_type () const; #endif + decimal_sskel (); #ifdef XSDE_REUSE_STYLE_TIEIN - decimal_sskel (); decimal_sskel (decimal_sskel* impl, void*); protected: decimal_sskel* decimal_impl_; #endif + // Facets. + // + public: + void + _max_facet (double, bool inclusive); + + void + _min_facet (double, bool inclusive); + + protected: + struct facets + { + double min_; + double 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_; }; // diff --git a/libxsde/xsde/cxx/serializer/validating/xml-schema-sskel.ixx b/libxsde/xsde/cxx/serializer/validating/xml-schema-sskel.ixx index 35ce5d9..f7b0351 100644 --- a/libxsde/xsde/cxx/serializer/validating/xml-schema-sskel.ixx +++ b/libxsde/xsde/cxx/serializer/validating/xml-schema-sskel.ixx @@ -61,19 +61,51 @@ namespace xsde // byte_sskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline byte_sskel:: byte_sskel () - : byte_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + byte_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline byte_sskel:: byte_sskel (byte_sskel* impl, void*) : simple_content (impl, 0), byte_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; + } +#endif + inline void byte_sskel:: + _max_facet (signed char v, bool inc) + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; } + + inline void byte_sskel:: + _min_facet (signed char v, bool inc) + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; + } + + inline const byte_sskel::facets& byte_sskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const byte_sskel&> (*parent_).facets_; + else #endif + return facets_; + } // unsigned_byte_sskel // @@ -224,19 +256,51 @@ namespace xsde // int_sskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline int_sskel:: int_sskel () - : int_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + int_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline int_sskel:: int_sskel (int_sskel* impl, void*) : simple_content (impl, 0), int_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; } #endif + inline void int_sskel:: + _max_facet (int v, bool inc) + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void int_sskel:: + _min_facet (int v, bool inc) + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; + } + + inline const int_sskel::facets& int_sskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const int_sskel&> (*parent_).facets_; + else +#endif + return facets_; + } // unsigned_int_sskel // @@ -289,163 +353,508 @@ namespace xsde // long_sskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline long_sskel:: long_sskel () - : long_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + long_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline long_sskel:: long_sskel (long_sskel* impl, void*) : simple_content (impl, 0), long_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; } #endif + inline void long_sskel:: +#ifdef XSDE_LONGLONG + _max_facet (long long v, bool inc) +#else + _max_facet (long v, bool inc) +#endif + + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void long_sskel:: +#ifdef XSDE_LONGLONG + _min_facet (long long v, bool inc) +#else + _min_facet (long v, bool inc) +#endif + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; + } + + inline const long_sskel::facets& long_sskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const long_sskel&> (*parent_).facets_; + else +#endif + return facets_; + } + // unsigned_long_sskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline unsigned_long_sskel:: unsigned_long_sskel () - : unsigned_long_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + unsigned_long_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline unsigned_long_sskel:: unsigned_long_sskel (unsigned_long_sskel* impl, void*) : simple_content (impl, 0), unsigned_long_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; + } +#endif + + inline void unsigned_long_sskel:: +#ifdef XSDE_LONGLONG + _max_facet (unsigned long long v, bool inc) +#else + _max_facet (unsigned long v, bool inc) +#endif + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void unsigned_long_sskel:: +#ifdef XSDE_LONGLONG + _min_facet (unsigned long long v, bool inc) +#else + _min_facet (unsigned long v, bool inc) +#endif + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; } + + inline const unsigned_long_sskel::facets& unsigned_long_sskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const unsigned_long_sskel&> (*parent_).facets_; + else #endif + return facets_; + } // integer_sskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline integer_sskel:: integer_sskel () - : integer_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + integer_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline integer_sskel:: integer_sskel (integer_sskel* impl, void*) : simple_content (impl, 0), integer_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; } #endif + inline void integer_sskel:: + _max_facet (long v, bool inc) + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void integer_sskel:: + _min_facet (long v, bool inc) + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; + } + + inline const integer_sskel::facets& integer_sskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const integer_sskel&> (*parent_).facets_; + else +#endif + return facets_; + } // negative_integer_sskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline negative_integer_sskel:: negative_integer_sskel () - : negative_integer_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + negative_integer_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline negative_integer_sskel:: negative_integer_sskel (negative_integer_sskel* impl, void*) : simple_content (impl, 0), negative_integer_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; } #endif + inline void negative_integer_sskel:: + _max_facet (long v, bool inc) + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void negative_integer_sskel:: + _min_facet (long v, bool inc) + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; + } + + inline const negative_integer_sskel::facets& negative_integer_sskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const negative_integer_sskel&> ( + *parent_).facets_; + else +#endif + return facets_; + } // non_positive_integer_sskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline non_positive_integer_sskel:: non_positive_integer_sskel () - : non_positive_integer_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + non_positive_integer_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline non_positive_integer_sskel:: non_positive_integer_sskel (non_positive_integer_sskel* impl, void*) : simple_content (impl, 0), non_positive_integer_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; + } +#endif + inline void non_positive_integer_sskel:: + _max_facet (long v, bool inc) + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void non_positive_integer_sskel:: + _min_facet (long v, bool inc) + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; } + + inline const non_positive_integer_sskel::facets& + non_positive_integer_sskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const non_positive_integer_sskel&> ( + *parent_).facets_; + else #endif + return facets_; + } // positive_integer_sskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline positive_integer_sskel:: positive_integer_sskel () - : positive_integer_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + positive_integer_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline positive_integer_sskel:: positive_integer_sskel (positive_integer_sskel* impl, void*) : simple_content (impl, 0), positive_integer_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; } #endif + inline void positive_integer_sskel:: + _max_facet (unsigned long v, bool inc) + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void positive_integer_sskel:: + _min_facet (unsigned long v, bool inc) + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; + } + + inline const positive_integer_sskel::facets& positive_integer_sskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const positive_integer_sskel&> ( + *parent_).facets_; + else +#endif + return facets_; + } // non_negative_integer_sskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline non_negative_integer_sskel:: non_negative_integer_sskel () - : non_negative_integer_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + non_negative_integer_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline non_negative_integer_sskel:: non_negative_integer_sskel (non_negative_integer_sskel* impl, void*) : simple_content (impl, 0), non_negative_integer_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; } #endif + inline void non_negative_integer_sskel:: + _max_facet (unsigned long v, bool inc) + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void non_negative_integer_sskel:: + _min_facet (unsigned long v, bool inc) + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; + } + + inline const non_negative_integer_sskel::facets& + non_negative_integer_sskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const non_negative_integer_sskel&> ( + *parent_).facets_; + else +#endif + return facets_; + } // float_sskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline float_sskel:: float_sskel () - : float_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + float_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline float_sskel:: float_sskel (float_sskel* impl, void*) : simple_content (impl, 0), float_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; } #endif + inline void float_sskel:: + _max_facet (float v, bool inc) + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void float_sskel:: + _min_facet (float v, bool inc) + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; + } + + inline const float_sskel::facets& float_sskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const float_sskel&> (*parent_).facets_; + else +#endif + return facets_; + } // double_sskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline double_sskel:: double_sskel () - : double_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + double_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline double_sskel:: double_sskel (double_sskel* impl, void*) : simple_content (impl, 0), double_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; + } +#endif + inline void double_sskel:: + _max_facet (double v, bool inc) + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void double_sskel:: + _min_facet (double v, bool inc) + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; } + + inline const double_sskel::facets& double_sskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const double_sskel&> (*parent_).facets_; + else #endif + return facets_; + } // decimal_sskel // -#ifdef XSDE_REUSE_STYLE_TIEIN inline decimal_sskel:: decimal_sskel () - : decimal_impl_ (0) { +#ifdef XSDE_REUSE_STYLE_TIEIN + decimal_impl_ = 0; +#endif + facets_.min_set_ = 0; + facets_.max_set_ = 0; } +#ifdef XSDE_REUSE_STYLE_TIEIN inline decimal_sskel:: decimal_sskel (decimal_sskel* impl, void*) : simple_content (impl, 0), decimal_impl_ (impl) { + facets_.min_set_ = 0; + facets_.max_set_ = 0; } #endif + inline void decimal_sskel:: + _max_facet (double v, bool inc) + { + facets_.max_ = v; + facets_.max_set_ = 1; + facets_.max_inc_ = inc; + } + + inline void decimal_sskel:: + _min_facet (double v, bool inc) + { + facets_.min_ = v; + facets_.min_set_ = 1; + facets_.min_inc_ = inc; + } + + inline const decimal_sskel::facets& decimal_sskel:: + _facets () const + { +#ifdef XSDE_REUSE_STYLE_TIEIN + if (parent_ != 0) + return static_cast<const decimal_sskel&> (*parent_).facets_; + else +#endif + return facets_; + } // string_facets // |