From 60200047357fa707b1c96c83ec5d54748c12d2a1 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Fri, 30 Aug 2024 11:25:37 +0200 Subject: [PATCH 1/7] Removed redundant whitespaces * XSC/be/CXX/Header.cpp: --- XSC/be/CXX/Header.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/XSC/be/CXX/Header.cpp b/XSC/be/CXX/Header.cpp index 61a5494..a0310f3 100644 --- a/XSC/be/CXX/Header.cpp +++ b/XSC/be/CXX/Header.cpp @@ -240,7 +240,7 @@ namespace << "protected:" << endl; if (this->cpp11_) { - os << "using " << id (name) << "_unique_ptr_type = std::unique_ptr< " << type << ">;"; + os << "using " << id (name) << "_unique_ptr_type = std::unique_ptr<" << type << ">;"; os << id (name) << "_unique_ptr_type " << id (name) << "_;"; } else @@ -269,7 +269,7 @@ namespace if (this->cpp11_) { - os << "using " << id (name) << "_unique_ptr_type = std::unique_ptr< " << type << ">;"; + os << "using " << id (name) << "_unique_ptr_type = std::unique_ptr<" << type << ">;"; os << id (name) << "_unique_ptr_type " << id (name) << "_;"; } else @@ -339,7 +339,7 @@ namespace if (this->cpp11_) { - os << "using " << id (name) << "_unique_ptr_type = std::unique_ptr< " << type << ">;"; + os << "using " << id (name) << "_unique_ptr_type = std::unique_ptr<" << type << ">;"; os << id (name) << "_unique_ptr_type " << id (name) << "_;"; } else @@ -366,7 +366,7 @@ namespace if (this->cpp11_) { - os << "using " << id (name) << "_unique_ptr_type = std::unique_ptr< " << type << ">;"; + os << "using " << id (name) << "_unique_ptr_type = std::unique_ptr<" << type << ">;"; os << id (name) << "_unique_ptr_type " << id (name) << "_;"; } else From 448acec9e6ee48fa16692017974f12e1dfc36c04 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Fri, 30 Aug 2024 11:34:49 +0200 Subject: [PATCH 2/7] Simplify type * XSC/be/CXX/Header.cpp: --- XSC/be/CXX/Header.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/XSC/be/CXX/Header.cpp b/XSC/be/CXX/Header.cpp index a0310f3..5918159 100644 --- a/XSC/be/CXX/Header.cpp +++ b/XSC/be/CXX/Header.cpp @@ -240,8 +240,8 @@ namespace << "protected:" << endl; if (this->cpp11_) { - os << "using " << id (name) << "_unique_ptr_type = std::unique_ptr<" << type << ">;"; - os << id (name) << "_unique_ptr_type " << id (name) << "_;"; + os << "using " << id (name) << "_type = std::unique_ptr<" << type << ">;"; + os << id (name) << "_type " << id (name) << "_;"; } else { @@ -269,8 +269,8 @@ namespace if (this->cpp11_) { - os << "using " << id (name) << "_unique_ptr_type = std::unique_ptr<" << type << ">;"; - os << id (name) << "_unique_ptr_type " << id (name) << "_;"; + os << "using " << id (name) << "_type = std::unique_ptr<" << type << ">;"; + os << id (name) << "_type " << id (name) << "_;"; } else { @@ -339,8 +339,8 @@ namespace if (this->cpp11_) { - os << "using " << id (name) << "_unique_ptr_type = std::unique_ptr<" << type << ">;"; - os << id (name) << "_unique_ptr_type " << id (name) << "_;"; + os << "using " << id (name) << "_type = std::unique_ptr<" << type << ">;"; + os << id (name) << "_type " << id (name) << "_;"; } else { @@ -366,8 +366,8 @@ namespace if (this->cpp11_) { - os << "using " << id (name) << "_unique_ptr_type = std::unique_ptr<" << type << ">;"; - os << id (name) << "_unique_ptr_type " << id (name) << "_;"; + os << "using " << id (name) << "_type = std::unique_ptr<" << type << ">;"; + os << id (name) << "_type " << id (name) << "_;"; } else { From 21fdf1c03ed8aaf9d21816dc17f0fa4e71761409 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Fri, 30 Aug 2024 11:52:09 +0200 Subject: [PATCH 3/7] Removed redundant whitespace * XSC/be/CXX/Inline.cpp: * XSC/be/CXX/Source.cpp: --- XSC/be/CXX/Inline.cpp | 16 ++++++++-------- XSC/be/CXX/Source.cpp | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/XSC/be/CXX/Inline.cpp b/XSC/be/CXX/Inline.cpp index e139a83..8e35510 100644 --- a/XSC/be/CXX/Inline.cpp +++ b/XSC/be/CXX/Inline.cpp @@ -129,7 +129,7 @@ namespace break; case CPPMODE::CPP11: case CPPMODE::CPP17: - os << id (name) << "_ = std::make_unique< " << type << "> (e);"; + os << id (name) << "_ = std::make_unique<" << type << "> (e);"; break; } os << "}" @@ -380,7 +380,7 @@ namespace if (this->cppmode_ != CPPMODE::CPP03) { - os << id (name) << "_ = std::make_unique< " << type << "> (e);"; + os << id (name) << "_ = std::make_unique<" << type << "> (e);"; } else { @@ -859,7 +859,7 @@ namespace if (this->cppmode_ != CPPMODE::CPP03) { - os << ", " << name << "_ (std::make_unique< " << type << "> (" << name << "__))" << endl; + os << ", " << name << "_ (std::make_unique<" << type << "> (" << name << "__))" << endl; } else { @@ -891,7 +891,7 @@ namespace if (this->cppmode_ != CPPMODE::CPP03) { - os << ", " << name << "_ (std::make_unique< " << type << "> (" << name << "__))" << endl; + os << ", " << name << "_ (std::make_unique<" << type << "> (" << name << "__))" << endl; } else { @@ -988,7 +988,7 @@ namespace { os << ", " << name << "_ (" << "s." << name << "_ ? " - << "std::make_unique< " << type << "> (*s." << name << "_) : " << nullptr_string << ")" << endl; + << "std::make_unique<" << type << "> (*s." << name << "_) : " << nullptr_string << ")" << endl; } else { @@ -1003,7 +1003,7 @@ namespace // if (this->cppmode_ != CPPMODE::CPP03) { - os << ", " << name << "_ (std::make_unique< " << type << "> (*s." << name << "_))" << endl; + os << ", " << name << "_ (std::make_unique<" << type << "> (*s." << name << "_))" << endl; } else { @@ -1040,7 +1040,7 @@ namespace { os << ", " << name << "_ (" << "s." << name << "_ ? " - << "std::make_unique< " << type << "> (*s." << name << "_) : " << nullptr_string << ")" << endl; + << "std::make_unique<" << type << "> (*s." << name << "_) : " << nullptr_string << ")" << endl; } else { @@ -1053,7 +1053,7 @@ namespace { if (this->cppmode_ != CPPMODE::CPP03) { - os << ", " << name << "_ (std::make_unique< " << type << "> (*s." << name << "_))" << endl; + os << ", " << name << "_ (std::make_unique<" << type << "> (*s." << name << "_))" << endl; } else { diff --git a/XSC/be/CXX/Source.cpp b/XSC/be/CXX/Source.cpp index c30d831..638bb5f 100644 --- a/XSC/be/CXX/Source.cpp +++ b/XSC/be/CXX/Source.cpp @@ -87,7 +87,7 @@ namespace // if (this->cppmode_ != CPPMODE::CPP03) { - os << id (name) << "_ = std::make_unique< " << type << "> (e);"; + os << id (name) << "_ = std::make_unique<" << type << "> (e);"; } else { From 5cb9c43b0da6b01cb52de47a6148101b98430344 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Fri, 30 Aug 2024 11:55:09 +0200 Subject: [PATCH 4/7] Use release on unique_ptr instead of setting it to nullptr * XSC/be/CXX/Inline.cpp: --- XSC/be/CXX/Inline.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/XSC/be/CXX/Inline.cpp b/XSC/be/CXX/Inline.cpp index 8e35510..fc56969 100644 --- a/XSC/be/CXX/Inline.cpp +++ b/XSC/be/CXX/Inline.cpp @@ -1179,7 +1179,7 @@ namespace os << "if (s." << name << "_)" << std::endl << " " << name << " (*(s." << name << "_));" << "else" << std::endl - << " " << name << "_.reset (nullptr);" + << " " << name << "_.release ();" << endl; } else @@ -1235,7 +1235,7 @@ namespace { os << "if (s." << name << "_) " << name << " (*(s." << name << "_));" - << "else " << name << "_.reset (nullptr);" + << "else " << name << "_.release ();" << endl; } else From d086e90d751ed8125b67b32c419436f4b2d5566d Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Fri, 30 Aug 2024 12:06:45 +0200 Subject: [PATCH 5/7] Removed old commented out code * XSC/be/CXX/Elements.cpp: * XSC/be/CXX/Inline.cpp: * XSCRT/XSCRT/Elements.hpp: --- XSC/be/CXX/Elements.cpp | 8 -------- XSC/be/CXX/Inline.cpp | 29 ----------------------------- XSCRT/XSCRT/Elements.hpp | 2 -- 3 files changed, 39 deletions(-) diff --git a/XSC/be/CXX/Elements.cpp b/XSC/be/CXX/Elements.cpp index 514fb61..f4c4e76 100644 --- a/XSC/be/CXX/Elements.cpp +++ b/XSC/be/CXX/Elements.cpp @@ -342,14 +342,6 @@ type_name (SemanticGraph::Instance& i, string const& nss) } else { - //@@ I wonder if this is at all necessary now? - // - - //if (!scope.empty ()) r += scope + L"::"; - - //r += fq_name (i.scope ()); - //r += L"::"; - r += id (i.name ()); } diff --git a/XSC/be/CXX/Inline.cpp b/XSC/be/CXX/Inline.cpp index fc56969..1e5df5e 100644 --- a/XSC/be/CXX/Inline.cpp +++ b/XSC/be/CXX/Inline.cpp @@ -1101,22 +1101,6 @@ namespace { os << id (name) << "_->container (this);"; } - else - { - //string type (type_name (e)); - - //// sequence - //// - //if (this->generate_ra_sequences_) - // os << name << "_.reserve (s." << name << "_.size ());"; - - //os << "{" - // << "for (" << name << "_const_iterator i (s." - // << name << "_.begin ());" - // << "i != s." << name << "_.end ();" - // << "++i) " << "add_" << name << " (*i);" - // << "}"; - } } virtual void @@ -1207,19 +1191,6 @@ namespace // os << id(name) << "_ = s." << id(name) << "_;" << std::endl; - - //os << name << "_.clear ();"; - - //if (this->generate_ra_sequences_) - // os << name << "_.reserve (s." << name << "_.size ());"; - - //os << "{" - // << "for (" << name << "_const_iterator i (s." - // << name << "_.begin ());" - // << "i != s." << name << "_.end ();" - // << "++i) " << std::endl - // << "add_" << name << " (*i);" - // << "}"; } } diff --git a/XSCRT/XSCRT/Elements.hpp b/XSCRT/XSCRT/Elements.hpp index f48a39e..9f2f099 100644 --- a/XSCRT/XSCRT/Elements.hpp +++ b/XSCRT/XSCRT/Elements.hpp @@ -60,8 +60,6 @@ namespace XSCRT Type& operator= (Type const&) { - //@@ I don't need this. - //if (map_.get ()) map_->clear (); // Flush the map. return *this; } From dd45753771c4afb13c85ad83683bfa414321a4b6 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Fri, 30 Aug 2024 12:13:32 +0200 Subject: [PATCH 6/7] Removed commented out code * XSC/be/CXX/Inline.cpp: --- XSC/be/CXX/Inline.cpp | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/XSC/be/CXX/Inline.cpp b/XSC/be/CXX/Inline.cpp index 1e5df5e..803bb65 100644 --- a/XSC/be/CXX/Inline.cpp +++ b/XSC/be/CXX/Inline.cpp @@ -145,14 +145,6 @@ namespace << "{" << "return *" << id (name) << "_;" << "}"; - /* Lets just have one mutator - os << i - << type << "& " << scope << "::" << endl - << id (name) << " ()" - << "{" - << "return *" << id (name) << "_;" - << "}"; - */ if ((idref_ptr != std::string::npos) && (this->cppmode_ == CPPMODE::CPP03)) { os << i @@ -275,7 +267,6 @@ namespace os << "}"; } -// if (!this->cpp11_) { // count_typename // @@ -460,12 +451,6 @@ namespace names_.node_traverser (*this); } - //virtual void - //traverse (SemanticGraph::Type& t) - //{ - // os << comma () << type_name (t) << " const& b__"; - //} - virtual void traverse (SemanticGraph::Enumeration& e) { @@ -730,12 +715,6 @@ namespace { } - //virtual void - //traverse (SemanticGraph::Type&) - //{ - // os << "Base (b__)," << endl; - //} - virtual void traverse (SemanticGraph::Enumeration&) { @@ -1138,14 +1117,6 @@ namespace { } - //virtual void - //traverse (SemanticGraph::Type&) - //{ - // os << "static_cast< Base& > (*this) = " - // << "static_cast< Base const& > (s);" - // << endl; - //} - virtual void traverse (SemanticGraph::Element& e) { From 199de9d5c046c52abd5f5442a63b99d3dcd1ffee Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Fri, 30 Aug 2024 12:23:26 +0200 Subject: [PATCH 7/7] Code simplify * XSC/be/CXX/Header.cpp: --- XSC/be/CXX/Header.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/XSC/be/CXX/Header.cpp b/XSC/be/CXX/Header.cpp index ae01808..6c7edd4 100644 --- a/XSC/be/CXX/Header.cpp +++ b/XSC/be/CXX/Header.cpp @@ -186,7 +186,7 @@ namespace break; case CPPMODE::CPP11: case CPPMODE::CPP17: - os << "using " << name << "_container_type = " << container << "< " << type << ">;"; + os << "using " << name << "_container_type = " << container << "<" << type << ">;"; break; } switch(this->cppmode_) @@ -237,7 +237,7 @@ namespace os << "bool " << name << "_p () const;"; os << type << " const& " << id (name) << " () const;"; // os << type << "& " << id (name) << " ();"; // Lets just have one mutator - os << "void " << id (name) << " (" << type << " const& );"; + os << "void " << id (name) << " (" << type << " const&);"; //Added for IDREF case if ((idref_ptr != std::string::npos) && (this->cppmode_ == CPPMODE::CPP03)) @@ -267,7 +267,7 @@ namespace // os << type << " const& " << id (name) << " () const;"; // os << type << "& " << id (name) << " ();"; // Lets just have one mutator. - os << "void " << id (name) << " (" << type << " const& );"; + os << "void " << id (name) << " (" << type << " const&);"; //Added for IDREF case if ((idref_ptr != std::string::npos) && (this->cppmode_ == CPPMODE::CPP03)) @@ -339,7 +339,7 @@ namespace os << "bool " << name << "_p () const;"; os << type << " const& " << id (name) << " () const;"; os << type << "& " << id (name) << " ();"; - os << "void " << id (name) << " (" << type << " const& );"; + os << "void " << id (name) << " (" << type << " const&);"; //Added for IDREF case if ((idref_ptr != std::string::npos) && (this->cppmode_ == CPPMODE::CPP03)) @@ -368,7 +368,7 @@ namespace { os << type << " const& " << id (name) << " () const;"; os << type << "& " << id (name) << " ();"; - os << "void " << id (name) << " (" << type << " const& );"; + os << "void " << id (name) << " (" << type << " const&);"; //Added for IDREF case if ((idref_ptr != std::string::npos) && (this->cppmode_ == CPPMODE::CPP03))