]> git.lyx.org Git - lyx.git/blobdiff - src/support/FileInfo.h
lyxserver cleanup patch + andre's small patches
[lyx.git] / src / support / FileInfo.h
index b2f8caad182a92e9ef83c54d3e07c7e7cad4b4f3..4463207f235ebaad7c4bf250a2892657f9c31e19 100644 (file)
@@ -5,7 +5,7 @@
  *           LyX, The Document Processor
  *        
  *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2000 The LyX Team.
+ *           Copyright 1995-2001 The LyX Team.
  *
  * ====================================================== */
 
 
 #include <ctime>
 
-#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-
+#include <unistd.h>
+#include <boost/utility.hpp>
 #include "LString.h"
 
+#if defined(__CYGWIN__) //Cygwin has it's own concept of X_OK ???
+#undef X_OK
+#define X_OK 1
+#endif
+
 /** Use objects of this class to get information about files.
  */
-class FileInfo {
+class FileInfo : boost::noncopyable {
 public:
        ///
        FileInfo();
@@ -60,7 +65,7 @@ public:
        char typeLetter() const;
        
        /// builds 'rwx' string describing file access rights
-       void flagRWX(unsigned short i, char * szString) const;
+       void flagRWX(mode_t i, char * szString) const;
        
        /// updates mode string to match suid/sgid/sticky bits
        void setSticky(char * szString) const;
@@ -101,15 +106,15 @@ public:
                eperm = F_OK
        };
        /// Test whether the current user has a given set of permissions
-       bool access(int p);
+       bool access(int p) const;
        /// Is the file writable for the current user?
-       bool writable() { return access(FileInfo::wperm); }
+       bool writable() const { return access(FileInfo::wperm); }
        /// Is the file readable for the current user?
-       bool readable() { return access(FileInfo::rperm); }
+       bool readable() const { return access(FileInfo::rperm); }
        /// Is the file executable for the current user?
-       bool executable() { return access(FileInfo::xperm); }
+       bool executable() const { return access(FileInfo::xperm); }
        /// Does the file exist?
-       bool exist() { return access(FileInfo::eperm); }
+       bool exist() const { return access(FileInfo::eperm); }
        ///
        bool isLink() const;
        ///