• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • KDevelop Platform Libraries
  • Sitemap
  • Contact Us
 

language/duchain

abstractfunctiondeclaration.cpp

00001 /* This file is part of KDevelop
00002     Copyright 2007 Hamish Rodda <rodda@kde.org>
00003     Copyright 2007-2008 David Nolden <david.nolden.kdevelop@art-master.de>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License version 2 as published by the Free Software Foundation.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include "abstractfunctiondeclaration.h"
00021 #include <QStringList>
00022 #include "types/functiontype.h"
00023 #include "declaration.h"
00024 
00025 namespace KDevelop {
00026 
00027 AbstractFunctionDeclaration::~AbstractFunctionDeclaration() {
00028 }
00029 
00030 bool AbstractFunctionDeclaration::isVirtual() const
00031 {
00032   return data()->m_isVirtual;
00033 }
00034 
00035 void AbstractFunctionDeclaration::setVirtual(bool isVirtual)
00036 {
00037   dynamicData()->m_isVirtual = isVirtual;
00038 }
00039 
00040 bool AbstractFunctionDeclaration::isInline() const
00041 {
00042   return data()->m_isInline;
00043 }
00044 
00045 void AbstractFunctionDeclaration::setInline(bool isInline)
00046 {
00047   dynamicData()->m_isInline = isInline;
00048 }
00049 
00050 bool AbstractFunctionDeclaration::isExplicit() const
00051 {
00052   return data()->m_isExplicit;
00053 }
00054 
00055 void AbstractFunctionDeclaration::setExplicit(bool isExplicit)
00056 {
00057   dynamicData()->m_isExplicit = isExplicit;
00058 }
00059 
00060 void AbstractFunctionDeclaration::setFunctionSpecifiers(FunctionSpecifiers specifiers)
00061 {
00062   dynamicData()->m_isInline = specifiers & InlineSpecifier;
00063   dynamicData()->m_isExplicit = specifiers & ExplicitSpecifier;
00064   dynamicData()->m_isVirtual = specifiers & VirtualSpecifier;
00065 }
00066 
00067 IndexedString AbstractFunctionDeclaration::defaultParameterForArgument(int index) const {
00068   FunctionType::Ptr fType = dynamic_cast<const Declaration*>(this)->type<FunctionType>();
00069   if(index >= 0 && index < fType->arguments().size()) {
00070     index -= (fType->arguments().size() - defaultParametersSize());
00071     if(index >= 0 && index < defaultParametersSize())
00072       return defaultParameters()[index];
00073   }
00074   
00075   return IndexedString();
00076 }
00077 
00078 DUContext* AbstractFunctionDeclaration::internalFunctionContext() const {
00079   const Declaration* selfDecl = dynamic_cast<const Declaration*>(this);
00080   Q_ASSERT(selfDecl);
00081   DUContext* ctx = selfDecl->internalContext();
00082   //Follow the context imports until a function context is found
00083   while(ctx && ctx->type() != DUContext::Function) {
00084     QVector< DUContext::Import > imports = ctx->importedParentContexts();
00085     if(!imports.isEmpty()) {
00086       ctx = imports.first().context(selfDecl->topContext());
00087     }else{
00088       return 0;
00089     }
00090   }
00091   return ctx;
00092 }
00093 
00094 
00095 }
00096 
00097 
00098 // kate: space-indent on; indent-width 2; tab-width 4; replace-tabs on; auto-insert-doxygen on

language/duchain

Skip menu "language/duchain"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

KDevelop Platform Libraries

Skip menu "KDevelop Platform Libraries"
  • interfaces
  • language
  •   codegen
  •   duchain
  •   editor
  • outputview
  • project
  • shell
  • sublime
  • util
  • vcs
Generated for KDevelop Platform Libraries by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal