1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_IDL_ASTSETTYPE_H 17 #define OHOS_IDL_ASTSETTYPE_H 18 19 #include "ast/ast_type.h" 20 #include "util/autoptr.h" 21 22 namespace OHOS { 23 namespace Idl { 24 class ASTSetType : public ASTType { 25 public: ASTSetType()26 ASTSetType() : ASTType(false), elementType_() {} 27 SetElementType(const AutoPtr<ASTType> & elementType)28 inline void SetElementType(const AutoPtr<ASTType> &elementType) 29 { 30 elementType_ = elementType; 31 } 32 GetElementType()33 inline AutoPtr<ASTType> GetElementType() 34 { 35 return elementType_; 36 } 37 38 std::string GetSignature() override; 39 40 bool IsSetType() override; 41 42 bool HasInnerType(TypeKind innerTypeKind) const override; 43 44 std::string ToString() const override; 45 46 TypeKind GetTypeKind() override; 47 48 protected: 49 AutoPtr<ASTType> elementType_; 50 }; 51 52 } // namespace Idl 53 } // namespace OHOS 54 55 #endif // OHOS_IDL_ASTSETTYPE_H