aboutsummaryrefslogtreecommitdiffstats
path: root/lib/plpdirent.h
diff options
context:
space:
mode:
authorFritz Elfert <felfert@to.com>2001-02-01 02:03:25 +0000
committerFritz Elfert <felfert@to.com>2001-02-01 02:03:25 +0000
commit6c9647c1866b49d61ea3ce7d9201450fa0497b52 (patch)
treed240f512fb1a5d72f5b0fe3ad4b60c937cfd8274 /lib/plpdirent.h
parent320ed6edbbde5936ac07247896fbc2f51505a469 (diff)
downloadplptools-6c9647c1866b49d61ea3ce7d9201450fa0497b52.tar.gz
plptools-6c9647c1866b49d61ea3ce7d9201450fa0497b52.tar.bz2
plptools-6c9647c1866b49d61ea3ce7d9201450fa0497b52.zip
More cleanup:
- Removed bool.h and references to it everywhere. This is checked now in ./configure and the stuff went into acconfig.h - Replaced ugly bufferStore-based method of returning directory entries from rfsv::readdir() by a cleaner way. (A new, separate class PlpDirent is returned now.) With the old implementation, the caller has to know about the layout of the entries. Also, the old implementation was not 64bit aware. - Similar replacement done for rfsv::dir(). This now returns the entries in a standard STL container (deque) instead of a bufferArray. - Started renaming #include statements for standard library headers from the old <xxx.h> form to the new recommended <xxx> form.
Diffstat (limited to 'lib/plpdirent.h')
-rw-r--r--lib/plpdirent.h110
1 files changed, 110 insertions, 0 deletions
diff --git a/lib/plpdirent.h b/lib/plpdirent.h
new file mode 100644
index 0000000..f29cc74
--- /dev/null
+++ b/lib/plpdirent.h
@@ -0,0 +1,110 @@
+#ifndef _PLP_DIRENT_H_
+#define _PLP_DIRENT_H_
+
+#include <string>
+#include <psitime.h>
+#include <rfsv.h>
+
+/**
+ * A class, representing a directory entry of the Psion.
+ * Objects of this type are used by @ref rfsv::readdir and
+ * @ref rfsv::dir for returning the entries of a directory.
+ */
+class PlpDirent {
+ friend class rfsv32;
+ friend class rfsv16;
+
+public:
+ /**
+ * Default constructor
+ */
+ PlpDirent() : size(0), attr(0), name(""), time(0L), attrstr("") { };
+
+ /**
+ * A copy constructor.
+ * Mainly used by STL container classes.
+ *
+ * @param d The object to be used as initializer.
+ */
+ PlpDirent(const PlpDirent &d);
+
+ /**
+ * Default destructor.
+ */
+ ~PlpDirent() {};
+
+ /**
+ * Retrieves the file size of a directory entry.
+ *
+ * @returns The file size in bytes.
+ */
+ long getSize();
+
+ /**
+ * Retrieves the file attributes of a directory entry.
+ *
+ * @returns The generic attributes ( @ref rfsv:file_attribs ).
+ */
+ long getAttr();
+
+ /**
+ * Retrieves the UIDs of a directory entry.
+ * This method returns always 0 with a Series3.
+ *
+ * @param uididx The index of the UID to retrieve (0 .. 2).
+ *
+ * @returns The selected UID or 0 if the index is out of range.
+ */
+ long getUID(int uididx);
+
+ /**
+ * Retrieve the file name of a directory entry.
+ *
+ * @returns The name of the file.
+ */
+ const char *getName();
+
+ /**
+ * Retrieve the modification time of a directory entry.
+ *
+ * @returns A @ref PsiTime object, representing the time.
+ */
+ PsiTime getPsiTime();
+
+ /**
+ * Set the file name of a directory entry.
+ * This is currently used in plpbackup only for
+ * changing the name to the full path. It does NOT
+ * change the name of the corresponding file on
+ * the Psion.
+ *
+ * @param str The new name of the file.
+ */
+ void setName(const char *str);
+
+ /**
+ * Assignment opreator
+ * Mainly used by STL container classes.
+ *
+ * @param e The new value to assign.
+ *
+ * @returns The modified object.
+ */
+ PlpDirent &operator=(const PlpDirent &e);
+
+ /**
+ * Prints the object contents.
+ * The output is in human readable similar to the
+ * output of a "ls" command.
+ */
+ friend ostream &operator<<(ostream &o, const PlpDirent &e);
+
+private:
+ long size;
+ long attr;
+ long uid[3];
+ PsiTime time;
+ string attrstr;
+ string name;
+};
+#endif