1 /* 2 * Copyright (c) 2022 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_ASTTYPE_H 17 #define OHOS_IDL_ASTTYPE_H 18 19 #include "ast/ast_namespace.h" 20 #include "ast/ast_node.h" 21 #include "util/autoptr.h" 22 #include "util/string.h" 23 24 namespace OHOS { 25 namespace Idl { 26 class ASTType : public ASTNode { 27 public: 28 virtual void SetName(const String& name); 29 30 virtual String GetName(); 31 32 virtual void SetNamespace(ASTNamespace* nspace); 33 34 virtual AutoPtr<ASTNamespace> GetNamespace(); 35 36 virtual String GetSignature() = 0; 37 38 virtual bool IsBooleanType(); 39 40 virtual bool IsByteType(); 41 42 virtual bool IsShortType(); 43 44 virtual bool IsIntegerType(); 45 46 virtual bool IsLongType(); 47 48 virtual bool IsFloatType(); 49 50 virtual bool IsDoubleType(); 51 52 virtual bool IsCharType(); 53 54 virtual bool IsStringType(); 55 56 virtual bool IsListType(); 57 58 virtual bool IsMapType(); 59 60 virtual bool IsInterfaceType(); 61 62 virtual bool IsSequenceableType(); 63 64 virtual bool IsVoidType(); 65 66 virtual bool IsArrayType(); 67 68 virtual String ToShortString(); 69 70 String ToString() override; 71 72 protected: 73 String name_; 74 AutoPtr<ASTNamespace> namespace_; 75 }; 76 } // namespace Idl 77 } // namespace OHOS 78 #endif // OHOS_IDL_ASTTYPE_H 79