slang_rs_export_var.h revision c383a500aa59423264811be3874461bf8adbfea0
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 RSContext *mContext; 41 std::string mName; 42 const RSExportType *mET; 43 bool mIsConst; 44 45 clang::Expr::EvalResult mInit; 46 47 RSExportVar(RSContext *Context, 48 const clang::VarDecl *VD, 49 const RSExportType *ET); 50 51 public: 52 inline const std::string &getName() const { return mName; } 53 inline const RSExportType *getType() const { return mET; } 54 inline RSContext *getRSContext() const { return mContext; } 55 inline bool isConst() const { return mIsConst; } 56 57 inline const clang::APValue &getInit() const { return mInit.Val; } 58}; // RSExportVar 59 60} // namespace slang 61 62#endif // _SLANG_COMPILER_RS_EXPORT_VAR_H 63