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

0001 // ct_lvtmdb_functionbase.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_FUNCTIONBASE
0021 #define INCLUDED_CT_LVTMDB_FUNCTIONBASE
0022 
0023 //@PURPOSE: Share code for method and function declarations
0024 
0025 #include <lvtmdb_export.h>
0026 
0027 #include <ct_lvtmdb_databaseobject.h>
0028 
0029 #include <string>
0030 
0031 namespace Codethink::lvtmdb {
0032 
0033 // Forward Declarations
0034 class NamespaceObject;
0035 
0036 // =====================
0037 // class FunctionBase
0038 // =====================
0039 
0040 class LVTMDB_EXPORT FunctionBase : public DatabaseObject {
0041     // See locking discipline in superclass. That applies here.
0042 
0043   private:
0044     std::string d_signature;
0045     // Type signature of this function
0046 
0047     std::string d_returnType;
0048     // The return type of the function
0049 
0050     std::string d_templateParameters;
0051     // Optional template parameters for the function
0052 
0053   public:
0054     // CREATORS
0055     FunctionBase(std::string qualifiedName,
0056                  std::string name,
0057                  std::string signature,
0058                  std::string returnType,
0059                  std::string templateParameters);
0060 
0061     ~FunctionBase() noexcept override;
0062 
0063     FunctionBase(FunctionBase&& other) noexcept;
0064 
0065     FunctionBase& operator=(FunctionBase&& other) noexcept;
0066 
0067     // ACCESSORS
0068     [[nodiscard]] const std::string& signature() const;
0069 
0070     [[nodiscard]] const std::string& returnType() const;
0071 
0072     [[nodiscard]] const std::string& templateParameters() const;
0073 
0074     [[nodiscard]] std::string storageKey() const;
0075     // Functions with the same qualifiedName can be overloaded. Use this
0076     // key to get a unique string
0077 
0078     // CLASS METHODS
0079     static std::string getStorageKey(const std::string& qualifiedName,
0080                                      const std::string& signature,
0081                                      const std::string& templateParameters,
0082                                      const std::string& returnType);
0083 };
0084 
0085 } // namespace Codethink::lvtmdb
0086 
0087 #endif // INCLUDED_CT_LVTMDB_FUNCTIONBASE