summary refs log tree commit diff stats
path: root/lib/binding.h
blob: 7fbe20eaeeecbe4592b48fa9db2e69710e873069 (plain) (blame)
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
#ifndef BINDING_H_CAE0B18E
#define BINDING_H_CAE0B18E

#include <string>

namespace verbly {

  class binding {
    public:
      enum class type {
        invalid,
        integer,
        string
      };
      
      // Default constructor
      
      binding()
      {
      }

      // Copy and move constructors

      binding(const binding& other);
      binding(binding&& other);

      // Assignment

      binding& operator=(binding other);

      // Swap

      friend void swap(binding& first, binding& second);

      // Destructor

      ~binding();

      // Generic accessors
      
      type getType() const
      {
        return type_;
      }

      // Integer
      
      binding(int arg);
      
      int getInteger() const;

      // String
      
      binding(std::string arg);
      
      std::string getString() const;

    private:

      union {
        int integer_;
        std::string string_;
      };

      type type_ = type::invalid;
  };

};

#endif /* end of include guard: BINDING_H_CAE0B18E */