You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (!m_CanFail) { RTEAssert(System::PathExistsCaseSensitive(m_FilePath) && m_Stream->good(), "Failed to open data file \"" + m_FilePath + "\"!"); }
73
+
m_Stream = std::move(stream);
74
+
75
+
if (!m_CanFail) {
76
+
RTEAssert(System::PathExistsCaseSensitive(m_FilePath) && m_Stream->good(), "Failed to open data file \"" + m_FilePath + "\"!");
77
+
}
54
78
55
79
m_OverwriteExisting = overwrites;
56
80
57
81
// Report that we're starting a new file
58
82
m_ReportProgress = progressCallback;
59
-
if (m_ReportProgress && m_Stream->good()) { m_ReportProgress("\t" + m_FileName + " on line " + std::to_string(m_CurrentLine), true); }
83
+
if (m_ReportProgress && m_Stream->good()) {
84
+
m_ReportProgress("\t" + m_FileName + " on line " + std::to_string(m_CurrentLine), true);
85
+
}
60
86
61
87
return m_Stream->good() ? 0 : -1;
62
88
}
@@ -311,7 +337,7 @@ namespace RTE {
311
337
312
338
if (m_Stream->fail() || !System::PathExistsCaseSensitive(includeFilePath)) {
313
339
// Backpedal and set up to read the next property in the old stream
314
-
m_Stream.reset(m_StreamStack.top().Stream); // Destructs the current m_Stream and takes back ownership and management of the raw StreamInfo std::ifstream pointer.
340
+
m_Stream.reset(m_StreamStack.top().Stream); // Destructs the current m_Stream and takes back ownership and management of the raw StreamInfo std::istream pointer.
Copy file name to clipboardExpand all lines: System/Reader.h
+24-5Lines changed: 24 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,16 @@ namespace RTE {
26
26
/// <param name="progressCallback">A function pointer to a function that will be called and sent a string with information about the progress of this Reader's reading.</param>
27
27
/// <param name="failOK">Whether it's ok for the file to not be there, ie we're only trying to open, and if it's not there, then fail silently.</param>
28
28
/// <param name="nonModulePath">Whether this Reader is reading from path that is not a DataModule and should just read it as provided.</param>
/// Constructor method used to instantiate a Reader object in system memory and make it ready for reading from the passed in file path.
33
+
/// </summary>
34
+
/// <param name="stream">Stream to read from.</param>
35
+
/// <param name="overwrites">Whether object definitions read here overwrite existing ones with the same names.</param>
36
+
/// <param name="progressCallback">A function pointer to a function that will be called and sent a string with information about the progress of this Reader's reading.</param>
37
+
/// <param name="failOK">Whether it's ok for the file to not be there, ie we're only trying to open, and if it's not there, then fail silently.</param>
/// <param name="failOK">Whether it's ok for the file to not be there, ie we're only trying to open, and if it's not there, then fail silently.</param>
38
47
/// <returns>An error return value signaling success or any particular failure. Anything below 0 is an error signal.</returns>
/// <param name="stream">Stream to read from.</param>
54
+
/// <param name="overwrites"> Whether object definitions read here overwrite existing ones with the same names.</param>
55
+
/// <param name="progressCallback">A function pointer to a function that will be called and sent a string with information about the progress of this Reader's reading.</param>
56
+
/// <param name="failOK">Whether it's ok for the file to not be there, ie we're only trying to open, and if it's not there, then fail silently.</param>
57
+
/// <returns>An error return value signaling success or any particular failure. Anything below 0 is an error signal.</returns>
Copy file name to clipboardExpand all lines: System/Writer.h
+17-4Lines changed: 17 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,13 @@ namespace RTE {
22
22
/// <param name="filename">Path to the file to open for writing. If the directory doesn't exist the stream will fail to open.</param>
23
23
/// <param name="append">Whether to append to the file if it exists, or to overwrite it.</param>
24
24
/// <param name="createDir">Whether to create the directory path to the file name before attempting to open the stream, in case it doesn't exist.</param>
/// Constructor method used to instantiate a Writer object in system memory and make it ready for writing to the passed in file path.
29
+
/// </summary>
30
+
/// <param name="stream">Stream to write to.</param>
31
+
Writer(std::unique_ptr<std::ostream> &&stream);
26
32
27
33
/// <summary>
28
34
/// Makes the Writer object ready for use.
@@ -32,6 +38,13 @@ namespace RTE {
32
38
/// <param name="createDir">Whether to create the directory path to the file name before attempting to open the stream, in case it doesn't exist.</param>
33
39
/// <returns>An error return value signaling success or any particular failure. Anything below 0 is an error signal.</returns>
/// Flushes and closes the output stream of this Writer. This happens automatically at destruction but needs to be called manually if a written file must be read from in the same scope.
0 commit comments