Browse Source

Using file_ prefix for new methods.

David Piuva 5 years ago
parent
commit
b877119964
3 changed files with 7 additions and 7 deletions
  1. 3 3
      Source/DFPSR/api/fileAPI.cpp
  2. 2 2
      Source/DFPSR/api/fileAPI.h
  3. 2 2
      Source/DFPSR/base/text.cpp

+ 3 - 3
Source/DFPSR/api/fileAPI.cpp

@@ -44,7 +44,7 @@ static char toAscii(DsrChar c) {
 	} \
 	TARGET[SOURCE.length()] = '\0';
 
-Buffer buffer_load(const ReadableString& filename, bool mustExist) {
+Buffer file_loadBuffer(const ReadableString& filename, bool mustExist) {
 	// TODO: Load files using Unicode filenames when available
 	TO_RAW_ASCII(asciiFilename, filename);
 	std::ifstream fileStream(asciiFilename, std::ios_base::in | std::ios_base::binary);
@@ -58,14 +58,14 @@ Buffer buffer_load(const ReadableString& filename, bool mustExist) {
 		return buffer;
 	} else {
 		if (mustExist) {
-			throwError(U"The text file ", filename, U" could not be opened for reading.\n");
+			throwError(U"The file ", filename, U" could not be opened for reading.\n");
 		}
 		// If the file cound not be found and opened, an empty buffer is returned
 		return Buffer();
 	}
 }
 
-void buffer_save(const ReadableString& filename, Buffer buffer) {
+void file_saveBuffer(const ReadableString& filename, Buffer buffer) {
 	// TODO: Save files using Unicode filenames
 	if (!buffer_exists(buffer)) {
 		throwError(U"buffer_save: Cannot save a buffer that don't exist to a file.\n");

+ 2 - 2
Source/DFPSR/api/fileAPI.h

@@ -35,11 +35,11 @@ namespace dsr {
 	//   Returns the content of the file referred to be filename.
 	//   If mustExist is true, then failure to load will throw an exception.
 	//   If mustExist is false, then failure to load will return an empty handle (returning false for buffer_exists).
-	Buffer buffer_load(const ReadableString& filename, bool mustExist = true);
+	Buffer file_loadBuffer(const ReadableString& filename, bool mustExist = true);
 
 	// Side-effect: Saves buffer to filename as a binary file.
 	// Pre-condition: buffer exists
-	void buffer_save(const ReadableString& filename, Buffer buffer);
+	void file_saveBuffer(const ReadableString& filename, Buffer buffer);
 }
 
 #endif

+ 2 - 2
Source/DFPSR/base/text.cpp

@@ -481,7 +481,7 @@ String dsr::string_loadFromMemory(Buffer fileContent) {
 // Loads a text file of unknown format
 //   Removes carriage-return characters to make processing easy with only line-feed for breaking lines
 String dsr::string_load(const ReadableString& filename, bool mustExist) {
-	Buffer encoded = buffer_load(filename, mustExist);
+	Buffer encoded = file_loadBuffer(filename, mustExist);
 	if (!buffer_exists(encoded)) {
 		return String();
 	} else {
@@ -616,7 +616,7 @@ static void encodeText(const ByteWriterFunction &receiver, String content) {
 void dsr::string_save(const ReadableString& filename, const ReadableString& content, CharacterEncoding characterEncoding, LineEncoding lineEncoding) {
 	Buffer buffer = string_saveToMemory(content, characterEncoding, lineEncoding);
 	if (buffer_exists(buffer)) {
-		buffer_save(filename, buffer);
+		file_saveBuffer(filename, buffer);
 	}
 }