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

PlpDirent::PlpDirent(const PlpDirent &e) {
	size    = e.size;
	attr    = e.attr;
	time    = e.time;
	memcpy(uid, e.uid, sizeof(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;
}

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;
	memcpy(uid, e.uid, sizeof(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;
}