File indexing completed on 2024-05-12 13:48:13

0001 /*
0002  * Port for usage with qt-framework and development for kdesvn
0003  * Copyright (C) 2005-2009 by Rajko Albrecht (ral@alwins-world.de)
0004  * https://kde.org/applications/development/org.kde.kdesvn
0005  */
0006 /*
0007  * ====================================================================
0008  * Copyright (c) 2002-2005 The RapidSvn Group.  All rights reserved.
0009  * dev@rapidsvn.tigris.org
0010  *
0011  * This library is free software; you can redistribute it and/or
0012  * modify it under the terms of the GNU Lesser General Public
0013  * License as published by the Free Software Foundation; either
0014  * version 2.1 of the License, or (at your option) any later version.
0015  *
0016  * This library is distributed in the hope that it will be useful,
0017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0019  * Lesser General Public License for more details.
0020  *
0021  * You should have received a copy of the GNU Lesser General Public
0022  * License along with this library (in the file LGPL.txt); if not,
0023  * write to the Free Software Foundation, Inc., 51 Franklin St,
0024  * Fifth Floor, Boston, MA  02110-1301  USA
0025  *
0026  * This software consists of voluntary contributions made by many
0027  * individuals.  For exact contribution history, see the revision
0028  * history and logs, available at http://rapidsvn.tigris.org/.
0029  * ====================================================================
0030  */
0031 
0032 #include "annotate_line.h"
0033 
0034 namespace svn
0035 {
0036 AnnotateLine::AnnotateLine()
0037     : m_line_no(0)
0038     , m_revision(0)
0039     , m_merge_revision(0)
0040 {
0041 }
0042 
0043 AnnotateLine::AnnotateLine(qlonglong line_no,
0044                            qlonglong revision,
0045                            const char *author,
0046                            const char *date,
0047                            const char *line,
0048                            qlonglong merge_revision,
0049                            const char *merge_author,
0050                            const char *merge_date,
0051                            const char *merge_path)
0052     : m_line_no(line_no)
0053     , m_revision(revision)
0054     , m_date((date && strlen(date)) ? QDateTime::fromString(QString::fromUtf8(date), Qt::ISODate) : QDateTime())
0055     , m_line(line ? line : "")
0056     , m_author(author ? author : "")
0057     , m_merge_revision(merge_revision)
0058     , m_merge_date((merge_date && strlen(merge_date)) ? QDateTime::fromString(QString::fromUtf8(merge_date), Qt::ISODate) : QDateTime())
0059     , m_merge_author(merge_author ? merge_author : "")
0060     , m_merge_path(merge_path ? merge_path : "")
0061 {
0062 }
0063 
0064 AnnotateLine::AnnotateLine(qlonglong line_no,
0065                            qlonglong revision,
0066                            const PropertiesMap &revisionproperties,
0067                            const char *line,
0068                            qlonglong merge_revision,
0069                            const PropertiesMap &mergeproperties,
0070                            const char *merge_path,
0071                            qlonglong revstart,
0072                            qlonglong revend,
0073                            bool local)
0074     : m_line_no(line_no)
0075     , m_revision(revision)
0076     , m_date(QDateTime())
0077     , m_line(line ? QByteArray(line) : QByteArray())
0078     , m_merge_revision(merge_revision)
0079     , m_merge_path(merge_path ? QByteArray(merge_path) : QByteArray())
0080 {
0081     QString _s = revisionproperties[QStringLiteral("svn:author")];
0082     m_author = _s.toUtf8();
0083     _s = revisionproperties[QStringLiteral("svn:date")];
0084     if (!_s.isEmpty()) {
0085         m_date = QDateTime::fromString(_s, Qt::ISODate);
0086     }
0087     _s = mergeproperties[QStringLiteral("svn:author")];
0088     m_merge_author = _s.toUtf8();
0089     _s = mergeproperties[QStringLiteral("svn:date")];
0090     if (!_s.isEmpty()) {
0091         m_merge_date = QDateTime::fromString(_s, Qt::ISODate);
0092     }
0093 }
0094 }