aboutsummaryrefslogtreecommitdiff
path: root/libxsde/xsde/cxx/serializer/validating/double.hxx
blob: 75ed31dddd08ef6c7cd0bee1b7ce73d0842afaf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// file      : xsde/cxx/serializer/validating/double.hxx
// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

#ifndef XSDE_CXX_SERIALIZER_VALIDATING_DOUBLE_HXX
#define XSDE_CXX_SERIALIZER_VALIDATING_DOUBLE_HXX

#include <float.h>

#include <xsde/cxx/serializer/validating/xml-schema-sskel.hxx>

namespace xsde
{
  namespace cxx
  {
    namespace serializer
    {
      namespace validating
      {
#ifdef XSDE_REUSE_STYLE_MIXIN
        struct double_simpl: virtual double_sskel
#else
        struct double_simpl: double_sskel
#endif
        {
          virtual void
          pre (double);

          virtual void
          _serialize_content ();

          enum notation
          {
            notation_auto,
            notation_fixed,
            notation_scientific
          };

          void
          format (notation, unsigned int precision);

#ifdef DBL_DIG
          double_simpl (notation = notation_auto,
                        unsigned int precision = DBL_DIG); // Keep it last.
#else
          double_simpl (notation = notation_auto,
                        unsigned int precision = 15)
#endif
        protected:
          notation notation_;
          unsigned int precision_;
          double value_;
        };
      }
    }
  }
}

#include <xsde/cxx/serializer/validating/double.ixx>

#endif  // XSDE_CXX_SERIALIZER_VALIDATING_DOUBLE_HXX