diff options
author | 2014-07-18 00:47:59 +0000 | |
---|---|---|
committer | 2014-07-18 00:47:59 +0000 | |
commit | 4de8f55113007fdc8e34107950e605fc0209d465 (patch) | |
tree | 92b7da8757a7740d9e1f2d3ead233542947d8c8c /src/google/protobuf/testing/file.h | |
parent | c5553a3d18f80132b9079c5504bc0aa1f7f950a0 (diff) |
down integrate to svn
Diffstat (limited to 'src/google/protobuf/testing/file.h')
-rw-r--r-- | src/google/protobuf/testing/file.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/google/protobuf/testing/file.h b/src/google/protobuf/testing/file.h index a6b1c764..91ecce92 100644 --- a/src/google/protobuf/testing/file.h +++ b/src/google/protobuf/testing/file.h @@ -56,6 +56,10 @@ class File { static void ReadFileToStringOrDie(const string& name, string* output); // Create a file and write a string to it. + static bool WriteStringToFile(const string& contents, + const string& name); + + // Same as above, but crash on failure. static void WriteStringToFileOrDie(const string& contents, const string& name); @@ -73,6 +77,16 @@ class File { static void DeleteRecursively(const string& name, void* dummy1, void* dummy2); + static bool GetContents( + const string& name, string* output, bool /*is_default*/) { + return ReadFileToString(name, output); + } + + static bool SetContents( + const string& name, const string& contents, bool /*is_default*/) { + return WriteStringToFile(contents, name); + } + private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(File); }; |