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