Exemplo n.º 1
0
 public static void WriteFields(StringBuilder header, StringBuilder source, ClassInfo clazz, List <ClassInfo> classes, List <EnumData> enums)
 {
     foreach (FieldInfo fi in clazz.Fields)
     {
         string fieldName = fi.BoundName;
         string typeName  = TypeHandling.ASToCSharpType(fi.Typename, classes);
         string retValue  = TypeHandling.CPPTypeToCSharpValue(fi.Typename, String.Format("{0}_->{1}_", clazz.Name.ToLower(), fi.BoundName), classes, enums);
         string setValue  = TypeHandling.CPPTypeFromCSharpValue(fi.Typename, "value", classes, enums);
         header.AppendFormat("        property {0} {1} {{ {0} get(); void set({0} value); }}\r\n", typeName, fieldName);
         source.AppendFormat("{0} {1}::{2}::get() {{ return {3}; }}\r\n", typeName, clazz.Name, fieldName, retValue);
         source.AppendFormat("void {0}::{1}::set({2} value) {{ {4}_->{1}_ = {3}; }}\r\n\r\n", clazz.Name, fieldName, typeName, setValue, clazz.Name.ToLower());
     }
 }
Exemplo n.º 2
0
        static void WriteSetter(StringBuilder header, StringBuilder source, PropertyPair property, ClassInfo clazz, List <ClassInfo> classes, List <EnumData> enums)
        {
            if (property.Setter != null)      //input value, typename, propertyname, settername
            {
                string setValue = TypeHandling.CPPTypeFromCSharpValue(property.Setter.ParameterTypes[0], "value", classes, enums);

                source.AppendFormat(SOURCE_PROPERTY_SET,
                                    TypeHandling.ASToCSharpType(property.Setter.HeaderDeclaration(classes), classes), // Type of setter
                                    clazz.Name,                                                                       //Name of class
                                    property.GetPropertyName(),                                                       //Name of property
                                    property.Setter.CMethodName,                                                      //Method to invoke
                                    setValue,
                                    clazz.Name.ToLower());                                                            //Conversion into CPP
            }
        }
Exemplo n.º 3
0
        public string SourceCall(List <ClassInfo> clazzes, List <EnumData> enums)
        {
            StringBuilder sb = new StringBuilder();

            if (ParameterTypes.Length > 0 && ParameterNames.Length > 0)
            {
                for (int i = 0; i < ParameterTypes.Length; ++i)
                {
                    if (sb.Length > 0)
                    {
                        sb.Append(", ");
                    }
                    sb.Append(TypeHandling.CPPTypeFromCSharpValue(ParameterTypes[i], ParameterNames[i], clazzes, enums));
                }
            }
            return(sb.ToString());
        }