Home | History | Annotate | Download | only in slang
      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 _FRAMEWORKS_COMPILE_SLANG_SLANG_RS_EXPORT_VAR_H_  // NOLINT
     18 #define _FRAMEWORKS_COMPILE_SLANG_SLANG_RS_EXPORT_VAR_H_
     19 
     20 #include <string>
     21 
     22 #include "clang/AST/Decl.h"
     23 #include "clang/AST/Expr.h"
     24 
     25 #include "llvm/ADT/StringRef.h"
     26 
     27 #include "slang_rs_exportable.h"
     28 
     29 namespace clang {
     30   class APValue;
     31 }
     32 
     33 namespace slang {
     34   class RSContext;
     35   class RSExportType;
     36 
     37 class 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  // _FRAMEWORKS_COMPILE_SLANG_SLANG_RS_EXPORT_VAR_H_  NOLINT
     61