Clean up pointer use:

* Use unique_ptr for Actions instead of manual memory management
 * Use unique_ptr in KeywordDatabase
 * Use unique_ptr instead of shared_ptr for file formats
 * Don't pass shared_ptr to Reader/Writer, use references instead
Also
 * Switch to C++17 so we can use map::try_emplace
This commit is contained in:
Twan van Laarhoven
2020-04-25 21:30:05 +02:00
parent 708b4389a0
commit 64ea1d7322
57 changed files with 363 additions and 385 deletions
+2 -5
View File
@@ -19,14 +19,11 @@ DECLARE_POINTER_TYPE(StyleSheet);
// ----------------------------------------------------------------------------- : Writer
typedef wxOutputStream OutputStream;
typedef shared_ptr<wxOutputStream> OutputStreamP;
/// The Writer can be used for writing (serializing) objects
class Writer {
public:
/// Construct a writer that writes to the given output stream
Writer(const OutputStreamP& output, Version file_app_version);
Writer(OutputStream& output, Version file_app_version);
/// Tell the reflection code we are not reading
inline bool reading() const { return false; }
@@ -81,7 +78,7 @@ class Writer {
vector<const Char*> pending_opened;
/// Output stream we are writing to
OutputStreamP output;
OutputStream& output;
/// Text stream wrapping the output stream
wxTextOutputStream stream;