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
|
/*
*
* $Id: k3bfileitem.h 619556 2007-01-03 17:38:12Z trueg $
* Copyright (C) 2003 Sebastian Trueg <trueg@k3b.org>
*
* This file is part of the K3b project.
* Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* See the file "COPYING" for the exact licensing terms.
*/
#ifndef K3BFILEITEM_H
#define K3BFILEITEM_H
#include "k3bdataitem.h"
#include <k3bglobals.h>
#include <kio/global.h>
#include <tqstring.h>
#include "k3b_export.h"
class K3bDataDoc;
class K3bDirItem;
/**
*@author Sebastian Trueg
*/
class LIBK3B_EXPORT K3bFileItem : public K3bDataItem
{
public:
/**
* Creates a new K3bFileItem
*/
K3bFileItem( const TQString& fileName, K3bDataDoc* doc, K3bDirItem* dir, const TQString& k3bName = 0, int flags = 0 );
/**
* Constructor for optimized file item creation which does no additional stat.
*
* Used by K3b to speedup file item creation.
*/
K3bFileItem( const k3b_struct_stat* stat,
const k3b_struct_stat* followedStat,
const TQString& fileName, K3bDataDoc* doc, K3bDirItem* dir, const TQString& k3bName = 0 );
/**
* Default copy constructor
* Creates a copy of the fileitem. The copy, however, is not an exact duplicate of this item.
* The copy does not have a parent dir set and any old session items are set to 0.
*/
K3bFileItem( const K3bFileItem& );
virtual ~K3bFileItem();
virtual K3bDataItem* copy() const;
bool exists() const;
TQString absIsoPath();
/** reimplemented from K3bDataItem */
TQString localPath() const;
/**
* Identification of the files on the local device.
*/
struct Id {
dev_t device;
ino_t inode;
};
/**
* This is not the normal inode number but it also contains
* the device number.
*/
Id localId() const;
/**
* The id of the file the symlink is pointing to
*/
Id localId( bool followSymlinks ) const;
K3bDirItem* getDirItem() const;
bool isSymLink() const;
TQString linkDest() const;
bool isFile() const { return true; }
/** returns true if the item is not a link or
* if the link's destination is part of the compilation */
bool isValid() const;
K3bDataItem* replaceItemFromOldSession() const { return m_replacedItemFromOldSession; }
void setReplacedItemFromOldSession( K3bDataItem* item ) { m_replacedItemFromOldSession = item; }
/**
* Normally one does not use this method but K3bDataItem::size()
*/
TDEIO::filesize_t itemSize( bool followSymlinks ) const;
private:
K3bDataItem* m_replacedItemFromOldSession;
TDEIO::filesize_t m_size;
TDEIO::filesize_t m_sizeFollowed;
Id m_id;
Id m_idFollowed;
TQString m_localPath;
bool m_bSymLink;
};
bool operator==( const K3bFileItem::Id&, const K3bFileItem::Id& );
bool operator<( const K3bFileItem::Id&, const K3bFileItem::Id& );
bool operator>( const K3bFileItem::Id&, const K3bFileItem::Id& );
#endif
|