File indexing completed on 2024-04-28 05:42:10

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 // svncpp
0033 #include "dirent.h"
0034 
0035 namespace svn
0036 {
0037 class SVNQT_NOEXPORT DirEntry_Data
0038 {
0039 public:
0040     QString name;
0041     QString lastAuthor;
0042     DateTime time;
0043     LockEntry m_Lock;
0044     qlonglong size = 0;
0045     svn_revnum_t createdRev = 0;
0046     svn_node_kind_t kind = svn_node_unknown;
0047     bool hasProps = false;
0048 
0049     DirEntry_Data() = default;
0050     DirEntry_Data(const QString &_name, const svn_dirent_t *dirEntry)
0051         : name(_name)
0052         , time(dirEntry->time)
0053         , size(dirEntry->size)
0054         , createdRev(dirEntry->created_rev)
0055         , kind(dirEntry->kind)
0056         , hasProps(dirEntry->has_props != 0)
0057     {
0058         lastAuthor = dirEntry->last_author == nullptr ? QString() : QString::fromUtf8(dirEntry->last_author);
0059     }
0060 };
0061 
0062 DirEntry::DirEntry()
0063     : m(new DirEntry_Data)
0064 {
0065 }
0066 
0067 DirEntry::DirEntry(const QString &name, const svn_dirent_t *dirEntry)
0068     : m(new DirEntry_Data(name, dirEntry))
0069 {
0070 }
0071 
0072 DirEntry::DirEntry(const QString &name, const svn_dirent_t *dirEntry, const svn_lock_t *lockEntry)
0073     : m(new DirEntry_Data(name, dirEntry))
0074 {
0075     setLock(lockEntry);
0076 }
0077 
0078 DirEntry::DirEntry(const QString &name, const svn_dirent_t *dirEntry, const LockEntry &lockEntry)
0079     : m(new DirEntry_Data(name, dirEntry))
0080 {
0081     m->m_Lock = lockEntry;
0082 }
0083 
0084 DirEntry::DirEntry(const DirEntry &src)
0085     : m(new DirEntry_Data(*src.m))
0086 {
0087 }
0088 
0089 DirEntry::~DirEntry()
0090 {
0091     delete m;
0092 }
0093 
0094 svn_node_kind_t DirEntry::kind() const
0095 {
0096     return m->kind;
0097 }
0098 
0099 bool DirEntry::isDir() const
0100 {
0101     return kind() == svn_node_dir;
0102 }
0103 
0104 qlonglong DirEntry::size() const
0105 {
0106     return m->size;
0107 }
0108 
0109 bool DirEntry::hasProps() const
0110 {
0111     return m->hasProps;
0112 }
0113 
0114 svn_revnum_t DirEntry::createdRev() const
0115 {
0116     return m->createdRev;
0117 }
0118 
0119 const DateTime &DirEntry::time() const
0120 {
0121     return m->time;
0122 }
0123 
0124 const QString &DirEntry::lastAuthor() const
0125 {
0126     return m->lastAuthor;
0127 }
0128 
0129 const QString &DirEntry::name() const
0130 {
0131     return m->name;
0132 }
0133 
0134 const LockEntry &DirEntry::lockEntry() const
0135 {
0136     return m->m_Lock;
0137 }
0138 
0139 void DirEntry::setLock(const svn_lock_t *_l)
0140 {
0141     m->m_Lock.init(_l);
0142 }
0143 
0144 DirEntry &DirEntry::operator=(const DirEntry &dirEntry)
0145 {
0146     if (this == &dirEntry) {
0147         return *this;
0148     }
0149 
0150     *m = *dirEntry.m;
0151     return *this;
0152 }
0153 }
0154 
0155 /* -----------------------------------------------------------------
0156  * local variables:
0157  * eval: (load-file "../../rapidsvn-dev.el")
0158  * end:
0159  */