aboutsummaryrefslogtreecommitdiffstats
path: root/lib/plpdirent.cc
blob: 33e1a78abbdc11a7802903153fd415c541260382 (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
#include <plpdirent.h>
#include <stream.h>
#include <iomanip>

PlpUID::PlpUID() {
	memset(uid, 0, sizeof(uid));
}

PlpUID::PlpUID(const long u1, const long u2, const long u3) {
	uid[0] = u1; uid[1] = u2; uid[2] = u3;
}

long PlpUID::
operator[](int idx) {
	assert ((idx > -1) && (idx < 3));
	return uid[idx];
}

PlpDirent::PlpDirent(const PlpDirent &e) {
	size    = e.size;
	attr    = e.attr;
	time    = e.time;
	UID     = e.UID;
	name    = e.name;
	attrstr = e.attrstr;
}

long PlpDirent::
getSize() {
	return size;
}

long PlpDirent::
getAttr() {
	return attr;
}

long PlpDirent::
getUID(int uididx) {
	if ((uididx >= 0) && (uididx < 4))
		return UID[uididx];
	return 0;
}

PlpUID &PlpDirent::
getUID() {
	return UID;
}

const char *PlpDirent::
getName() {
	return name.c_str();
}

PsiTime PlpDirent::
getPsiTime() {
	return time;
}

void PlpDirent::
setName(const char *str) {
	name = str;
}

PlpDirent &PlpDirent::
operator=(const PlpDirent &e) {
	size    = e.size;
	attr    = e.attr;
	time    = e.time;
	UID     = e.UID;
	name    = e.name;
	attrstr = e.attrstr;
	return *this;
}

ostream &
operator<<(ostream &o, const PlpDirent &e) {
	ostream::fmtflags old = o.flags();

	o << e.attrstr << " " << dec << setw(10)
	  << setfill(' ') << e.size << " " << e.time
	  << " " << e.name;
	o.flags(old);
	return o;
}