slang_rs_export_var.h revision 641558f02fe6ce0ee3ae5076eb366c25e2ad5903
1/*
2 * Copyright 2010, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _SLANG_COMPILER_RS_EXPORT_VAR_H
18#define _SLANG_COMPILER_RS_EXPORT_VAR_H
19
20#include <string>
21
22#include "llvm/ADT/StringRef.h"
23
24#include "clang/AST/Decl.h"
25#include "clang/AST/Expr.h"
26
27#include "slang_rs_exportable.h"
28
29namespace clang {
30  class APValue;
31}
32
33namespace slang {
34  class RSContext;
35  class RSExportType;
36
37class RSExportVar : public RSExportable {
38  friend class RSContext;
39 private:
40  std::string mName;
41  const RSExportType *mET;
42  bool mIsConst;
43
44  clang::Expr::EvalResult mInit;
45
46  RSExportVar(RSContext *Context,
47              const clang::VarDecl *VD,
48              const RSExportType *ET);
49
50 public:
51  inline const std::string &getName() const { return mName; }
52  inline const RSExportType *getType() const { return mET; }
53  inline bool isConst() const { return mIsConst; }
54
55  inline const clang::APValue &getInit() const { return mInit.Val; }
56};  // RSExportVar
57
58}   // namespace slang
59
60#endif  // _SLANG_COMPILER_RS_EXPORT_VAR_H
61