public void CreateClassMemeber(VariableObj variableObj, AccessModifier accessModifier) { ClassMemeber classMemeber; classMemeber.variableObj = variableObj; classMemeber.accessModifier = accessModifier; _members.Add(classMemeber); }
public static void WriteVariableString(LangStreamWrapper stream, VariableObj variableObj, string namespaceName = "") { string typeString = ConvertDataType(variableObj.Type); if (typeString != "") { typeString += " "; } stream.Write(typeString + CreateNamespaceString(variableObj.Name, namespaceName)); }
public void CreateClassProperty(VariableObj variableObj, AccessModifier accessModifier) { if (accessModifier != AccessModifier.PRIVATE) { accessModifier = AccessModifier.PROTECTED; } CreateClassMemeber(variableObj, accessModifier); var getFunc = new FunctionObj(variableObj.Type, "get_" + variableObj.Name, (stream) => { stream.WriteLine("return this->" + variableObj.Name + ";"); }); CreateClassFunction(getFunc, AccessModifier.PUBLIC, false); var setFunc = new FunctionObj(DataType.VOID, "set_" + variableObj.Name, (stream) => { stream.WriteLine("this->" + variableObj.Name + " = " + variableObj.Name + ";"); }); setFunc.FuncParams.Add(new VariableObj(variableObj.Type, variableObj.Name)); CreateClassFunction(setFunc, AccessModifier.PUBLIC, false); }
public VariableObj(VariableObj variableObj) : this(variableObj.Type, variableObj.Name) { }
public FunctionObj(VariableObj typeAndName, Action <LangStreamWrapper> contentDelegate = null) { TypeAndName = typeAndName; FuncParams = new List <VariableObj>(); ContentDelegate = contentDelegate; }