File indexing completed on 2024-05-12 17:16:24

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  * http://kdesvn.alwins-world.de
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     svn_node_kind_t kind;
0042     qlonglong size;
0043     bool hasProps;
0044     svn_revnum_t createdRev;
0045     DateTime time;
0046     QString lastAuthor;
0047     LockEntry m_Lock;
0048 
0049     DirEntry_Data()
0050         : kind(svn_node_unknown), size(0), hasProps(false),
0051           createdRev(0), time(0), m_Lock()
0052     {
0053     }
0054 
0055     DirEntry_Data(const QString &_name, const svn_dirent_t *dirEntry)
0056         : name(_name), kind(dirEntry->kind), size(dirEntry->size),
0057           hasProps(dirEntry->has_props != 0),
0058           createdRev(dirEntry->created_rev), time(dirEntry->time), m_Lock()
0059     {
0060         lastAuthor = dirEntry->last_author == nullptr ? QString() : QString::fromUtf8(dirEntry->last_author);
0061     }
0062 
0063     DirEntry_Data(const DirEntry &src)
0064     {
0065         init(src);
0066     }
0067 
0068     void
0069     init(const DirEntry &src)
0070     {
0071         name = src.name();
0072         kind = src.kind();
0073         size = src.size();
0074         hasProps = src.hasProps();
0075         createdRev = src.createdRev();
0076         time = src.time();
0077         lastAuthor = src.lastAuthor();
0078         m_Lock = src.lockEntry();
0079     }
0080 };
0081 
0082 DirEntry::DirEntry()
0083     : m(new DirEntry_Data())
0084 {
0085 }
0086 
0087 DirEntry::DirEntry(const QString &name, const svn_dirent_t *dirEntry)
0088     : m(new DirEntry_Data(name, dirEntry))
0089 {
0090 }
0091 
0092 DirEntry::DirEntry(const QString &name, const svn_dirent_t *dirEntry, const svn_lock_t *lockEntry)
0093     : m(new DirEntry_Data(name, dirEntry))
0094 {
0095     setLock(lockEntry);
0096 }
0097 
0098 DirEntry::DirEntry(const QString &name, const svn_dirent_t *dirEntry, const LockEntry &lockEntry)
0099     : m(new DirEntry_Data(name, dirEntry))
0100 {
0101     m->m_Lock = lockEntry;
0102 }
0103 
0104 DirEntry::DirEntry(const DirEntry &src)
0105     : m(new DirEntry_Data(src))
0106 {
0107 }
0108 
0109 DirEntry::~DirEntry()
0110 {
0111     delete m;
0112 }
0113 
0114 svn_node_kind_t
0115 DirEntry::kind() const
0116 {
0117     return m->kind;
0118 }
0119 
0120 bool DirEntry::isDir()const
0121 {
0122     return kind() == svn_node_dir;
0123 }
0124 
0125 qlonglong
0126 DirEntry::size() const
0127 {
0128     return m->size;
0129 }
0130 
0131 bool
0132 DirEntry::hasProps() const
0133 {
0134     return m->hasProps;
0135 }
0136 
0137 svn_revnum_t
0138 DirEntry::createdRev() const
0139 {
0140     return m->createdRev;
0141 }
0142 
0143 const DateTime &
0144 DirEntry::time() const
0145 {
0146     return m->time;
0147 }
0148 
0149 const QString &
0150 DirEntry::lastAuthor() const
0151 {
0152     return m->lastAuthor;
0153 }
0154 
0155 const QString &
0156 DirEntry::name() const
0157 {
0158     return m->name;
0159 }
0160 
0161 const LockEntry &
0162 DirEntry::lockEntry() const
0163 {
0164     return m->m_Lock;
0165 }
0166 
0167 void
0168 DirEntry::setLock(const svn_lock_t *_l)
0169 {
0170     m->m_Lock.init(_l);
0171 }
0172 
0173 DirEntry &
0174 DirEntry::operator= (const DirEntry &dirEntry)
0175 {
0176     if (this == &dirEntry) {
0177         return *this;
0178     }
0179 
0180     m->init(dirEntry);
0181     return *this;
0182 }
0183 }
0184 
0185 /* -----------------------------------------------------------------
0186  * local variables:
0187  * eval: (load-file "../../rapidsvn-dev.el")
0188  * end:
0189  */