Thrift compiler frontend support for constants
Summary: The parser now accepts constants and adds them into the parse tree
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664880 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/parse/t_const.h b/compiler/cpp/src/parse/t_const.h
new file mode 100644
index 0000000..77d7e18
--- /dev/null
+++ b/compiler/cpp/src/parse/t_const.h
@@ -0,0 +1,41 @@
+#ifndef T_CONST_H
+#define T_CONST_H
+
+#include "t_type.h"
+#include "t_const_value.h"
+
+/**
+ * A const is a constant value defined across languages that has a type and
+ * a value. The trick here is that the declared type might not match the type
+ * of the value object, since that is not determined until after parsing the
+ * whole thing out.
+ *
+ * @author Mark Slee <mcslee@facebook.com>
+ */
+class t_const {
+ public:
+ t_const(t_type* type, std::string name, t_const_value* value) :
+ type_(type),
+ name_(name),
+ value_(value) {}
+
+ t_type* get_type() const {
+ return type_;
+ }
+
+ std::string get_name() const {
+ return name_;
+ }
+
+ t_const_value* get_value() const {
+ return value_;
+ }
+
+ private:
+ t_type* type_;
+ std::string name_;
+ t_const_value* value_;
+};
+
+#endif
+