From 46b7119fab32b05923dbf9cda7cd6ce62f572846 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Mon, 9 Jan 2017 14:01:51 -0500 Subject: Initial commit --- generator/field.h | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 generator/field.h (limited to 'generator/field.h') diff --git a/generator/field.h b/generator/field.h new file mode 100644 index 0000000..9d6ed9a --- /dev/null +++ b/generator/field.h @@ -0,0 +1,76 @@ +#ifndef BINDING_H_CAE0B18E +#define BINDING_H_CAE0B18E + +#include + +namespace cadence { + namespace generator { + + class field { + public: + enum class type { + invalid, + integer, + string + }; + + // Copy and move constructors + + field(const field& other); + field(field&& other); + + // Assignment + + field& operator=(field other); + + // Swap + + friend void swap(field& first, field& second); + + // Destructor + + ~field(); + + // Generic accessors + + type getType() const + { + return type_; + } + + std::string getName() const + { + return name_; + } + + // Integer + + field(std::string name, int arg); + + int getInteger() const; + + // String + + field(std::string name, std::string arg); + + std::string getString() const; + + private: + + field() + { + } + + union { + int integer_; + std::string string_; + }; + + type type_ = type::invalid; + std::string name_; + }; + + }; +}; + +#endif /* end of include guard: BINDING_H_CAE0B18E */ -- cgit 1.4.1