1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef OHOS_HDI_AST_MODULE_H 10 #define OHOS_HDI_AST_MODULE_H 11 12 #include <map> 13 #include "ast/ast.h" 14 15 namespace OHOS { 16 namespace HDI { 17 class ASTModule : public LightRefCountBase { 18 public: 19 using ASTMap = std::unordered_map<String, AutoPtr<AST>, StringHashFunc, StringEqualFunc>; 20 21 void AddAST(const String& astName, const AutoPtr<AST> ast); 22 23 AutoPtr<AST> GetAst(const String& astName); 24 GetAllAsts()25 inline const ASTMap& GetAllAsts() const 26 { 27 return asts_; 28 } 29 private: 30 // all ast data 31 ASTMap asts_; 32 }; 33 } // namespace HDI 34 } // namespace OHOS 35 36 #endif // OHOS_HDI_AST_MODULE_H