Import upstream 0.7.1
[manu/suphp.git] / src / File.hpp
index 3268fb7..f30431c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    suPHP - (c)2002-2005 Sebastian Marsching <sebastian@marsching.com>
+    suPHP - (c)2002-2008 Sebastian Marsching <sebastian@marsching.com>
 
     This file is part of suPHP.
 
@@ -24,15 +24,15 @@ namespace suPHP {
     class File;
 
     enum FileMode {
-       FILEMODE_USER_READ,
-       FILEMODE_USER_WRITE,
-       FILEMODE_USER_EXEC,
-       FILEMODE_GROUP_READ,
-       FILEMODE_GROUP_WRITE,
-       FILEMODE_GROUP_EXEC,
-       FILEMODE_OTHERS_READ,
-       FILEMODE_OTHERS_WRITE,
-       FILEMODE_OTHERS_EXEC
+        FILEMODE_USER_READ,
+        FILEMODE_USER_WRITE,
+        FILEMODE_USER_EXEC,
+        FILEMODE_GROUP_READ,
+        FILEMODE_GROUP_WRITE,
+        FILEMODE_GROUP_EXEC,
+        FILEMODE_OTHERS_READ,
+        FILEMODE_OTHERS_WRITE,
+        FILEMODE_OTHERS_EXEC
     };
 };
 
@@ -55,95 +55,99 @@ namespace suPHP {
      */
     class File {
     private:
-       std::string path;
-       bool hasPermissionBit(FileMode perm) const throw (SystemException);
-       
+        std::string path;
+        bool hasPermissionBit(FileMode perm) const throw (SystemException);
+        
     public:
-       /**
-        * Constructor
-        */
-       File(std::string path);
-       
-       /**
-        * Returns path to file
-        */
-       std::string getPath() const;
-
-       /**
-        * Returns input stream to read from file
-        */
-       SmartPtr<std::ifstream> getInputStream() throw (IOException);
-       
-       /**
-        * Does file exists?
-        */
-       bool exists() const;
-
-       /**
-        * Returns real path to file (without symlinks in path)
-        */
-       std::string getRealPath() const throw (SystemException);
-
-       /**
-        * Returns File object representing parent directory
-        */
-       File getParentDirectory() const;
-
-       /**
-        * Returns permission bit
-        */
-       bool hasUserReadBit() const throw (SystemException);
-
-       /**
-        * Returns permission bit
-        */
-       bool hasUserWriteBit() const throw (SystemException);
-
-       /**
-        * Returns permission bit
-        */
-       bool hasUserExecuteBit() const throw (SystemException);
-
-       /**
-        * Returns permission bit
-        */
-       bool hasGroupReadBit() const throw (SystemException);
-
-       /**
-        * Returns permission bit
-        */
-       bool hasGroupWriteBit() const throw (SystemException);
-
-       /**
-        * Returns permission bit
-        */
-       bool hasGroupExecuteBit() const throw (SystemException);
-
-       /**
-        * Returns permission bit
-        */
-       bool hasOthersReadBit() const throw (SystemException);
-
-       /**
-        * Returns permission bit
-        */
-       bool hasOthersWriteBit() const throw (SystemException);
-
-       /**
-        * Returns permission bit
-        */
-       bool hasOthersExecuteBit() const throw (SystemException);
-
-       /**
-        * Returns owner (user) of file
-        */
-       UserInfo getUser() const throw (SystemException);
-       
-       /**
-        * Returns owning group of file
-        */
-       GroupInfo getGroup() const throw (SystemException);
-       
+        /**
+         * Constructor
+         */
+        File(std::string path);
+        
+        /**
+         * Returns path to file
+         */
+        std::string getPath() const;
+
+        /**
+         * Returns input stream to read from file
+         */
+        SmartPtr<std::ifstream> getInputStream() const throw (IOException);
+        
+        /**
+         * Does file exists?
+         */
+        bool exists() const;
+
+        /**
+         * Returns real path to file (without symlinks in path)
+         */
+        std::string getRealPath() const throw (SystemException);
+
+        /**
+         * Returns File object representing parent directory
+         */
+        File getParentDirectory() const;
+
+        /**
+         * Returns permission bit
+         */
+        bool hasUserReadBit() const throw (SystemException);
+
+        /**
+         * Returns permission bit
+         */
+        bool hasUserWriteBit() const throw (SystemException);
+
+        /**
+         * Returns permission bit
+         */
+        bool hasUserExecuteBit() const throw (SystemException);
+
+        /**
+         * Returns permission bit
+         */
+        bool hasGroupReadBit() const throw (SystemException);
+
+        /**
+         * Returns permission bit
+         */
+        bool hasGroupWriteBit() const throw (SystemException);
+
+        /**
+         * Returns permission bit
+         */
+        bool hasGroupExecuteBit() const throw (SystemException);
+
+        /**
+         * Returns permission bit
+         */
+        bool hasOthersReadBit() const throw (SystemException);
+
+        /**
+         * Returns permission bit
+         */
+        bool hasOthersWriteBit() const throw (SystemException);
+
+        /**
+         * Returns permission bit
+         */
+        bool hasOthersExecuteBit() const throw (SystemException);
+
+        /**
+         * Returns owner (user) of file
+         */
+        UserInfo getUser() const throw (SystemException);
+        
+        /**
+         * Returns owning group of file
+         */
+        GroupInfo getGroup() const throw (SystemException);
+        
+        /**
+         * Checks whether this file is a symlink
+         */
+        bool isSymlink() const throw (SystemException);
     };
 };