aboutsummaryrefslogtreecommitdiff
path: root/libxsde/xsde/cxx/serializer/validating/float.hxx
blob: 84db29db0542e0bad9a0e3839a4c94ae771807c4 (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
62
// file      : xsde/cxx/serializer/validating/float.hxx
// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

#ifndef XSDE_CXX_SERIALIZER_VALIDATING_FLOAT_HXX
#define XSDE_CXX_SERIALIZER_VALIDATING_FLOAT_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 float_simpl: virtual float_sskel
#else
        struct float_simpl: float_sskel
#endif
        {
          virtual void
          pre (float);

          virtual void
          _serialize_content ();

          enum notation
          {
            notation_auto,
            notation_fixed,
            notation_scientific
          };

          void
          format (notation, unsigned int precision);

#ifdef FLT_DIG
          float_simpl (notation = notation_auto,
                       unsigned int precision = FLT_DIG); // Keep it last.
#else
          float_simpl (notation = notation_auto,
                       unsigned int precision = 6)
#endif

        protected:
          notation notation_;
          unsigned int precision_;
          float value_;
        };
      }
    }
  }
}

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

#endif  // XSDE_CXX_SERIALIZER_VALIDATING_FLOAT_HXX