Add File::size and make File's ctor take StringRef.

This commit is contained in:
Victor Zverovich
2014-09-12 10:50:16 -07:00
parent f175591923
commit e34e9fa0c7
3 changed files with 51 additions and 4 deletions
+4 -1
View File
@@ -206,7 +206,7 @@ class File {
File() FMT_NOEXCEPT(true) : fd_(-1) {}
// Opens a file and constructs a File object representing this file.
File(const char *path, int oflag);
File(fmt::StringRef path, int oflag);
#if !FMT_USE_RVALUE_REFERENCES
// Emulate a move constructor and a move assignment operator if rvalue
@@ -277,6 +277,9 @@ class File {
// Closes the file.
void close();
// Returns the file size.
fmt::LongLong size() const;
// Attempts to read count bytes from the file into the specified buffer.
std::size_t read(void *buffer, std::size_t count);