util.factory

Functions generating factory code.

string generateFactory(string[] parameterStrings...);

Generates data members and setters used in factory classes.

Each input string specifies a type, name and default value of a parameter, delimited by the '$' character. E.g.:

 "string $ width $ \"64\""
will generate data member "width_" (notice trailing underscore) of type string with default value of "64", and a setter "width", like this:
 protected string width_ = \"64\";
 public void width(string width){width_ = width};

Parameters:
string[] parameterStrings Array of strings representing factory members, their types and default values.
Returns:
Generated code ready to be inserted into a factory class definition.