protected string GenerateVariableAccess(RgacProperty property, bool isStatic)
 {
     return(isStatic
         ? (property.OwnerUDT.AssociatedGacType.ToString() + "::" + property.PublicGacFieldAccessor.Name)
         : string.Format("__GacUIInternal<{0}>::GetInternalObject(*this)->{1}", property.OwnerUDT.ToString(), property.PublicGacFieldAccessor.Name)
            );
 }
        protected void GenerateProperty(RgacUDT owner, RgacProperty property, bool isStatic, List <Action> methodInvokers)
        {
            WriteLine("(new PropertyDescriptor(L\"{0}\", IMemberDescriptor::{1}))", property.Name, (isStatic ? "Static" : "Normal"));
            WriteLine("->PropertyType(" + GetType(property.PropertyType) + ")");
            if (property.PublicGacFieldAccessor == null)
            {
                if (property.Getter != null)
                {
                    Begin("->Getter(");
                    GenerateMethod(owner, property.Getter, isStatic, methodInvokers);
                    End(")");
                }
                if (property.Setter != null)
                {
                    Begin("->Setter(");
                    GenerateMethod(owner, property.Setter, isStatic, methodInvokers);
                    End(")");
                }
            }
            else
            {
                Begin("->Getter(");
                GenerateFieldAccessGetter(owner, property.PropertyType, property.Name, isStatic, methodInvokers);
                End(")");

                if (property.PublicGacFieldAccessor.Type.Kind != GacTypeKind.Const && !property.IsNotAssignableClassField)
                {
                    Begin("->Setter(");
                    GenerateFieldAccessSetter(owner, property.PropertyType, property.Name, isStatic, methodInvokers);
                    End(")");
                }
            }
        }
        protected void GenerateProperty(RgacProperty property, bool isStatic)
        {
            if (property.Getter != null)
            {
                GenerateMethod(property.Getter, isStatic);
            }
            if (property.Setter != null)
            {
                GenerateMethod(property.Setter, isStatic);
            }
            if (property.PublicGacFieldAccessor != null)
            {
                if (property.IsEventField)
                {
                    WriteLine("{0} {1}on_{2}()",
                              GetType(property.PropertyType),
                              property.OwnerUDT.Name.Aggregate("", (a, b) => a + b + "::"),
                              property.Name
                              );
                    Begin("{");
                    GenerateResultExtraction(
                        GenerateVariableAccess(property, isStatic),
                        property.PropertyType
                        );
                    End("}");
                    WriteLine("");
                }
                else
                {
                    WriteLine("{0} {1}get_{2}()",
                              GetType(property.PropertyType),
                              property.OwnerUDT.Name.Aggregate("", (a, b) => a + b + "::"),
                              property.Name
                              );
                    Begin("{");
                    GenerateResultExtraction(
                        GenerateVariableAccess(property, isStatic),
                        property.PropertyType
                        );
                    End("}");
                    WriteLine("");

                    if (property.PublicGacFieldAccessor.Type.Kind != GacTypeKind.Const && !property.IsNotAssignableClassField)
                    {
                        WriteLine("void {0}set_{1}({2} value)",
                                  property.OwnerUDT.Name.Aggregate("", (a, b) => a + b + "::"),
                                  property.Name,
                                  GetType(property.PropertyType)
                                  );
                        Begin("{");
                        GenerateParameterExtraction("value", property.PropertyType);
                        WriteLine("{0} = {1};", GenerateVariableAccess(property, isStatic), GetUnwrappedParameterName("value"));
                        End("}");
                        WriteLine("");
                    }
                }
            }
        }
        protected void GenerateProperty(RgacProperty property, bool isStatic)
        {
            if (property.Getter != null)
            {
                GenerateMethod(property.Getter, isStatic);
            }
            if (property.Setter != null)
            {
                GenerateMethod(property.Setter, isStatic);
            }
            if (property.PublicGacFieldAccessor != null)
            {
                if (property.IsEventField)
                {
                    WriteLine("{0}{1} on_{2}();",
                              (isStatic ? "static " : ""),
                              GetType(property.PropertyType),
                              property.Name
                              );
                }
                else
                {
                    WriteLine("{0}{1} get_{2}();",
                              (isStatic ? "static " : ""),
                              GetType(property.PropertyType),
                              property.Name
                              );

                    if (property.PublicGacFieldAccessor.Type.Kind != GacTypeKind.Const && !property.IsNotAssignableClassField)
                    {
                        WriteLine("{0}void set_{1}({2} value);",
                                  (isStatic ? "static " : ""),
                                  property.Name,
                                  GetType(property.PropertyType)
                                  );
                    }
                }
            }
        }
Esempio n. 5
0
 protected IEnumerable <RgacUDT> GetRelatedUdts(RgacProperty property)
 {
     return(GetRelatedUdts(property.PropertyType));
 }