Esempio n. 1
0
        public void CreateClassMemeber(VariableObj variableObj, AccessModifier accessModifier)
        {
            ClassMemeber classMemeber;

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

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