aboutsummaryrefslogtreecommitdiff
path: root/libxsde/xsde/cxx/hybrid/any-type.hxx
blob: 18f40c35d807c7d64c136b45a37890fa79392eb4 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// file      : xsde/cxx/hybrid/any-type.hxx
// author    : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

#ifndef XSDE_CXX_HYBRID_ANY_TYPE_HXX
#define XSDE_CXX_HYBRID_ANY_TYPE_HXX

#include <xsde/cxx/config.hxx>

#ifdef XSDE_STL
#  include <string>
#endif

#include <xsde/cxx/hybrid/sequence.hxx>

namespace xsde
{
  namespace cxx
  {
    namespace hybrid
    {
      struct any_type
      {
        any_type ()
            : data_ (0)
        {
        }

        // Custom data.
        //
        typedef data_sequence custom_data_sequence;
        typedef custom_data_sequence::iterator custom_data_iterator;
        typedef custom_data_sequence::const_iterator custom_data_const_iterator;

#ifndef XSDE_EXCEPTIONS
        bool
#else
        void
#endif
        allocate_custom_data ();

        const custom_data_sequence&
        custom_data () const
        {
          return *data_;
        }

        custom_data_sequence&
        custom_data ()
        {
          return *data_;
        }

#ifndef XSDE_EXCEPTIONS
        bool
#else
        void
#endif
        _copy (any_type&) const;

#ifndef XSDE_POLYMORPHIC
        ~any_type ();

        any_type*
        _clone () const;
#else
        virtual
        ~any_type ();

        virtual any_type*
        _clone () const;

#ifdef XSDE_STL
        virtual const std::string&
        _dynamic_type () const;

        static const std::string&
        _static_type ();
#else
        virtual const char*
        _dynamic_type () const;

        static const char*
        _static_type ();
#endif
#endif

      private:
        data_sequence* data_;
      };
    }
  }
}

#endif  // XSDE_CXX_HYBRID_ANY_TYPE_HXX