blob: a89036e90d804a299b19ba514be26db4baf18f95 [file] [log] [blame]
Mark Sleee9ce01c2007-05-16 02:29:53 +00001// Copyright (c) 2006- Facebook
2// Distributed under the Thrift Software License
3//
4// See accompanying file LICENSE or visit the Thrift site at:
5// http://developers.facebook.com/thrift/
6
Mark Slee30152872006-11-28 01:24:07 +00007#ifndef T_CONST_H
8#define T_CONST_H
9
10#include "t_type.h"
11#include "t_const_value.h"
12
13/**
14 * A const is a constant value defined across languages that has a type and
15 * a value. The trick here is that the declared type might not match the type
16 * of the value object, since that is not determined until after parsing the
17 * whole thing out.
18 *
Mark Slee30152872006-11-28 01:24:07 +000019 */
David Reisscdffe262007-08-14 17:12:31 +000020class t_const : public t_doc {
Mark Slee30152872006-11-28 01:24:07 +000021 public:
22 t_const(t_type* type, std::string name, t_const_value* value) :
23 type_(type),
24 name_(name),
25 value_(value) {}
26
27 t_type* get_type() const {
28 return type_;
29 }
30
31 std::string get_name() const {
32 return name_;
33 }
34
35 t_const_value* get_value() const {
36 return value_;
37 }
38
39 private:
40 t_type* type_;
41 std::string name_;
42 t_const_value* value_;
43};
44
45#endif
46