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

0001 // ct_lvtmdb_variableobject.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_VARIABLEOBJECT
0021 #define INCLUDED_CT_LVTMDB_VARIABLEOBJECT
0022 
0023 #include <lvtmdb_export.h>
0024 
0025 #include <ct_lvtmdb_databaseobject.h>
0026 
0027 #include <string>
0028 
0029 namespace Codethink::lvtmdb {
0030 
0031 // Forward Declarations
0032 class NamespaceObject;
0033 
0034 // ===================
0035 // class VariableObject
0036 // ===================
0037 
0038 class LVTMDB_EXPORT VariableObject : public DatabaseObject {
0039     // See locking discipline in superclass. That applies here.
0040 
0041   private:
0042     std::string d_signature;
0043     // Type signature of this variable
0044 
0045     bool d_isGlobal;
0046     // True if the variable isn't in a namespace
0047 
0048     NamespaceObject *d_parent_p;
0049 
0050   public:
0051     // CREATORS
0052     VariableObject(
0053         std::string qualifiedName, std::string name, std::string signature, bool isGlobal, NamespaceObject *parent);
0054 
0055     ~VariableObject() noexcept override;
0056 
0057     VariableObject(VariableObject&& other) noexcept;
0058 
0059     VariableObject& operator=(VariableObject&& other) noexcept;
0060 
0061     // ACCESSORS
0062     [[nodiscard]] const std::string& signature() const;
0063 
0064     [[nodiscard]] bool isGlobal() const;
0065 
0066     [[nodiscard]] NamespaceObject *parent() const;
0067 };
0068 
0069 } // namespace Codethink::lvtmdb
0070 
0071 #endif // INCLUDED_CT_LVTMDB_VARIABLEOBJECT