public string AsXML(int level) { string output = ""; FileFormatter.AddIndentation(ref output, level); string typeTag; switch (m_type) { case WorldParser.WorldParameterType.StateVariable: typeTag = XMLTags.stateVarTag; break; case WorldParser.WorldParameterType.ActionVariable: typeTag = XMLTags.actionVarTag; break; default: typeTag = XMLTags.constantTag; break; } output += "<" + typeTag + " " + XMLTags.nameAttribute + "=\"" + m_name + "\""; if (m_type != WorldParser.WorldParameterType.Constant) { output += " " + XMLTags.minValueAttribute + "=\"" + m_min + "\" " + XMLTags.maxValueAttribute + "=\"" + m_max + "\" " + XMLTags.unitAttribute + "=\"" + m_unit + "\"/>\n"; } else { output += "/>\n"; } return(output); }
public override string OutputXML(int level) { string output = ""; FileFormatter.AddIndentation(ref output, level); output += "<" + XMLTags.ClassDefinitionNodeTag + " Name=\"" + m_name + "\""; if (ImplementsWorld) { output += " " + XMLTags.worldAttribute + "=\"" + m_world + "\""; } output += ">\n"; foreach (string baseClass in m_baseClasses) { ParameterizedObject baseClassObject = CppSourceParser.GetNamedParamObject(baseClass); if (baseClassObject != null) { foreach (IParameter param in baseClassObject.Parameters) { base.addParameter(param);//output += baseClassObject.outputChildrenXML(level + 1); } } else { Console.WriteLine("Warning." + m_name + " class extends base class " + baseClass + " but definition has not been found. Ignore if the base class is a template class without any parameters."); } } output += OutputChildrenXML(level + 1); FileFormatter.AddIndentation(ref output, level); output += "</" + XMLTags.ClassDefinitionNodeTag + ">\n"; return(output); }
public string AsXML(int level) { string output = ""; FileFormatter.AddIndentation(ref output, level); output += "<" + m_xmlTag + " Name=\"" + m_name + "\" Comment=\"" + m_comment + "\" Default=\"" + m_default + "\"/>\n"; return(output); }
public string AsXML(int level) { string output = ""; FileFormatter.AddIndentation(ref output, level); output += "<" + XMLTags.multiValuedNodeTag + " " + XMLTags.nameAttribute + "=\"" + m_name + "\" " + XMLTags.classAttribute + "=\"" + m_className + "\" " + XMLTags.commentAttribute + "=\"" + m_comment + "\" " + XMLTags.defaultAttribute + "=\"" + m_default + "\"/>\n"; return(output); }
public override string OutputXML(int level) { string output = ""; FileFormatter.AddIndentation(ref output, level); output += "<" + XMLTags.ClassDefinitionNodeTag + " Name=\"" + m_name + "\">\n"; output += OutputChildrenXML(level + 1); FileFormatter.AddIndentation(ref output, level); output += "</" + XMLTags.ClassDefinitionNodeTag + ">\n"; return(output); }
public string AsXML(int level) { string output = ""; FileFormatter.AddIndentation(ref output, level); output += "<" + XMLTags.multiValuedNodeTag + " " + XMLTags.nameAttribute + "=\"" + m_name + "\" " + XMLTags.classAttribute + "=\"" + m_className + "-Factory\" " + XMLTags.commentAttribute + "=\"" + m_comment + "\""; if (m_bOptional) { output += " " + XMLTags.optionalAttribute + "=\"True\""; } output += "/>\n"; return(output); }
public string AsXML(int level) { string output = ""; FileFormatter.AddIndentation(ref output, level); output += "<" + XMLTags.choiceNodeTag + " " + XMLTags.nameAttribute + "=\"" + m_name + "\" " + XMLTags.classAttribute + "=\"" + m_className + "\" " + XMLTags.commentAttribute + "=\"" + m_comment + "\">\n"; foreach (IParameter parameter in m_parameters) { output += parameter.AsXML(level + 1); } FileFormatter.AddIndentation(ref output, level); output += "</" + XMLTags.choiceNodeTag + ">\n"; return(output); }
public override string OutputXML(int level) { string output = ""; FileFormatter.AddIndentation(ref output, level); output += "<" + XMLTags.EnumDefinitionNodeTag + " " + XMLTags.nameAttribute + "=\"" + m_name + "\">\n"; output += OutputChildrenXML(level + 1); foreach (string value in m_enumerationValues) { FileFormatter.AddIndentation(ref output, level + 1); output += "<" + XMLTags.enumNodeTag + ">" + value + "</" + XMLTags.enumNodeTag + ">\n"; } FileFormatter.AddIndentation(ref output, level); output += "</" + XMLTags.EnumDefinitionNodeTag + ">\n"; return(output); }
public string AsXML(int level) { string output = ""; FileFormatter.AddIndentation(ref output, level); output += "<" + XMLTags.branchNodeTag + " " + XMLTags.nameAttribute + "=\"" + m_name + "\" " + XMLTags.classAttribute + "=\"" + m_className + "\" " + XMLTags.commentAttribute + "=\"" + m_comment + "\""; if (m_bOptional) { output += " " + XMLTags.optionalAttribute + "=\"True\""; } if (m_badgerMetadata != "") { output += " " + XMLTags.badgerMetadataAttribute + "=\"" + m_badgerMetadata + "\""; } output += "/>\n"; return(output); }
public string AsXML(int level) { string output = ""; FileFormatter.AddIndentation(ref output, level); string className = m_className; if (m_type == Type.Factory) { className += "-Factory"; } output += "<" + XMLTags.choiceElementNodeTag + " " + XMLTags.nameAttribute + "=\"" + m_name + "\" " + XMLTags.classAttribute + "=\"" + className + "\""; if (m_badgerMetadata != null) { output += " " + XMLTags.badgerMetadataAttribute + "=\"" + m_badgerMetadata + "\""; } output += "/>\n"; return(output); }
public string AsXML(int level) { string output = ""; FileFormatter.AddIndentation(ref output, level); if (m_type == VarType.StateVariable) { output += "<" + XMLTags.stateVarRefTag; } else if (m_type == VarType.ActionVariable) { output += "<" + XMLTags.actionVarRefTag; } else { output += "<" + XMLTags.WireTag; } output += " " + XMLTags.nameAttribute + "=\"" + m_name + "\" " + XMLTags.commentAttribute + "=\"" + m_comment + "\"/>\n"; return(output); }
public static void ExportGUIParametersForHumans(string outputFile, FileFormatter formatter, List <ParameterizedObject> objects) { //Export as XML for Badger using (StreamWriter writer = File.CreateText(outputFile)) { formatter.OpeningSection(writer); formatter.Title1(writer, "GUI-editable parameters"); //Regular classes first formatter.Title2(writer, "Regular classes"); foreach (ParameterizedObject paramObj in objects) { if (!paramObj.IsWorld() && paramObj.Parameters.Count > 0) { formatter.Title3(writer, paramObj.name); formatter.OpenList(writer); foreach (IParameter parameter in paramObj.Parameters) { string parameterDescription = formatter.InlineBold(parameter.GetName()); if (parameter.GetParameterType() != null) { parameterDescription += " (" + formatter.InlineItalic(parameter.GetParameterType()) + ")"; } if (parameter.GetDescription() != null) { parameterDescription += " : " + parameter.GetDescription(); } formatter.ListItem(writer, parameterDescription); } formatter.CloseList(writer); } } //Then worlds formatter.Title2(writer, "Worlds"); foreach (ParameterizedObject paramObj in objects) { if (paramObj.IsWorld() && paramObj.Parameters.Count > 0) { formatter.Title3(writer, paramObj.name); formatter.Title4(writer, "State variables"); formatter.OpenList(writer); WorldParameter worldParameter; foreach (IParameter parameter in paramObj.Parameters) { worldParameter = parameter as WorldParameter; if (worldParameter != null && worldParameter.GetWorldParameterType() == WorldParser.WorldParameterType.StateVariable) { formatter.ListItem(writer, parameter.GetName()); } } formatter.CloseList(writer); formatter.Title4(writer, "Action variables"); formatter.OpenList(writer); foreach (IParameter parameter in paramObj.Parameters) { worldParameter = parameter as WorldParameter; if (worldParameter != null && worldParameter.GetWorldParameterType() == WorldParser.WorldParameterType.ActionVariable) { formatter.ListItem(writer, parameter.GetName()); } } formatter.CloseList(writer); } } formatter.ClosingSection(writer); } }