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

vcs

vcsannotation.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 "vcsannotation.h"
00022 
00023 #include <QtCore/QDateTime>
00024 #include <QtCore/QHash>
00025 #include <kurl.h>
00026 
00027 #include "vcsrevision.h"
00028 
00029 namespace KDevelop
00030 {
00031 
00032 class VcsAnnotationPrivate
00033 {
00034 public:
00035     QHash<int, VcsAnnotationLine> lines;
00036     KUrl location;
00037 };
00038 
00039 class VcsAnnotationLinePrivate
00040 {
00041 public:
00042     QString author;
00043     QDateTime date;
00044     QString text;
00045     QString line;
00046     VcsRevision revision;
00047     int lineno;
00048 };
00049 
00050 VcsAnnotationLine::VcsAnnotationLine()
00051     : d( new VcsAnnotationLinePrivate )
00052 {
00053     d->lineno = -1;
00054 }
00055 
00056 VcsAnnotationLine::VcsAnnotationLine( const VcsAnnotationLine& rhs )
00057     : d( new VcsAnnotationLinePrivate )
00058 {
00059     d->author = rhs.d->author;
00060     d->line = rhs.d->line;
00061     d->revision = rhs.d->revision;
00062     d->lineno = rhs.d->lineno;
00063     d->date = rhs.d->date;
00064     d->text = rhs.d->text;
00065 }
00066 
00067 VcsAnnotationLine::~VcsAnnotationLine()
00068 {
00069     delete d;
00070 }
00071 
00072 int VcsAnnotationLine::lineNumber() const
00073 {
00074     return d->lineno;
00075 }
00076 
00077 QString VcsAnnotationLine::text() const
00078 {
00079     return d->text;
00080 }
00081 
00082 QString VcsAnnotationLine::author() const
00083 {
00084     return d->author;
00085 }
00086 
00087 VcsRevision VcsAnnotationLine::revision() const
00088 {
00089     return d->revision;
00090 }
00091 
00092 QDateTime VcsAnnotationLine::date() const
00093 {
00094     return d->date;
00095 }
00096 
00097 void VcsAnnotationLine::setLineNumber( int lineno )
00098 {
00099     d->lineno = lineno;
00100 }
00101 
00102 void VcsAnnotationLine::setText( const QString& text )
00103 {
00104     d->text = text;
00105 }
00106 
00107 void VcsAnnotationLine::setAuthor( const QString& author )
00108 {
00109     d->author = author;
00110 }
00111 
00112 void VcsAnnotationLine::setRevision( const VcsRevision& revision )
00113 {
00114     d->revision = revision;
00115 }
00116 
00117 void VcsAnnotationLine::setDate( const QDateTime& date )
00118 {
00119     d->date = date;
00120 }
00121 
00122 VcsAnnotationLine& VcsAnnotationLine::operator=( const VcsAnnotationLine& rhs)
00123 {
00124     if(this == &rhs)
00125         return *this;
00126     d->author = rhs.d->author;
00127     d->line = rhs.d->line;
00128     d->revision = rhs.d->revision;
00129     d->lineno = rhs.d->lineno;
00130     d->date = rhs.d->date;
00131     d->text = rhs.d->text;
00132     return *this;
00133 }
00134 
00135 VcsAnnotation::VcsAnnotation()
00136     : d(new VcsAnnotationPrivate)
00137 {
00138 }
00139 
00140 VcsAnnotation::VcsAnnotation( const VcsAnnotation& rhs )
00141     : d(new VcsAnnotationPrivate)
00142 {
00143     d->lines = rhs.d->lines;
00144     d->location = rhs.d->location;
00145 }
00146 
00147 VcsAnnotation::~VcsAnnotation()
00148 {
00149     delete d;
00150 }
00151 
00152 KUrl VcsAnnotation::location() const
00153 {
00154     return d->location;
00155 }
00156 
00157 int VcsAnnotation::lineCount() const
00158 {
00159     return d->lines.count();
00160 }
00161 
00162 void VcsAnnotation::insertLine( int lineno, const VcsAnnotationLine& line )
00163 {
00164     if( lineno < 0 )
00165     {
00166         return;
00167     }
00168     d->lines.insert( lineno, line );
00169 }
00170 
00171 void VcsAnnotation::setLocation(const KUrl& u)
00172 {
00173     d->location = u;
00174 }
00175 
00176 VcsAnnotationLine VcsAnnotation::line( int lineno ) const
00177 {
00178     return d->lines[lineno];
00179 }
00180 
00181 VcsAnnotation& VcsAnnotation::operator=( const VcsAnnotation& rhs)
00182 {
00183     if(this == &rhs)
00184         return *this;
00185     d->location = rhs.d->location;
00186     d->lines = rhs.d->lines;
00187     return *this;
00188 }
00189 
00190 }
00191 

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
  •   duchain
  •   editor
  • outputview
  • 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