blob: 7fd81bd1b0c1c7a0bce858e676c58f68d1fef47d [file] [log] [blame]
David Reissea2cba82009-03-30 21:35:00 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
Mark Sleee9ce01c2007-05-16 02:29:53 +000019
Mark Slee30152872006-11-28 01:24:07 +000020#ifndef T_CONST_H
21#define T_CONST_H
22
23#include "t_type.h"
24#include "t_const_value.h"
25
26/**
27 * A const is a constant value defined across languages that has a type and
28 * a value. The trick here is that the declared type might not match the type
29 * of the value object, since that is not determined until after parsing the
30 * whole thing out.
31 *
Mark Slee30152872006-11-28 01:24:07 +000032 */
David Reisscdffe262007-08-14 17:12:31 +000033class t_const : public t_doc {
Mark Slee30152872006-11-28 01:24:07 +000034 public:
35 t_const(t_type* type, std::string name, t_const_value* value) :
36 type_(type),
37 name_(name),
38 value_(value) {}
39
40 t_type* get_type() const {
41 return type_;
42 }
43
44 std::string get_name() const {
45 return name_;
46 }
47
48 t_const_value* get_value() const {
49 return value_;
50 }
51
52 private:
53 t_type* type_;
54 std::string name_;
55 t_const_value* value_;
56};
57
58#endif
59