Exemplo n.º 1
0
        public static void PostGenerateCode(Behaviac.Design.MethodDef.Param param, StringWriter stream, string indent, string typename, string var, string caller, object parent)
        {
            Behaviac.Design.ParInfo par = param.Value as Behaviac.Design.ParInfo;

            if (par != null)
            {
                ParInfoCppExporter.PostGenerateCode(par, stream, indent, typename, var, caller);
                return;
            }

            Behaviac.Design.VariableDef v = param.Value as Behaviac.Design.VariableDef;

            if (v != null)
            {
                VariableCppExporter.PostGenerateCode(v, stream, indent, typename, var, caller, parent, param.Name, var);
                return;
            }

            Type type = param.Value.GetType();

            if (Plugin.IsCustomClassType(type) && !DesignerStruct.IsPureConstDatum(param.Value, parent, param.Name))
            {
                StructCppExporter.PostGenerateCode(param.Value, stream, indent, var, parent, param.Name);
            }
        }
Exemplo n.º 2
0
        public static void PostGenerateCode(Behaviac.Design.PropertyDef property, StreamWriter stream, string indent, string typename, string var, string caller, string setValue = null)
        {
            if (property.IsPar || property.IsCustomized)
            {
                ParInfoCppExporter.PostGenerateCode(property, stream, indent, typename, var, caller);
                return;
            }

            string agentName = GetGenerateAgentName(property, var, caller);
            string prop      = setValue;

            if (setValue == null)
            {
                if (property.IsPublic)
                {
                    prop = string.Format("(({0}*){1})->{2}", property.ClassName, agentName, property.BasicName);
                }
                else
                {
                    string propName = property.Name.Replace("::", "_");
                    propName = propName.Replace("[]", "");
                    string nativeType = DataCppExporter.GetGeneratedNativeType(property.NativeType);
                    prop = string.Format("(({0}*){1})->_Get_Property_<{2}PROPERTY_TYPE_{3}, {4} >()", property.ClassName, agentName, getNamespace(property.ClassName), propName, nativeType);
                }
            }

            string propBasicName = property.BasicName.Replace("[]", "");
            uint   id            = Behaviac.Design.CRC32.CalcCRC(propBasicName);

            stream.WriteLine("{0}BEHAVIAC_ASSERT(behaviac::MakeVariableId(\"{1}\") == {2}u);", indent, propBasicName, id);
            stream.WriteLine("{0}{1}->SetVariable(\"{2}\", {3}u, {4});", indent, agentName, propBasicName, id, prop);
        }
Exemplo n.º 3
0
 public static void PostGenerateCode(Behaviac.Design.VariableDef variable, StreamWriter stream, string indent, string typename, string var, string caller, object parent = null, string paramName = "", string setValue = null)
 {
     if (variable.ValueClass == Behaviac.Design.VariableDef.kConst)
     {
         Type type = variable.Value.GetType();
         if (Plugin.IsCustomClassType(type) && !DesignerStruct.IsPureConstDatum(variable.Value, parent, paramName))
         {
             StructCppExporter.PostGenerateCode(variable.Value, stream, indent, var, parent, paramName);
         }
     }
     else if (variable.ValueClass == Behaviac.Design.VariableDef.kPar)
     {
         Behaviac.Design.ParInfo par = variable.Value as Behaviac.Design.ParInfo;
         if (par != null)
         {
             ParInfoCppExporter.PostGenerateCode(par, stream, indent, typename, var, caller);
         }
     }
     else if (variable.Property != null)
     {
         PropertyCppExporter.PostGenerateCode(variable.Property, stream, indent, typename, var, caller, setValue);
     }
 }