Example #1
0
        private void OutputPropertyInInterface(Definition.PropertyDef p)
        {
            if (p.Setter != null)
            {
                WriteLine("void set{0}({1} value);", p.Name, GetTypeSpecifier(p.Type));
            }


            if (p.Getter != null)
            {
                WriteLine("{0} get{1}();", GetTypeSpecifier(p.Type), p.Name);
            }
        }
Example #2
0
        private void OutputProperty(Definition.PropertyDef p)
        {
            var needVariable = true;

            if (p.Setter != null)
            {
                if (p.Setter.Body != null)
                {
                    Summary(p.Summary);

                    WriteLine("{2} {3}void set{0}({1} value) {{", p.Name, GetTypeSpecifier(p.Type), GetAccessLevel(p.AccessLevel), p.IsStatic ? "static " : "");
                    IndentDepth++;
                    OutputStatement(p.Setter.Body);
                    IndentDepth--;
                    WriteLine("}}");
                    needVariable = false;
                }
                else
                {
                    WriteLine("{2} {3}void set{0}({1} value) {{ {0} = value; }}", p.Name, GetTypeSpecifier(p.Type), GetAccessLevel(p.AccessLevel), p.IsStatic ? "static " : "");
                }
            }


            if (p.Getter != null)
            {
                if (p.Getter.Body != null)
                {
                    Summary(p.Summary);

                    WriteLine("{2} {3}{0} get{1}() {{", GetTypeSpecifier(p.Type), p.Name, GetAccessLevel(p.AccessLevel), p.IsStatic ? "static " : "");
                    IndentDepth++;
                    OutputStatement(p.Getter.Body);
                    IndentDepth--;
                    WriteLine("}}");
                    needVariable = false;
                }
                else
                {
                    WriteLine("{2} {3}{0} get{1}() {{ return {1}; }}", GetTypeSpecifier(p.Type), p.Name, GetAccessLevel(p.AccessLevel), p.IsStatic ? "static " : "");
                }
            }

            if (needVariable)
            {
                WriteLine("private {2} {0} {1};", GetTypeSpecifier(p.Type), p.Name, p.IsStatic ? "static " : "");
            }
        }