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

vcs

vcsmapping.cpp

00001 /***************************************************************************
00002  *   This file is part of KDevelop                                         *
00003  *   Copyright 2007 Andreas Pakulat <apaku@gmx.de>                     *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Library General Public License as       *
00007  *   published by the Free Software Foundation; either version 2 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU Library General Public     *
00016  *   License along with this program; if not, write to the                 *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
00019  ***************************************************************************/
00020 
00021 #include "vcsmapping.h"
00022 
00023 //Needed first as it provides a hash-function for QHash
00024 #include "vcslocation.h"
00025 
00026 #include <QtCore/QPair>
00027 #include <QtCore/QHash>
00028 
00029 
00030 namespace KDevelop
00031 {
00032 
00033 class VcsMappingPrivate
00034 {
00035     public:
00036         QHash<VcsLocation,QPair<VcsLocation, VcsMapping::MappingFlag> > mapping;
00037 };
00038 
00039 VcsMapping::VcsMapping()
00040     : d(new VcsMappingPrivate)
00041 {
00042 }
00043 
00044 VcsMapping::~VcsMapping()
00045 {
00046     delete d;
00047 }
00048 
00049 VcsMapping::VcsMapping( const VcsMapping& rhs )
00050     : d(new VcsMappingPrivate)
00051 {
00052     d->mapping = rhs.d->mapping;
00053 }
00054 
00055 void VcsMapping::addMapping( const VcsLocation& sourceLocation,
00056                     const VcsLocation& destinationLocation,
00057                     VcsMapping::MappingFlag recursion )
00058 {
00059     QPair<VcsLocation,VcsMapping::MappingFlag> val = qMakePair(destinationLocation,recursion);
00060     d->mapping[sourceLocation] = val;
00061 }
00062 
00063 void VcsMapping::removeMapping( const VcsLocation& sourceLocation)
00064 {
00065     if( d->mapping.contains(sourceLocation) )
00066         d->mapping.remove(sourceLocation);
00067 }
00068 
00069 QList<VcsLocation> VcsMapping::sourceLocations() const
00070 {
00071     return d->mapping.keys();
00072 }
00073 
00074 VcsLocation VcsMapping::destinationLocation( const VcsLocation& sourceLocation ) const
00075 {
00076     if( d->mapping.contains( sourceLocation ) )
00077         return d->mapping[sourceLocation].first;
00078     return QString();
00079 }
00080 
00081 VcsMapping::MappingFlag VcsMapping::mappingFlag( const VcsLocation& sourceLocation ) const
00082 {
00083     if( d->mapping.contains( sourceLocation ) )
00084         return d->mapping[sourceLocation].second;
00085     return NonRecursive;
00086 }
00087 
00088 
00089 VcsMapping& VcsMapping::operator=( const VcsMapping& rhs)
00090 {
00091     if(this == &rhs)
00092         return *this;
00093     d->mapping = rhs.d->mapping;
00094     return *this;
00095 }
00096 
00097 }
00098 

vcs

Skip menu "vcs"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

KDevelop Platform Libraries

Skip menu "KDevelop Platform Libraries"
  • interfaces
  • language
  •   codegen
  •   duchain
  •   editor
  • outputview
  •     interfaces
  • project
  • shell
  • sublime
  • util
  • vcs
Generated for KDevelop Platform Libraries by doxygen 1.5.4
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