Blackmire.CppHeaderWalker.VisitPropertyDeclaration C# (CSharp) Method

VisitPropertyDeclaration() public method

public VisitPropertyDeclaration ( Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax node ) : void
node Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax
return void
        public override void VisitPropertyDeclaration(PropertyDeclarationSyntax node)
        {
            // todo: ensure this is same visibility
              var z = model.GetDeclaredSymbol(node);

              var builder = tcb.GetBuilderFor(z.DeclaredAccessibility);

              builder.AppendWithIndent("__declspec(property(");
              CodeBuilder getBuilder = null, setBuilder = null;
              if (z.GetMethod != null)
              {
            builder.Append("get=Get").Append(z.Name);

            getBuilder = new CodeBuilder(builder.IndentValue);
            getBuilder.AppendWithIndent(z.Type.ToCppType())
              .Append(" ") // return by value
              .Append("Get")
              .Append(z.Name)
              .AppendLine("() const;");
              }
              if (z.SetMethod != null)
              {
            if (z.GetMethod != null) builder.Append(",");
            builder.Append("put=Set").Append(z.Name);

            setBuilder = new CodeBuilder(builder.IndentValue);
            setBuilder.AppendWithIndent("void ")
              .Append("Set")
              .Append(z.Name)
              .Append("(")
              .Append(z.Type.ToCppType())
              .AppendLine(");");
              }

              builder.AppendLine(")) ")
            .AppendWithIndent(z.Type.ToCppType())
            .Append(" ")
            .Append(z.Name)
            .AppendLine(";");

              if (getBuilder != null)
            builder.Append(getBuilder.ToString());

              if (setBuilder != null)
            builder.Append(setBuilder.ToString());
        }