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

0001 // ct_lvtmdb_fieldobject.cpp                                          -*-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 #include <ct_lvtmdb_fieldobject.h>
0021 
0022 namespace Codethink::lvtmdb {
0023 
0024 FieldObject::FieldObject(std::string qualifiedName,
0025                          std::string name,
0026                          std::string signature,
0027                          lvtshr::AccessSpecifier access,
0028                          bool isStatic,
0029                          TypeObject *parent):
0030     DatabaseObject(std::move(qualifiedName), std::move(name)),
0031     d_signature(std::move(signature)),
0032     d_access(access),
0033     d_isStatic(isStatic),
0034     d_parent_p(parent)
0035 {
0036 }
0037 
0038 FieldObject::~FieldObject() noexcept = default;
0039 
0040 FieldObject::FieldObject(FieldObject&&) noexcept = default;
0041 
0042 FieldObject& FieldObject::operator=(FieldObject&&) noexcept = default;
0043 
0044 const std::string& FieldObject::signature() const
0045 {
0046     assertReadable();
0047     return d_signature;
0048 }
0049 
0050 lvtshr::AccessSpecifier FieldObject::access() const
0051 {
0052     assertReadable();
0053     return d_access;
0054 }
0055 
0056 bool FieldObject::isStatic() const
0057 {
0058     assertReadable();
0059     return d_isStatic;
0060 }
0061 
0062 TypeObject *FieldObject::parent() const
0063 {
0064     assertReadable();
0065     return d_parent_p;
0066 }
0067 
0068 const std::vector<TypeObject *>& FieldObject::variableTypes() const
0069 {
0070     assertReadable();
0071     return d_variableTypes;
0072 }
0073 
0074 void FieldObject::addType(TypeObject *type)
0075 {
0076     assertWritable();
0077     MdbUtil::pushBackUnique(d_variableTypes, type);
0078 }
0079 
0080 } // namespace Codethink::lvtmdb