diff options
Diffstat (limited to 'engines/zvision/utility.h')
-rw-r--r-- | engines/zvision/utility.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index 15f9490a4b..0777ba9ebc 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -29,7 +29,14 @@ namespace ZVision { -void WriteFileContentsToFile(Common::String sourceFile, Common::String destFile) { +/** + * Opens the sourceFile utilizing Common::File (aka SearchMan) and writes the + * contents to destFile. destFile is created in the working directory + * + * @param sourceFile The 'file' you want the contents of + * @param destFile The name of the file where the content will be written to + */ +void writeFileContentsToFile(Common::String sourceFile, Common::String destFile) { Common::File f; f.open(sourceFile); byte* buffer = new byte[f.size()]; @@ -45,6 +52,23 @@ void WriteFileContentsToFile(Common::String sourceFile, Common::String destFile) delete[] buffer; } +/** + * Removes any line comments using '#' as a sequence start. + * Then removes any trailing and leading 'whitespace'. + * Uses isspace() to determine what is whitespace and what is not. + * + * @param string The string to modify. It is modified in place + */ +void trimCommentsAndWhiteSpace(Common::String &string) { + for (int i = string.size(); i >= 0; --i) { + if (string[i] == '#') { + string.erase(i); + } + } + + string.trim(); +} + } // End namespace ZVision #endif |