From ddba971ebb304512ba9e0a01b77ec71b59b977b6 Mon Sep 17 00:00:00 2001 From: maxim nikonov Date: Fri, 6 Feb 2026 03:20:53 +0500 Subject: wip --- fluid/nodes/Function_Node.h | 72 ++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 37 deletions(-) (limited to 'fluid/nodes/Function_Node.h') diff --git a/fluid/nodes/Function_Node.h b/fluid/nodes/Function_Node.h index 0ad4494f3..87664e317 100644 --- a/fluid/nodes/Function_Node.h +++ b/fluid/nodes/Function_Node.h @@ -34,8 +34,6 @@ #include #include -#include - extern class Class_Node *current_class; int has_toplevel_function(const char *rtype, const char *sig); @@ -51,15 +49,15 @@ public: static Function_Node prototype; private: - std::string return_type_; - char public_ = 0; - char declare_c_ = 0; - char constructor = 0; - char havewidgets = 0; + const char *return_type_; + char public_; + char declare_c_; + char constructor; + char havewidgets; public: - Function_Node() = default; - ~Function_Node() override = default; + Function_Node(); + ~Function_Node(); Node *make(Strategy strategy) override; void write_code1(fld::io::Code_Writer& f) override; @@ -76,8 +74,8 @@ public: void write_properties(fld::io::Project_Writer &f) override; void read_property(fld::io::Project_Reader &f, const char *) override; int has_signature(const char *, const char*) const; - std::string return_type() const { return return_type_; } - void return_type(const std::string& t) { storestring(t, return_type_); } + const char *return_type() const { return return_type_ ? return_type_ : ""; } + void return_type(const char *t) { storestring(t, return_type_); } char visibility() { return public_; } void visibility(char v) { public_ = v; } char declare_c() { return declare_c_; } @@ -132,11 +130,11 @@ public: static CodeBlock_Node prototype; private: - std::string end_code_; + const char *end_code_; public: - CodeBlock_Node() = default; - ~CodeBlock_Node() override = default; + CodeBlock_Node(); + ~CodeBlock_Node(); Node *make(Strategy strategy) override; void write_code1(fld::io::Code_Writer& f) override; @@ -150,8 +148,8 @@ public: bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_CodeBlock) ? true : super::is_a(inType); } void write_properties(fld::io::Project_Writer &f) override; void read_property(fld::io::Project_Reader &f, const char *) override; - std::string end_code() const { return end_code_; } - void end_code(const std::string& c) { storestring(c, end_code_); } + const char *end_code() const { return end_code_ ? end_code_ : ""; } + void end_code(const char *c) { storestring(c, end_code_); } }; // ---- Decl_Node declaration @@ -195,12 +193,12 @@ public: static Data_Node prototype; private: - std::string filename_; - int output_format_ = 0; + const char *filename_; + int output_format_; public: - Data_Node() = default; - ~Data_Node() override = default; + Data_Node(); + ~Data_Node(); Node *make(Strategy strategy) override; void write_code1(fld::io::Code_Writer& f) override; @@ -211,8 +209,8 @@ public: void read_property(fld::io::Project_Reader &f, const char *) override; Type type() const override { return FLD_NODE_TYPE_Data; } bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Data) ? true : super::is_a(inType); } - void filename(const std::string& fn) { storestring(fn, filename_); } - std::string filename() const { return filename_; } + void filename(const char *fn) { storestring(fn, filename_); } + const char *filename() const { return filename_ ? filename_ : ""; } int output_format() { return output_format_; } void output_format(int fmt) { output_format_ = fmt; } }; @@ -232,12 +230,12 @@ public: }; private: - std::string end_code_; ///< code after all children of this block - int write_map_ = CODE_IN_SOURCE; ///< see enum above + const char *end_code_; ///< code after all children of this block + int write_map_; ///< see enum above public: - DeclBlock_Node() = default; - ~DeclBlock_Node() override = default; + DeclBlock_Node(); + ~DeclBlock_Node(); Node *make(Strategy strategy) override; void write_static(fld::io::Code_Writer& f) override; @@ -253,8 +251,8 @@ public: int is_public() const override; Type type() const override { return FLD_NODE_TYPE_DeclBlock; } bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_DeclBlock) ? true : super::is_a(inType); } - std::string end_code() const { return end_code_; } - void end_code(const std::string& p) { storestring(p, end_code_); } + const char *end_code() const { return end_code_ ? end_code_ : ""; } + void end_code(const char *p) { storestring(p, end_code_); } int write_map() { return write_map_; } void write_map(int v) { write_map_ = v; } }; @@ -301,13 +299,13 @@ public: static Class_Node prototype; private: - std::string base_class_; - std::string prefix_; - char public_ = 1; + const char *base_class_; + const char *prefix_; + char public_; public: - Class_Node() = default; - ~Class_Node() override = default; + Class_Node(); + ~Class_Node(); // State variables used when writing code to file char write_public_state; // true when public: has been printed @@ -328,17 +326,17 @@ public: void read_property(fld::io::Project_Reader &f, const char *) override; /** Get base class access and name. */ - std::string base_class() const { return base_class_; } + const char *base_class() const { return base_class_ ? base_class_ : ""; } /** Set base class access and name, i.e. `public Fl_Widget`. */ - void base_class(const std::string& name) { storestring(name, base_class_); } + void base_class(const char *name) { storestring(name, base_class_); } char visibility() { return public_; } void visibility(char v) { public_ = v; } /** Get the text between `class` and the class name */ - std::string prefix() const { return prefix_; } + const char *prefix() const { return prefix_ ? prefix_ : ""; } /** Set the text between `class` and the class name */ - void prefix(const std::string& p) { prefix_ = p; } + void prefix(const char *p) { storestring(p, prefix_); } }; #endif // FLUID_NODES_FUNCTION_NODE_H -- cgit v1.2.3