1
General Board / Re: Method and Attribute Grouping By Visibility
« on: February 01, 2007, 01:19:55 pm »
Thanks Simon. I appreciate you pointing this out. Below is the updated C# class body template with the null keyword replaced with an empty string.
%if elemType == "Interface"%
{\n
%list="Operation" @separator="\n\n" @indent="\t"%
%PI=""%
} // %className%
%endTemplate%
\n{\n
%PI="\n\n"%
%list="InnerClass" @separator="\n\n" @indent="\t"%
$COMMENT="output attribute region only if there are attributea"
$attribute=%list="Attribute"%
%if $attribute!=""%
#region Attributes
$COMMENT="output constants in public/protected/private order"
%list="Attribute" @separator="\n" @indent="\t" attScope=="Public" and attConst=="T"%
%list="Attribute" @separator="\n" @indent="\t" attScope=="Protected" and attConst=="T"%
%list="Attribute" @separator="\n" @indent="\t" attScope=="Private" and attConst=="T"%
$COMMENT="output variables in public/protected/private order"
%list="Attribute" @separator="\n" @indent="\t" attScope=="Public" and attConst!="T"%
%list="Attribute" @separator="\n" @indent="\t" attScope=="Protected" and attConst!="T"%
%list="Attribute" @separator="\n" @indent="\t" attScope=="Private" and attConst!="T"%
#endregion // Attributes
%endIf%
$COMMENT="output constructor region only if there are constructors"
$constructors=%list="Operation" opName==className%
%if $constructors!=""%
#region Constructors
$ops=""
%if genOptGenConstructor == "T" and classHasConstructor != "T"%
$ops+="\tpublic "+%className%+"()\n{\n\n\t}"
%endIf%
$COMMENT="output constructors in public/protected/private order"
%list="Operation" @separator="\n\n" @indent="\t" opName==className and opScope=="Public"%
%list="Operation" @separator="\n\n" @indent="\t" opName==className and opScope=="Protected"%
%list="Operation" @separator="\n\n" @indent="\t" opName==className and opScope=="Private"%
#endregion // Constructors
%endIf%
%if genOptGenDestructor == "T" and classHasDestructor != "T" and classHasFinalizer != "T"%
$ops+="\n\n\t~"+%className%+"()\n{\n\n\t}"
%endIf%
%if genOptCSGenDispose == "T" and classHasDispose != "T"%
$ops+="\n\n\tpublic "
$ops+=%classHasParent=="T" ? "override " : "virtual "%
$ops+="void Dispose(){\n\n\t}"
%endIf%
%if genOptCSGenFinalizer == "T" and genOptGenDestructor != "T" and classHasFinalizer != "T" and classHasDestructor != "T"%
$ops+="\n\n\tprotected "
$ops+=%classHasParent=="T" ? "override " : "virtual "%
$ops+="void Finalize()\n{\n"
$ops+=%classHasParent=="T" ? "\t\tbase.Finalize();" : ""% + "\n\t}"
%endIf%
%if genOptGenCopyConstructor == "T" and classHasCopyConstructor != "T"%
$ops+="\n\n\tpublic "
$ops+=%className%+"("+%className%+" the"+%className%+")\n{\n\n\t}"
%endIf%
$ops
$COMMENT="output property region only if there are properties"
$propertys=%list="Operation" opName!=className and opTag:"attribute_name"!=""%
%if $propertys!=""%
#region Properties
$COMMENT="output properties in public/protected/private order"
%list="Operation" @separator="\n\n" @indent="\t" opName!=className and opScope=="Public" and opTag:"attribute_name"!=""%
%list="Operation" @separator="\n\n" @indent="\t" opName!=className and opScope=="Protected" and opTag:"attribute_name"!=""%
%list="Operation" @separator="\n\n" @indent="\t" opName!=className and opScope=="Private" and opTag:"attribute_name"!=""%
#endregion // Properties
%endIf%
$COMMENT="output methods region only if there are methods"
$methods=%list="Operation" opName!=className and opTag:"attribute_name"==""%
%if $methods!=""%
#region Methods
$COMMENT="output operations in public/protected/private order"
%list="Operation" @separator="\n\n" @indent="\t" opName!=className and opScope=="Public" and opTag:"attribute_name"==""%
%list="Operation" @separator="\n\n" @indent="\t" opName!=className and opScope=="Protected" and opTag:"attribute_name"==""%
%list="Operation" @separator="\n\n" @indent="\t" opName!=className and opScope=="Private" and opTag:"attribute_name"==""%
#endregion // Methods
%endIf%
} // %className%
%if elemType == "Interface"%
{\n
%list="Operation" @separator="\n\n" @indent="\t"%
%PI=""%
} // %className%
%endTemplate%
\n{\n
%PI="\n\n"%
%list="InnerClass" @separator="\n\n" @indent="\t"%
$COMMENT="output attribute region only if there are attributea"
$attribute=%list="Attribute"%
%if $attribute!=""%
#region Attributes
$COMMENT="output constants in public/protected/private order"
%list="Attribute" @separator="\n" @indent="\t" attScope=="Public" and attConst=="T"%
%list="Attribute" @separator="\n" @indent="\t" attScope=="Protected" and attConst=="T"%
%list="Attribute" @separator="\n" @indent="\t" attScope=="Private" and attConst=="T"%
$COMMENT="output variables in public/protected/private order"
%list="Attribute" @separator="\n" @indent="\t" attScope=="Public" and attConst!="T"%
%list="Attribute" @separator="\n" @indent="\t" attScope=="Protected" and attConst!="T"%
%list="Attribute" @separator="\n" @indent="\t" attScope=="Private" and attConst!="T"%
#endregion // Attributes
%endIf%
$COMMENT="output constructor region only if there are constructors"
$constructors=%list="Operation" opName==className%
%if $constructors!=""%
#region Constructors
$ops=""
%if genOptGenConstructor == "T" and classHasConstructor != "T"%
$ops+="\tpublic "+%className%+"()\n{\n\n\t}"
%endIf%
$COMMENT="output constructors in public/protected/private order"
%list="Operation" @separator="\n\n" @indent="\t" opName==className and opScope=="Public"%
%list="Operation" @separator="\n\n" @indent="\t" opName==className and opScope=="Protected"%
%list="Operation" @separator="\n\n" @indent="\t" opName==className and opScope=="Private"%
#endregion // Constructors
%endIf%
%if genOptGenDestructor == "T" and classHasDestructor != "T" and classHasFinalizer != "T"%
$ops+="\n\n\t~"+%className%+"()\n{\n\n\t}"
%endIf%
%if genOptCSGenDispose == "T" and classHasDispose != "T"%
$ops+="\n\n\tpublic "
$ops+=%classHasParent=="T" ? "override " : "virtual "%
$ops+="void Dispose(){\n\n\t}"
%endIf%
%if genOptCSGenFinalizer == "T" and genOptGenDestructor != "T" and classHasFinalizer != "T" and classHasDestructor != "T"%
$ops+="\n\n\tprotected "
$ops+=%classHasParent=="T" ? "override " : "virtual "%
$ops+="void Finalize()\n{\n"
$ops+=%classHasParent=="T" ? "\t\tbase.Finalize();" : ""% + "\n\t}"
%endIf%
%if genOptGenCopyConstructor == "T" and classHasCopyConstructor != "T"%
$ops+="\n\n\tpublic "
$ops+=%className%+"("+%className%+" the"+%className%+")\n{\n\n\t}"
%endIf%
$ops
$COMMENT="output property region only if there are properties"
$propertys=%list="Operation" opName!=className and opTag:"attribute_name"!=""%
%if $propertys!=""%
#region Properties
$COMMENT="output properties in public/protected/private order"
%list="Operation" @separator="\n\n" @indent="\t" opName!=className and opScope=="Public" and opTag:"attribute_name"!=""%
%list="Operation" @separator="\n\n" @indent="\t" opName!=className and opScope=="Protected" and opTag:"attribute_name"!=""%
%list="Operation" @separator="\n\n" @indent="\t" opName!=className and opScope=="Private" and opTag:"attribute_name"!=""%
#endregion // Properties
%endIf%
$COMMENT="output methods region only if there are methods"
$methods=%list="Operation" opName!=className and opTag:"attribute_name"==""%
%if $methods!=""%
#region Methods
$COMMENT="output operations in public/protected/private order"
%list="Operation" @separator="\n\n" @indent="\t" opName!=className and opScope=="Public" and opTag:"attribute_name"==""%
%list="Operation" @separator="\n\n" @indent="\t" opName!=className and opScope=="Protected" and opTag:"attribute_name"==""%
%list="Operation" @separator="\n\n" @indent="\t" opName!=className and opScope=="Private" and opTag:"attribute_name"==""%
#endregion // Methods
%endIf%
} // %className%