[llvm-commits] CVS: llvm/include/llvm/System/Path.h
Reid Spencer
reid at x10sys.com
Tue Nov 9 12:26:42 PST 2004
Changes in directory llvm/include/llvm/System:
Path.h updated: 1.7 -> 1.8
---
Log message:
* Implement getStatusInfo for getting stat(2) like information
* Implement createTemporaryFile for mkstemp(3) functionality
* Fix isBytecodeFile to accept llvc magic # (compressed) as bytecode.
---
Diffs of the changes: (+30 -0)
Index: llvm/include/llvm/System/Path.h
diff -u llvm/include/llvm/System/Path.h:1.7 llvm/include/llvm/System/Path.h:1.8
--- llvm/include/llvm/System/Path.h:1.7 Fri Nov 5 16:15:35 2004
+++ llvm/include/llvm/System/Path.h Tue Nov 9 14:26:31 2004
@@ -16,6 +16,7 @@
#include <string>
#include <vector>
+#include "llvm/System/TimeValue.h"
namespace llvm {
namespace sys {
@@ -306,6 +307,24 @@
/// @brief Get the base name of the path
std::string getBasename() const;
+ /// This structure provides basic file system information about a file.
+ /// The structure is filled in by the getStatusInfo method.
+ /// @brief File status structure
+ struct StatusInfo {
+ StatusInfo() : modTime(0,0) { fileSize=0; mode=0; user=0; group=0; }
+ size_t fileSize; ///< Size of the file in bytes
+ TimeValue modTime; ///< Time of file's modification
+ uint64_t mode; ///< Mode of the file, if applicable
+ uint64_t user; ///< User ID of owner, if applicable
+ uint64_t group; ///< Group ID of owner, if applicable
+ };
+
+ /// This function returns status information about the file.
+ /// @returns nothing
+ /// @throws std::string if an error occurs.
+ /// @brief Get file status.
+ void getStatusInfo(StatusInfo& stat) const;
+
/// @returns a c string containing the path name.
/// @brief Returns the path as a C string.
const char* const c_str() const { return path.c_str(); }
@@ -425,6 +444,17 @@
/// @brief Create the file this Path refers to.
bool createFile();
+ /// This is like createFile except that it creates a temporary file. A
+ /// unique temporary file name is generated based on the contents of
+ /// \p this before the call. The new name is assigned to \p this and the
+ /// file is created. Note that this will both change the Path object
+ /// *and* create the corresponding file. The path of \p this will have
+ /// six characters added to it (per mkstemp(3)) that ensure the file
+ /// name is unique.
+ /// @throws std::string if there is an error
+ /// @brief Create a temporary file
+ bool createTemporaryFile();
+
/// This method attempts to destroy the directory named by the last in
/// the Path name. If \p remove_contents is false, an attempt will be
/// made to remove just the directory that this Path object refers to
More information about the llvm-commits
mailing list