aboutsummaryrefslogtreecommitdiff
path: root/libxsde/xsde/cxx/serializer/validating/string-stl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libxsde/xsde/cxx/serializer/validating/string-stl.cxx')
-rw-r--r--libxsde/xsde/cxx/serializer/validating/string-stl.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/libxsde/xsde/cxx/serializer/validating/string-stl.cxx b/libxsde/xsde/cxx/serializer/validating/string-stl.cxx
index fe87f7d..1e9a37b 100644
--- a/libxsde/xsde/cxx/serializer/validating/string-stl.cxx
+++ b/libxsde/xsde/cxx/serializer/validating/string-stl.cxx
@@ -22,6 +22,28 @@ namespace xsde
void string_simpl::
_serialize_content ()
{
+ // Check facets.
+ //
+ const facets& f = _facets ();
+
+ if (f.length_set_ && value_.size () != f.length_)
+ {
+ _schema_error (schema_error::length_not_equal_prescribed);
+ return;
+ }
+
+ if (f.min_length_set_ && value_.size () < f.min_length_)
+ {
+ _schema_error (schema_error::length_less_than_min);
+ return;
+ }
+
+ if (f.max_length_set_ && value_.size () > f.max_length_)
+ {
+ _schema_error (schema_error::length_greater_than_max);
+ return;
+ }
+
// Make sure we don't hold any references to the string.
//
std::string tmp;