aboutsummaryrefslogtreecommitdiff
path: root/libxsde/xsde/cxx/parser/non-validating/unsigned-byte.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libxsde/xsde/cxx/parser/non-validating/unsigned-byte.cxx')
-rw-r--r--libxsde/xsde/cxx/parser/non-validating/unsigned-byte.cxx44
1 files changed, 44 insertions, 0 deletions
diff --git a/libxsde/xsde/cxx/parser/non-validating/unsigned-byte.cxx b/libxsde/xsde/cxx/parser/non-validating/unsigned-byte.cxx
new file mode 100644
index 0000000..11e6dd5
--- /dev/null
+++ b/libxsde/xsde/cxx/parser/non-validating/unsigned-byte.cxx
@@ -0,0 +1,44 @@
+// file : xsde/cxx/parser/non-validating/unsigned-byte.cxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include <stdlib.h> // strtoul
+
+#include <xsde/cxx/parser/non-validating/unsigned-byte.hxx>
+
+namespace xsde
+{
+ namespace cxx
+ {
+ namespace parser
+ {
+ namespace non_validating
+ {
+ void unsigned_byte_pimpl::
+ _pre ()
+ {
+ size_ = 0;
+ sign_ = none;
+ state_ = leading_ws;
+ }
+
+ void unsigned_byte_pimpl::
+ _characters (const ro_string& s)
+ {
+ parse (s, str_, 4);
+ }
+
+ unsigned char unsigned_byte_pimpl::
+ post_unsigned_byte ()
+ {
+ ro_string tmp (str_, size_);
+ size_t size = trim_right (tmp);
+
+ str_[size] = '\0';
+ return static_cast<unsigned char> (strtoul (str_, 0, 10));
+ }
+ }
+ }
+ }
+}