Пример #1
0
        public void CreateClassMemeber(VariableObj variableObj, AccessModifier accessModifier)
        {
            ClassMemeber classMemeber;

            classMemeber.variableObj    = variableObj;
            classMemeber.accessModifier = accessModifier;

            _members.Add(classMemeber);
        }
Пример #2
0
        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));
        }
Пример #3
0
        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);
        }
Пример #4
0
 public VariableObj(VariableObj variableObj)
     : this(variableObj.Type, variableObj.Name)
 {
 }
Пример #5
0
 public FunctionObj(VariableObj typeAndName, Action <LangStreamWrapper> contentDelegate = null)
 {
     TypeAndName     = typeAndName;
     FuncParams      = new List <VariableObj>();
     ContentDelegate = contentDelegate;
 }