plptools
Loading...
Searching...
No Matches
plpdirent.h
Go to the documentation of this file.
1/*
2 * This file is part of plptools.
3 *
4 * Copyright (C) 1999-2001 Fritz Elfert <felfert@to.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * along with this program; if not, see <https://www.gnu.org/licenses/>.
18 *
19 */
20#ifndef _PLPDIRENT_H_
21#define _PLPDIRENT_H_
22
23#include <iostream>
24#include <string>
25#include <cstring>
26
27#include "psitime.h"
28#include "rfsv.h"
29
39class PlpUID
40{
41 friend inline bool operator<(const PlpUID &u1, const PlpUID &u2);
42public:
46 PlpUID();
47
52 PlpUID(const uint32_t u1, const uint32_t u2, const uint32_t u3);
53
60 uint32_t operator[](int idx);
61
62private:
63 long uid[3];
64};
65
66inline bool operator<(const PlpUID &u1, const PlpUID &u2) {
67 return (memcmp(u1.uid, u2.uid, sizeof(u1.uid)) < 0);
68}
69
78class PlpDirent {
79 friend class rfsv32;
80 friend class rfsv16;
81
82public:
86 PlpDirent();
87
94 PlpDirent(const PlpDirent &d);
95
99 PlpDirent(const uint32_t size, const uint32_t attr, const uint32_t tHi,
100 const uint32_t tLo, const char * const name);
101
106
112 uint32_t getSize();
113
119 uint32_t getAttr();
120
129 uint32_t getUID(int uididx);
130
136 PlpUID &getUID();
137
143 const char *getName();
144
151
160 void setName(const char *str);
161
170 PlpDirent &operator=(const PlpDirent &e);
171
177 friend std::ostream &operator<<(std::ostream &o, const PlpDirent &e);
178
179private:
180 uint32_t size;
181 uint32_t attr;
184 std::string attrstr;
185 std::string name;
186};
187
196class PlpDrive {
197 friend class rfsv32;
198 friend class rfsv16;
199
200public:
204 PlpDrive();
205
209 PlpDrive(const PlpDrive &other);
210
231 uint32_t getMediaType();
232
240 void getMediaType(std::string &ret);
241
259 uint32_t getDriveAttribute();
260
268 void getDriveAttribute(std::string &ret);
269
285 uint32_t getMediaAttribute();
286
294 void getMediaAttribute(std::string &ret);
295
303 uint32_t getUID();
304
310 uint64_t getSize();
311
317 uint64_t getSpace();
318
324 std::string getName();
325
331 char getDrivechar();
332
333private:
334 void setMediaType(uint32_t type);
335 void setDriveAttribute(uint32_t attr);
336 void setMediaAttribute(uint32_t attr);
337 void setUID(uint32_t uid);
338 void setSize(uint32_t sizeLo, uint32_t sizeHi);
339 void setSpace(uint32_t spaceLo, uint32_t spaceHi);
340 void setName(char drive, const char * const volname);
341
342 uint32_t mediatype;
343 uint32_t driveattr;
344 uint32_t mediaattr;
345 uint32_t uid;
346 uint64_t size;
347 uint64_t space;
349 std::string name;
350};
351
352#endif
A class, representing a directory entry of the Psion.
Definition: plpdirent.h:78
PlpUID & getUID()
Retrieves the PlpUID object of a directory entry.
Definition: plpdirent.cc:84
~PlpDirent()
Default destructor.
Definition: plpdirent.h:105
std::string attrstr
Definition: plpdirent.h:184
uint32_t getSize()
Retrieves the file size of a directory entry.
Definition: plpdirent.cc:67
uint32_t getAttr()
Retrieves the file attributes of a directory entry.
Definition: plpdirent.cc:72
const char * getName()
Retrieve the file name of a directory entry.
Definition: plpdirent.cc:89
PsiTime time
Definition: plpdirent.h:183
std::string name
Definition: plpdirent.h:185
PlpDirent()
Default constructor.
Definition: plpdirent.cc:42
friend std::ostream & operator<<(std::ostream &o, const PlpDirent &e)
Prints the object contents.
Definition: plpdirent.cc:115
PlpUID UID
Definition: plpdirent.h:182
void setName(const char *str)
Set the file name of a directory entry.
Definition: plpdirent.cc:99
uint32_t attr
Definition: plpdirent.h:181
PsiTime getPsiTime()
Retrieve the modification time of a directory entry.
Definition: plpdirent.cc:94
uint32_t size
Definition: plpdirent.h:180
PlpDirent & operator=(const PlpDirent &e)
Assignment operator Mainly used by STL container classes.
Definition: plpdirent.cc:104
A class representing information about a Disk drive on the psion.
Definition: plpdirent.h:196
PlpDrive()
Default constructor.
Definition: plpdirent.cc:125
void setUID(uint32_t uid)
Definition: plpdirent.cc:147
uint32_t getMediaAttribute()
Retrieve the attributes of the media.
Definition: plpdirent.cc:220
void setSpace(uint32_t spaceLo, uint32_t spaceHi)
Definition: plpdirent.cc:157
void setSize(uint32_t sizeLo, uint32_t sizeHi)
Definition: plpdirent.cc:152
std::string getName()
Retrieve the volume name of the drive.
Definition: plpdirent.cc:254
uint32_t uid
Definition: plpdirent.h:345
std::string name
Definition: plpdirent.h:349
char getDrivechar()
Retrieve the drive letter of the drive.
Definition: plpdirent.cc:259
uint64_t getSize()
Retrieve the total capacity of the drive.
Definition: plpdirent.cc:244
void setMediaAttribute(uint32_t attr)
Definition: plpdirent.cc:142
uint32_t getDriveAttribute()
Retrieve the attributes of the drive.
Definition: plpdirent.cc:191
uint32_t driveattr
Definition: plpdirent.h:343
uint32_t mediatype
Definition: plpdirent.h:342
uint32_t getMediaType()
Retrieve the media type of the drive.
Definition: plpdirent.cc:169
uint64_t size
Definition: plpdirent.h:346
uint64_t space
Definition: plpdirent.h:347
void setName(char drive, const char *const volname)
Definition: plpdirent.cc:162
void setMediaType(uint32_t type)
Definition: plpdirent.cc:132
char drivechar
Definition: plpdirent.h:348
uint32_t getUID()
Retrieve the UID of the drive.
Definition: plpdirent.cc:239
void setDriveAttribute(uint32_t attr)
Definition: plpdirent.cc:137
uint32_t mediaattr
Definition: plpdirent.h:344
uint64_t getSpace()
Retrieve the free capacity on the drive.
Definition: plpdirent.cc:249
A class, representing the UIDs of a file on the Psion.
Definition: plpdirent.h:40
friend bool operator<(const PlpUID &u1, const PlpUID &u2)
Definition: plpdirent.h:66
long uid[3]
Definition: plpdirent.h:63
PlpUID()
Default constructor.
Definition: plpdirent.cc:28
uint32_t operator[](int idx)
Retrieve a UID value.
Definition: plpdirent.cc:37
Psion time related utility class.
Definition: psitime.h:125
This is the implementation of the rfsv protocol for Psion series 3 (SIBO) variant.
Definition: rfsv16.h:35
This is the implementation of the rfsv protocol for Psion series 5 (EPOC) variant.
Definition: rfsv32.h:37
bool operator<(const PlpUID &u1, const PlpUID &u2)
Definition: plpdirent.h:66