summaryrefslogtreecommitdiffstats
path: root/src/svnqt/entry.cpp
blob: ae297813e5519ebf2439a8e9bd6f6a05bc96f9d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
/*
 * Port for usage with tqt-framework and development for tdesvn
 * (C) 2005-2007 by Rajko Albrecht
 * http://tdesvn.alwins-world.de
 */
/*
 * ====================================================================
 * Copyright (c) 2002-2005 The RapidSvn Group.  All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library (in the file LGPL.txt); if not,
 * write to the Free Software Foundation, Inc., 51 Franklin St,
 * Fifth Floor, Boston, MA  02110-1301  USA
 *
 * This software consists of voluntary contributions made by many
 * individuals.  For exact contribution history, see the revision
 * history and logs, available at http://rapidsvn.tigris.org/.
 * ====================================================================
 */

// svncpp
#include "entry.h"

namespace svn
{
    class SVNTQT_NOEXPORT Entry_private
    {
    protected:
        void init_clean();
    public:
        Entry_private();
        Entry_private(const Entry_private&src);
        virtual ~Entry_private();

        bool m_valid;
        LockEntry m_Lock;

        TQString _name,_url,_repos,_uuid,_copyfrom_url,_conflict_old,_conflict_new,_conflict_wrk,_prejfile,_checksum,_cmt_author;
        bool _copied,_deleted,_absent,_incomplete;
        svn_revnum_t _revision,_copyfrom_rev,_cmt_rev;
        svn_node_kind_t _kind;
        svn_wc_schedule_t _schedule;
        DateTime _text_time,_prop_time,_cmt_date;

        /**
        * initializes the members
        */
        void
        init (const svn_wc_entry_t * src);
        void
        init(const Entry_private&src);
        void
        init(const TQString&url,const DirEntryPtr&src);
        void
        init(const TQString&url,const InfoEntry&src);
    };

    void Entry_private::init_clean()
    {
        _name = _url = _repos = _uuid = _copyfrom_url = _conflict_old = _conflict_new = _conflict_wrk
            = _prejfile = _checksum = _cmt_author = TQString();
        _revision = _copyfrom_rev = _cmt_rev = -1;
        _kind = svn_node_unknown;
        _schedule = svn_wc_schedule_normal;
        _text_time = _prop_time = _cmt_date = 0;
        _copied = _deleted = _absent = _incomplete = false;
    }

    Entry_private::Entry_private()
        : m_valid (false),m_Lock()
    {
        init_clean();
    }

    Entry_private::Entry_private(const Entry_private&src)
        : m_valid (false),m_Lock()
    {
        init_clean();
        init(src);
    }

    Entry_private::~Entry_private()
    {
    }

    void
    Entry_private::init (const svn_wc_entry_t * src)
    {
        if (src) {
            // copy & convert the contents of src
            _name = TQString::FROMUTF8(src->name);
            _revision = src->revision;
            _url = TQString::FROMUTF8(src->url);
            _repos = TQString::FROMUTF8(src->repos);
            _uuid = TQString::FROMUTF8(src->uuid);
            _kind = src->kind;
            _schedule = src->schedule;
            _copied = src->copied!=0;
            _deleted = src->deleted!=0;
            _absent = src->absent!=0;
            _incomplete = src->incomplete!=0;
            _copyfrom_url=TQString::FROMUTF8(src->copyfrom_url);
            _copyfrom_rev = src->copyfrom_rev;
            _conflict_old = TQString::FROMUTF8(src->conflict_old);
            _conflict_new = TQString::FROMUTF8(src->conflict_new);
            _conflict_wrk = TQString::FROMUTF8(src->conflict_wrk);
            _prejfile = TQString::FROMUTF8(src->prejfile);
            _text_time = src->text_time;
            _prop_time = src->prop_time;
            _checksum = TQString::FROMUTF8(src->checksum);
            _cmt_rev = src->cmt_rev;
            _cmt_date = src->cmt_date;
            _cmt_author = TQString::FROMUTF8(src->cmt_author);
            m_Lock.init(src);
            m_valid = true;
        } else {
            m_valid = false;
            m_Lock=LockEntry();
            _name=
            _url=_repos=_uuid=_copyfrom_url=_conflict_old=_conflict_new=_conflict_wrk=_prejfile=_checksum=_cmt_author= TQString();
            _copied=_deleted=_absent=_incomplete = false;
            _kind = svn_node_unknown;
            _schedule=svn_wc_schedule_normal;
            _text_time=_prop_time=_cmt_date=0;
        }
    }
    void
    Entry_private::init(const Entry_private&src)
    {
        _name=src._name;
        _url=src._url;
        _repos=src._repos;
        _uuid=src._uuid;
        _copyfrom_url=src._copyfrom_url;
        _conflict_old=src._conflict_old;
        _conflict_new=src._conflict_new;
        _conflict_wrk=src._conflict_wrk;
        _prejfile=src._prejfile;
        _checksum=src._checksum;
        _cmt_author=src._cmt_author;
        _copied=src._copied;
        _deleted=src._deleted;
        _absent=src._absent;
        _incomplete=src._incomplete;
        _revision=src._revision;
        _copyfrom_rev=src._copyfrom_rev;
        _cmt_rev=src._cmt_rev;
        _kind=src._kind;
        _schedule=src._schedule;
        _text_time=src._text_time;
        _prop_time=src._prop_time;
        _cmt_date=src._cmt_date;
        _kind = src._kind;
        m_Lock=src.m_Lock;
        m_valid=src.m_valid;
    }

    void Entry_private::init(const TQString&url,const DirEntryPtr&dirEntry)
    {
        init(0);
        _url = url;
        if (dirEntry) {
            _name=dirEntry->name();
            _revision = dirEntry->createdRev();
            _kind = dirEntry->kind();
            _schedule = svn_wc_schedule_normal;
            _text_time = dirEntry->time ();
            _prop_time = dirEntry->time ();
            _cmt_rev = dirEntry->createdRev ();
            _cmt_date = dirEntry->time ();
            _cmt_author = dirEntry->lastAuthor ();
            m_Lock=dirEntry->lockEntry();
            m_valid = true;
        }
    }

    void Entry_private::init(const TQString&url,const InfoEntry&src)
    {
        init(0);
        _name = src.Name();
        _url = url;
        _revision = src.revision();
        _kind = src.kind ();
        _schedule = svn_wc_schedule_normal;
        _text_time = src.textTime ();
        _prop_time = src.propTime ();
        _cmt_rev = src.cmtRev ();
        _cmt_date = src.cmtDate();
        _cmt_author = src.cmtAuthor();
        m_Lock=src.lockEntry();
        m_valid = true;
    }

  Entry::Entry (const svn_wc_entry_t * src)
    : m_Data(new Entry_private())
  {
    m_Data->init (src);
  }

  Entry::Entry (const Entry & src)
    : m_Data(new Entry_private())
  {
    if (src.m_Data) {
        m_Data->init(*(src.m_Data));
    } else {
        m_Data->init(0);
    }
  }

  Entry::Entry (const TQString&url,const DirEntryPtr&src)
    : m_Data(new Entry_private())
  {
    m_Data->init(url,src);
  }

  Entry::Entry (const TQString&url,const InfoEntry&src)
    : m_Data(new Entry_private())
  {
    m_Data->init(url,src);
  }

  Entry::~Entry ()
  {
    delete m_Data;
  }

  Entry &
  Entry::operator = (const Entry & src)
  {
    if (this == &src)
      return *this;
    if (src.m_Data) {
        m_Data->init(*(src.m_Data));
    } else {
        m_Data->init(0);
    }
    return *this;
  }

  const LockEntry&
  Entry::lockEntry()const
  {
      return m_Data->m_Lock;
  }

  const TQString&
  Entry::cmtAuthor () const
  {
    return m_Data->_cmt_author;
  }

  const DateTime&
  Entry::cmtDate () const
  {
    return m_Data->_cmt_date;
  }

  svn_revnum_t
  Entry::cmtRev () const
  {
    return m_Data->_cmt_rev;
  }
  const TQString&
  Entry::checksum () const
  {
    return m_Data->_checksum;
  }

  const DateTime&
  Entry::propTime () const
  {
    return m_Data->_prop_time;
  }

    const DateTime&
    Entry::textTime () const
    {
      return m_Data->_text_time;
    }
    const TQString&
    Entry::prejfile () const
    {
      return m_Data->_prejfile;
    }
    const TQString&
    Entry::conflictWrk () const
    {
      return m_Data->_conflict_wrk;
    }

    const TQString&
    Entry::conflictNew () const
    {
      return m_Data->_conflict_new;
    }
    const TQString&
    Entry::conflictOld () const
    {
      return m_Data->_conflict_old;
    }
    svn_revnum_t
    Entry::copyfromRev () const
    {
      return m_Data->_copyfrom_rev;
    }
    const TQString&
    Entry::copyfromUrl () const
    {
      return m_Data->_copyfrom_url;
    }

    bool
    Entry::isAbsent () const
    {
      return m_Data->_absent;
    }
    bool
    Entry::isDeleted () const
    {
      return m_Data->_deleted != 0;
    }
    bool
    Entry::isCopied () const
    {
      return m_Data->_copied != 0;
    }
    svn_wc_schedule_t
    Entry::schedule () const
    {
      return m_Data->_schedule;
    }
    svn_node_kind_t
    Entry::kind () const
    {
      return m_Data->_kind;
    }
    const TQString&
    Entry::uuid () const
    {
      return m_Data->_uuid;
    }
    const TQString&
    Entry::repos () const
    {
      return m_Data->_repos;
    }
    const TQString&
    Entry::url () const
    {
      return m_Data->_url;
    }
    svn_revnum_t
    Entry::revision () const
    {
      return m_Data->_revision;
    }
    const TQString&
    Entry::name () const
    {
      return m_Data->_name;
    }

    bool Entry::isValid () const
    {
      return m_Data->m_valid;
    }
}

/*!
    \fn svn::Entry::isDir()
 */
bool svn::Entry::isDir() const
{
    return kind()==svn_node_dir;
}


/*!
    \fn svn::Entry::isFile()
 */
bool svn::Entry::isFile() const
{
    return kind()==svn_node_file;
}