Adjust comments to new semantics.
[oota-llvm.git] / include / llvm / System / Path.h
index 8b603f5ad42c5d5f5d6c5f38f4ec1704daf46482..b8554c8297ceb0cc80d9481eeccc6924d3b00976 100644 (file)
 #define LLVM_SYSTEM_PATH_H
 
 #include "llvm/System/TimeValue.h"
-#include "llvm/Support/raw_ostream.h"
 #include <set>
 #include <string>
 #include <vector>
-#include <iosfwd>
 
 namespace llvm {
 namespace sys {
@@ -217,7 +215,7 @@ namespace sys {
       /// Compares \p this Path with \p that Path for inequality.
       /// @returns true if \p this and \p that refer to different things.
       /// @brief Inequality Operator
-      bool operator!=(const Path &that) const;
+      bool operator!=(const Path &that) const { return !(*this == that); }
 
       /// Determines if \p this Path is less than \p that Path. This is required
       /// so that Path objects can be placed into ordered collections (e.g.
@@ -249,13 +247,7 @@ namespace sys {
       /// @brief Determines if the path name is empty (invalid).
       bool isEmpty() const { return path.empty(); }
 
-      /// This function returns the current contents of the path as a
-      /// std::string. This allows the underlying path string to be manipulated.
-      /// @returns std::string containing the path name.
-      /// @brief Returns the path as a std::string.
-      const std::string &toString() const { return path; }
-
-      /// This function returns the last component of the path name. The last
+       /// This function returns the last component of the path name. The last
       /// component is the file or directory name occuring after the last
       /// directory separator. If no directory separator is present, the entire
       /// path name is returned (i.e. same as toString).
@@ -286,6 +278,8 @@ namespace sys {
       /// @returns a 'C' string containing the path name.
       /// @brief Returns the path as a C string.
       const char *c_str() const { return path.c_str(); }
+      const std::string &str() const { return path; }
+
 
       /// size - Return the length in bytes of this path name.
       size_t size() const { return path.size(); }
@@ -386,6 +380,13 @@ namespace sys {
       /// in the file system.
       bool canWrite() const;
 
+      /// This function checks that what we're trying to work only on a regular file.
+      /// Check for things like /dev/null, any block special file,
+      /// or other things that aren't "regular" regular files.
+      /// @returns true if the file is S_ISREG.
+      /// @brief Determines if the file is a regular file
+      bool isRegularFile() const;
+
       /// This function determines if the path name references an executable
       /// file in the file system. This function checks for the existence and
       /// executability (by the current program) of the file.
@@ -587,6 +588,7 @@ namespace sys {
     /// @name Data
     /// @{
     protected:
+      // Our win32 implementation relies on this string being mutable.
       mutable std::string path;   ///< Storage for the path name.
 
 
@@ -715,24 +717,6 @@ namespace sys {
   extern const char PathSeparator;
 }
 
-inline raw_ostream& operator<<(raw_ostream& strm, const sys::Path& aPath) {
-  strm << aPath.toString();
-  return strm;
-}
-
-inline raw_ostream& operator<<(raw_ostream& strm,
-                               const sys::PathWithStatus& aPath) {
-  strm << static_cast<const sys::Path&>(aPath);
-  return strm;
-}
-
-std::ostream& operator<<(std::ostream& strm, const sys::Path& aPath);
-inline std::ostream& operator<<(std::ostream& strm,
-                                const sys::PathWithStatus& aPath) {
-  strm << static_cast<const sys::Path&>(aPath);
-  return strm;
-}
-
 }
 
 #endif