blob: dadcfd2ef9084acb70a68f9415d349dcd8588dd9 [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 *
19 * @author Mark Slee <mcslee@facebook.com>
20 */
David Reisscdffe262007-08-14 17:12:31 +000021class t_const : public t_doc {
Mark Slee30152872006-11-28 01:24:07 +000022 public:
23 t_const(t_type* type, std::string name, t_const_value* value) :
24 type_(type),
25 name_(name),
26 value_(value) {}
27
28 t_type* get_type() const {
29 return type_;
30 }
31
32 std::string get_name() const {
33 return name_;
34 }
35
36 t_const_value* get_value() const {
37 return value_;
38 }
39
40 private:
41 t_type* type_;
42 std::string name_;
43 t_const_value* value_;
44};
45
46#endif
47