blob: 61d997acf16564f181d2ee3a55112af357744eaf [file] [log] [blame]
Zonr Changc383a502010-10-12 01:52:08 +08001/*
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
Stephen Hinese639eb52010-11-08 19:27:20 -080017#ifndef _FRAMEWORKS_COMPILE_SLANG_SLANG_RS_EXPORT_VAR_H_ // NOLINT
18#define _FRAMEWORKS_COMPILE_SLANG_SLANG_RS_EXPORT_VAR_H_
Shih-wei Liao462aefd2010-06-04 15:32:04 -070019
Zonr Changa41ce1d2010-10-06 02:23:12 +080020#include <string>
21
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070022#include "clang/AST/Decl.h"
23#include "clang/AST/Expr.h"
Shih-wei Liao462aefd2010-06-04 15:32:04 -070024
Stephen Hinese639eb52010-11-08 19:27:20 -080025#include "llvm/ADT/StringRef.h"
26
Zonr Changa41ce1d2010-10-06 02:23:12 +080027#include "slang_rs_exportable.h"
Shih-wei Liao462aefd2010-06-04 15:32:04 -070028
Shih-wei Liao324c0472010-06-21 13:15:11 -070029namespace clang {
zonr6315f762010-10-05 15:35:14 +080030 class APValue;
Shih-wei Liao324c0472010-06-21 13:15:11 -070031}
32
Shih-wei Liao462aefd2010-06-04 15:32:04 -070033namespace slang {
zonr6315f762010-10-05 15:35:14 +080034 class RSContext;
35 class RSExportType;
Shih-wei Liao462aefd2010-06-04 15:32:04 -070036
Zonr Changa41ce1d2010-10-06 02:23:12 +080037class RSExportVar : public RSExportable {
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070038 friend class RSContext;
39 private:
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070040 std::string mName;
41 const RSExportType *mET;
42 bool mIsConst;
Shih-wei Liao462aefd2010-06-04 15:32:04 -070043
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070044 clang::Expr::EvalResult mInit;
Shih-wei Liao324c0472010-06-21 13:15:11 -070045
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070046 RSExportVar(RSContext *Context,
47 const clang::VarDecl *VD,
48 const RSExportType *ET);
Shih-wei Liao462aefd2010-06-04 15:32:04 -070049
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070050 public:
51 inline const std::string &getName() const { return mName; }
52 inline const RSExportType *getType() const { return mET; }
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070053 inline bool isConst() const { return mIsConst; }
Shih-wei Liao462aefd2010-06-04 15:32:04 -070054
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070055 inline const clang::APValue &getInit() const { return mInit.Val; }
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070056}; // RSExportVar
Shih-wei Liao462aefd2010-06-04 15:32:04 -070057
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070058} // namespace slang
Shih-wei Liao462aefd2010-06-04 15:32:04 -070059
Stephen Hinese639eb52010-11-08 19:27:20 -080060#endif // _FRAMEWORKS_COMPILE_SLANG_SLANG_RS_EXPORT_VAR_H_ NOLINT