File indexing completed on 2024-05-19 05:42:10

0001 // ct_lvtmdb_methodobject.h                                         -*-C++-*-
0002 
0003 /*
0004 // Copyright 2023 Codethink Ltd <codethink@codethink.co.uk>
0005 // SPDX-License-Identifier: Apache-2.0
0006 //
0007 // Licensed under the Apache License, Version 2.0 (the "License");
0008 // you may not use this file except in compliance with the License.
0009 // You may obtain a copy of the License at
0010 //
0011 //     http://www.apache.org/licenses/LICENSE-2.0
0012 //
0013 // Unless required by applicable law or agreed to in writing, software
0014 // distributed under the License is distributed on an "AS IS" BASIS,
0015 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0016 // See the License for the specific language governing permissions and
0017 // limitations under the License.
0018 */
0019 
0020 #ifndef INCLUDED_CT_LVTMDB_METHODOBJECT
0021 #define INCLUDED_CT_LVTMDB_METHODOBJECT
0022 
0023 #include <lvtmdb_export.h>
0024 
0025 #include <ct_lvtmdb_functionbase.h>
0026 
0027 #include <ct_lvtshr_graphenums.h>
0028 
0029 #include <string>
0030 #include <vector>
0031 
0032 namespace Codethink::lvtmdb {
0033 
0034 // Forward Declarations
0035 class TypeObject;
0036 
0037 // =====================
0038 // class MethodObject
0039 // =====================
0040 
0041 class LVTMDB_EXPORT MethodObject : public FunctionBase {
0042     // See locking discipline in superclass. That applies here.
0043 
0044   private:
0045     // See lvtmdb::FunctionBase for qualifiedName etc
0046 
0047     lvtshr::AccessSpecifier d_access;
0048 
0049     bool d_isVirtual;
0050     bool d_isPure;
0051     bool d_isStatic;
0052     bool d_isConst;
0053 
0054     TypeObject *d_parent_p;
0055 
0056     std::vector<TypeObject *> d_argumentTypes;
0057 
0058   public:
0059     // CREATORS
0060     MethodObject(std::string qualifiedName,
0061                  std::string name,
0062                  std::string signature,
0063                  std::string returnType,
0064                  std::string templateParameters,
0065                  lvtshr::AccessSpecifier access,
0066                  bool isVirtual,
0067                  bool isPure,
0068                  bool isStatic,
0069                  bool isConst,
0070                  TypeObject *parent);
0071 
0072     ~MethodObject() noexcept override;
0073 
0074     MethodObject(MethodObject&& other) noexcept;
0075 
0076     MethodObject& operator=(MethodObject&& other) noexcept;
0077 
0078     // ACCESSORS
0079     [[nodiscard]] lvtshr::AccessSpecifier access() const;
0080 
0081     [[nodiscard]] bool isVirtual() const;
0082 
0083     [[nodiscard]] bool isPure() const;
0084 
0085     [[nodiscard]] bool isStatic() const;
0086 
0087     [[nodiscard]] bool isConst() const;
0088 
0089     [[nodiscard]] TypeObject *parent() const;
0090 
0091     [[nodiscard]] const std::vector<TypeObject *>& argumentTypes() const;
0092 
0093     // MODIFIERS
0094     void addArgumentType(TypeObject *type);
0095     // Needs exclusive lock
0096 };
0097 
0098 } // namespace Codethink::lvtmdb
0099 
0100 #endif // INCLUDED_CT_LVTMDB_METHODOBJECT