diff options
Diffstat (limited to 'src/lib/netlist/tools/nl_convert.h')
-rw-r--r-- | src/lib/netlist/tools/nl_convert.h | 69 |
1 files changed, 38 insertions, 31 deletions
diff --git a/src/lib/netlist/tools/nl_convert.h b/src/lib/netlist/tools/nl_convert.h index d3881320678..5cdae8e372d 100644 --- a/src/lib/netlist/tools/nl_convert.h +++ b/src/lib/netlist/tools/nl_convert.h @@ -10,10 +10,12 @@ #ifndef NL_CONVERT_H_ #define NL_CONVERT_H_ +#include "plib/plists.h" +#include "plib/pparser.h" +#include "plib/pstring.h" +#include "plib/ptypes.h" + #include <memory> -#include "../plib/pstring.h" -#include "../plib/plists.h" -#include "../plib/pparser.h" /*------------------------------------------------- convert - convert a spice netlist @@ -23,6 +25,8 @@ class nl_convert_base_t { public: + COPYASSIGNMOVE(nl_convert_base_t, delete) + virtual ~nl_convert_base_t(); const pstring &result() { return m_buf.str(); } @@ -40,7 +44,7 @@ protected: void add_device(const pstring &atype, const pstring &aname, double aval); void add_device(const pstring &atype, const pstring &aname); - void add_term(pstring netname, pstring termname); + void add_term(const pstring &netname, const pstring &termname); void dump_nl(); @@ -55,8 +59,8 @@ private: struct net_t { public: - explicit net_t(const pstring &aname) - : m_name(aname), m_no_export(false) {} + explicit net_t(pstring aname) + : m_name(std::move(aname)), m_no_export(false) {} const pstring &name() { return m_name;} std::vector<pstring> &terminals() { return m_terminals; } @@ -72,16 +76,28 @@ private: struct dev_t { public: - dev_t(const pstring &atype, const pstring &aname, const pstring &amodel) - : m_type(atype), m_name(aname), m_model(amodel), m_val(0), m_has_val(false) + dev_t(pstring atype, pstring aname, pstring amodel) + : m_type(std::move(atype)) + , m_name(std::move(aname)) + , m_model(std::move(amodel)) + , m_val(0) + , m_has_val(false) {} - dev_t(const pstring &atype, const pstring &aname, double aval) - : m_type(atype), m_name(aname), m_model(""), m_val(aval), m_has_val(true) + dev_t(pstring atype, pstring aname, double aval) + : m_type(std::move(atype)) + , m_name(std::move(aname)) + , m_model("") + , m_val(aval) + , m_has_val(true) {} - dev_t(const pstring &atype, const pstring &aname) - : m_type(atype), m_name(aname), m_model(""), m_val(0.0), m_has_val(false) + dev_t(pstring atype, pstring aname) + : m_type(std::move(atype)) + , m_name(std::move(aname)) + , m_model("") + , m_val(0.0) + , m_has_val(false) {} const pstring &name() { return m_name;} @@ -109,8 +125,8 @@ private: struct pin_alias_t { public: - pin_alias_t(const pstring &name, const pstring &alias) - : m_name(name), m_alias(alias) + pin_alias_t(pstring name, pstring alias) + : m_name(std::move(name)), m_alias(std::move(alias)) {} const pstring &name() { return m_name; } const pstring &alias() { return m_alias; } @@ -121,14 +137,14 @@ private: private: - void add_device(std::unique_ptr<dev_t> dev); + void add_device(plib::unique_ptr<dev_t> dev); plib::postringstream m_buf; - std::vector<std::unique_ptr<dev_t>> m_devs; - std::unordered_map<pstring, std::unique_ptr<net_t> > m_nets; + std::vector<plib::unique_ptr<dev_t>> m_devs; + std::unordered_map<pstring, plib::unique_ptr<net_t> > m_nets; std::vector<pstring> m_ext_alias; - std::unordered_map<pstring, std::unique_ptr<pin_alias_t>> m_pins; + std::unordered_map<pstring, plib::unique_ptr<pin_alias_t>> m_pins; static unit_t m_units[]; pstring m_numberchars; @@ -140,9 +156,6 @@ class nl_convert_spice_t : public nl_convert_base_t public: nl_convert_spice_t() : nl_convert_base_t() {} - virtual ~nl_convert_spice_t() override - { - } void convert(const pstring &contents) override; @@ -159,14 +172,11 @@ class nl_convert_eagle_t : public nl_convert_base_t public: nl_convert_eagle_t() : nl_convert_base_t() {} - virtual ~nl_convert_eagle_t() override - { - } class tokenizer : public plib::ptokenizer { public: - tokenizer(nl_convert_eagle_t &convert, plib::putf8_reader &strm); + tokenizer(nl_convert_eagle_t &convert, plib::putf8_reader &&strm); token_id_t m_tok_ADD; token_id_t m_tok_VALUE; @@ -175,7 +185,7 @@ public: protected: - virtual void verror(const pstring &msg, int line_num, const pstring &line) override; + void verror(const pstring &msg, int line_num, const pstring &line) override; private: nl_convert_eagle_t &m_convert; @@ -195,14 +205,11 @@ class nl_convert_rinf_t : public nl_convert_base_t public: nl_convert_rinf_t() : nl_convert_base_t() {} - virtual ~nl_convert_rinf_t() override - { - } class tokenizer : public plib::ptokenizer { public: - tokenizer(nl_convert_rinf_t &convert, plib::putf8_reader &strm); + tokenizer(nl_convert_rinf_t &convert, plib::putf8_reader &&strm); token_id_t m_tok_HEA; token_id_t m_tok_APP; @@ -216,7 +223,7 @@ public: protected: - virtual void verror(const pstring &msg, int line_num, const pstring &line) override; + void verror(const pstring &msg, int line_num, const pstring &line) override; private: nl_convert_rinf_t &m_convert; |