diff options
author | Fritz Elfert <felfert@to.com> | 2001-02-06 01:01:46 +0000 |
---|---|---|
committer | Fritz Elfert <felfert@to.com> | 2001-02-06 01:01:46 +0000 |
commit | a9fe8f28a4a9aaf1d9b84dbc6907849ace87f66e (patch) | |
tree | 0dd290cdf04cfd17a4ab4d0eb86bcb48137a02cb /lib/plpdirent.cc | |
parent | a8787d39b2bf1851cdea64a5e0eccc2aff7f15de (diff) | |
download | plptools-a9fe8f28a4a9aaf1d9b84dbc6907849ace87f66e.tar.gz plptools-a9fe8f28a4a9aaf1d9b84dbc6907849ace87f66e.tar.bz2 plptools-a9fe8f28a4a9aaf1d9b84dbc6907849ace87f66e.zip |
- Added KDE2 PropsDialog Plugin (incomplete)
- Fixed some KDE related autoconf stuff
- Added PlpDrive class for returning results from rfsv:devinfo
- Added auto-watch in ppsocket and finally got rid of the nasty
SIGPIPE bug. Now it's no more necessary to ignore SIGPIPE in
applications.
- Made constructors of rfsv16, rfsv32, rpcs16 and rpcs32 private to
enforce use of the factories.
- Removed error output in the factories and replaced that by error codes
which can be retrieved and evaluated by an application.
Diffstat (limited to 'lib/plpdirent.cc')
-rw-r--r-- | lib/plpdirent.cc | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/lib/plpdirent.cc b/lib/plpdirent.cc index 33e1a78..9695480 100644 --- a/lib/plpdirent.cc +++ b/lib/plpdirent.cc @@ -83,3 +83,141 @@ operator<<(ostream &o, const PlpDirent &e) { o.flags(old); return o; } + +PlpDrive::PlpDrive() { +} + +PlpDrive::PlpDrive(const PlpDrive &other) { +} + +void PlpDrive:: +setMediaType(u_int32_t type) { + mediatype = type; +} + +void PlpDrive:: +setDriveAttribute(u_int32_t attr) { + driveattr = attr; +} + +void PlpDrive:: +setMediaAttribute(u_int32_t attr) { + mediaattr = attr; +} + +void PlpDrive:: +setUID(u_int32_t attr) { + uid = attr; +} + +void PlpDrive:: +setSize(u_int32_t sizeLo, u_int32_t sizeHi) { + size = ((unsigned long long)sizeHi << 32) + sizeLo; +} + +void PlpDrive:: +setSpace(u_int32_t spaceLo, u_int32_t spaceHi) { + space = ((unsigned long long)spaceHi << 32) + spaceLo; +} + +void PlpDrive:: +setName(char drive, const char * const volname) { + drivechar = drive; + name = ""; + name += volname; +} + +u_int32_t PlpDrive:: +getMediaType() { + return mediatype; +} + +static const char * const media_types[] = { + "Not present", + "Unknown", + "Floppy", + "Disk", + "CD-ROM", + "RAM", + "Flash Disk", + "ROM", + "Remote", +}; + +void PlpDrive:: +getMediaType(string &ret) { + ret = media_types[mediatype]; +} + +u_int32_t PlpDrive:: +getDriveAttribute() { + return driveattr; +} + +static void +appendWithDelim(string &s1, const char * const s2) { + if (!s1.empty()) + s1 += ','; + s1 += s2; +} + +void PlpDrive:: +getDriveAttribute(string &ret) { + ret = ""; + if (driveattr & 1) + appendWithDelim(ret, "local"); + if (driveattr & 2) + appendWithDelim(ret, "ROM"); + if (driveattr & 4) + appendWithDelim(ret, "redirected"); + if (driveattr & 8) + appendWithDelim(ret, "substituted"); + if (driveattr & 16) + appendWithDelim(ret, "internal"); + if (driveattr & 32) + appendWithDelim(ret, "removable"); +} + +u_int32_t PlpDrive:: +getMediaAttribute() { + return mediaattr; +} + +void PlpDrive:: +getMediaAttribute(string &ret) { + ret = ""; + + if (mediaattr & 1) + appendWithDelim(ret, "variable size"); + if (mediaattr & 2) + appendWithDelim(ret, "dual density"); + if (mediaattr & 4) + appendWithDelim(ret, "formattable"); + if (mediaattr & 8) + appendWithDelim(ret, "write protected"); +} + +u_int32_t PlpDrive:: +getUID() { + return uid; +} + +u_int64_t PlpDrive:: +getSize() { + return size; +} + +u_int64_t PlpDrive:: +getSpace() { + return space; +} + +string PlpDrive:: +getName() { + return name; +} + +char PlpDrive:: +getDrivechar() { + return drivechar; +} |