Ignore:
Timestamp:
Dec 21, 2006, 9:10:30 AM (16 years ago)
Author:
Jari Häkkinen
Message:

Fixes #1 and #80. Interface changed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/FileUtil.h

    r710 r711  
    3838
    3939  ///
    40   /// FileUtil is useful for many common task on files.
     40  /// FileUtil is a utility class for checking file/directory
     41  /// existence and access permissions. FileUtil is a wrapper to
     42  /// access(2) and stat(2).
    4143  ///
    4244  class FileUtil {
     
    4446
    4547    ///
    46     /// \brief Constructor
    47     ///
    48     /// \exception IO_error if underlying stat(2) call fails in other
    49     /// ways than file does not exist.
     48    /// \brief Constructor, copies \a path only
    5049    ///
    5150    explicit FileUtil(const std::string& path);
    5251
    5352    ///
    54     /// @brief Check file/directory permissions
     53    /// \brief Check file/directory permissions
    5554    ///
    5655    /// Check if access permissions match \a mode. \a mode must be
    57     /// given as r, w, x, or combinations of these letters.
     56    /// given as r, w, x, or combinations of these letters. The check
     57    /// is performed att call time.
    5858    ///
    59     /// @note Checking permissions on a non-existent file will return
    60     /// the permissions for the parent directory, but only the parent
    61     /// directory. If the parent directory does not exist then fail is
    62     /// returned.
     59    /// \note Checking permissions on a non-existent file will match
     60    /// the permissions against the parent directory, but only the
     61    /// parent directory. This means that when the parent directory
     62    /// does not exist then fail is returned.
    6363    ///
    64     /// @return On success (all requested permissions granted), zero
     64    /// \return On success (all requested permissions granted), zero
    6565    /// is returned. On error (at least one bit in mode asked for a
    6666    /// permission that is denied, or some other error occurred), -1
    6767    /// is returned, and errno is set appropriately.
    6868    ///
    69     int access_rights(const std::string& path,const std::string& bits) const;
     69    /// \exception Throws whatever exists() throws.
     70    ///
     71    int permissions(const std::string& bits) const;
    7072
    7173    ///
    72     /// @brief Check whether \a file exists.
     74    /// \brief Check whether \a file exists.
    7375    ///
    74     /// @return True if \a file exists, false otherwise.
     76    /// The check for the file is done when calling this function.
    7577    ///
    76     bool file_exists(const std::string& file) const;
     78    /// \return True if \a file exists, false otherwise.
     79    ///
     80    /// \exception IO_error if underlying stat(2) call fails in other
     81    /// ways than that file does not exist.
     82    ///
     83    /// \see stat(2)
     84    ///
     85    bool exists(void) const;
    7786
    7887    ///
    79     /// @brief Get path associated with the object.
     88    /// \brief Get path associated with the object.
    8089    ///
    8190    const std::string& path(void) const;
     
    8796    FileUtil(const FileUtil&);
    8897
    89     bool no_file_;
    9098    std::string path_;
    91     struct stat stat_;
    9299  };
    93100
Note: See TracChangeset for help on using the changeset viewer.