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 "lock_entry.h"
0034 #include "pool.h"
0035 
0036 // subversion api
0037 #include <svn_time.h>
0038 #include <svn_version.h>
0039 
0040 namespace svn
0041 {
0042 LockEntry::LockEntry()
0043     : date(0)
0044     , exp(0)
0045     , locked(false)
0046 {
0047 }
0048 
0049 LockEntry::LockEntry(const apr_time_t lock_time, const apr_time_t expiration_time, const char *lock_owner, const char *lock_comment, const char *lock_token)
0050     : date(lock_time)
0051     , exp(expiration_time)
0052     , owner(lock_owner ? QString::fromUtf8(lock_owner) : QString())
0053     , comment(lock_comment ? QString::fromUtf8(lock_comment) : QString())
0054     , token(lock_token ? QString::fromUtf8(lock_token) : QString())
0055     , locked(lock_token ? true : false)
0056 {
0057 }
0058 const QString &LockEntry::Comment() const
0059 {
0060     return comment;
0061 }
0062 const QString &LockEntry::Owner() const
0063 {
0064     return owner;
0065 }
0066 const QString &LockEntry::Token() const
0067 {
0068     return token;
0069 }
0070 const DateTime &LockEntry::Date() const
0071 {
0072     return date;
0073 }
0074 const DateTime &LockEntry::Expiration() const
0075 {
0076     return exp;
0077 }
0078 bool LockEntry::Locked() const
0079 {
0080     return locked;
0081 }
0082 void LockEntry::init(const svn_wc_entry_t *src)
0083 {
0084     if (src) {
0085         date = DateTime(src->lock_creation_date);
0086         locked = src->lock_token ? true : false;
0087         token = (src->lock_token ? QString::fromUtf8(src->lock_token) : QString());
0088         comment = (src->lock_comment ? QString::fromUtf8(src->lock_comment) : QString());
0089         owner = (src->lock_owner ? QString::fromUtf8(src->lock_owner) : QString());
0090     } else {
0091         date = DateTime();
0092         owner.clear();
0093         comment.clear();
0094         token.clear();
0095         locked = false;
0096     }
0097     exp = DateTime();
0098 }
0099 
0100 void LockEntry::init(const svn_lock_t *src)
0101 {
0102     if (src) {
0103         date = DateTime(src->creation_date);
0104         locked = src->token ? true : false;
0105         token = (src->token ? QString::fromUtf8(src->token) : QString());
0106         comment = (src->comment ? QString::fromUtf8(src->comment) : QString());
0107         owner = (src->owner ? QString::fromUtf8(src->owner) : QString());
0108     } else {
0109         date = DateTime();
0110         owner.clear();
0111         comment.clear();
0112         token.clear();
0113         locked = false;
0114     }
0115     exp = DateTime();
0116 }
0117 
0118 void LockEntry::init(const apr_time_t lock_time, const apr_time_t expiration_time, const char *lock_owner, const char *lock_comment, const char *lock_token)
0119 {
0120     date = DateTime(lock_time);
0121     exp = DateTime(expiration_time);
0122     locked = lock_token ? true : false;
0123     token = lock_token ? QString::fromUtf8(lock_token) : QString();
0124     owner = lock_owner ? QString::fromUtf8(lock_owner) : QString();
0125     comment = lock_comment ? QString::fromUtf8(lock_comment) : QString();
0126 }
0127 }
0128 
0129 /* -----------------------------------------------------------------
0130  * local variables:
0131  * eval: (load-file "../../rapidsvn-dev.el")
0132  * end:
0133  */