File indexing completed on 2024-05-05 16:41:08
0001 /* 0002 SPDX-FileCopyrightText: 2008 Milian Wolff <mail@milianw.de> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "namespacedeclaration.h" 0008 0009 #include <language/duchain/duchainregister.h> 0010 #include <completioncodemodel.h> 0011 0012 #include "helper.h" 0013 0014 namespace Php { 0015 REGISTER_DUCHAIN_ITEM(NamespaceDeclaration); 0016 0017 NamespaceDeclaration::NamespaceDeclaration(const NamespaceDeclaration& rhs) 0018 : KDevelop::Declaration(*new NamespaceDeclarationData(*rhs.d_func())) 0019 { 0020 } 0021 0022 NamespaceDeclaration::NamespaceDeclaration(const KDevelop::RangeInRevision& range, KDevelop::DUContext* context) 0023 : KDevelop::Declaration(*new NamespaceDeclarationData, range) 0024 { 0025 d_func_dynamic()->setClassId(this); 0026 if (context) { 0027 setContext(context); 0028 } 0029 } 0030 0031 NamespaceDeclaration::NamespaceDeclaration(NamespaceDeclarationData& data) 0032 : KDevelop::Declaration(data) 0033 { 0034 } 0035 0036 NamespaceDeclaration::~NamespaceDeclaration() 0037 { 0038 } 0039 0040 KDevelop::Declaration* NamespaceDeclaration::clonePrivate() const 0041 { 0042 return new NamespaceDeclaration(*this); 0043 } 0044 0045 KDevelop::IndexedString NamespaceDeclaration::prettyName() const 0046 { 0047 return d_func()->prettyName; 0048 } 0049 0050 void NamespaceDeclaration::setPrettyName( const KDevelop::IndexedString& name ) 0051 { 0052 bool wasInSymbolTable = d_func()->m_inSymbolTable; 0053 setInSymbolTable(false); 0054 d_func_dynamic()->prettyName = name; 0055 setInSymbolTable(wasInSymbolTable); 0056 } 0057 0058 QString NamespaceDeclaration::toString() const 0059 { 0060 QString ret(QStringLiteral("namespace ")); 0061 return ret + prettyName().str(); 0062 } 0063 0064 }