Example #1
0
        public string WriteHeaderSetterFunction(MemberVariable variable, bool isWithFunctionDefinition, int offset)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            string functionName = "set" + char.ToUpper(variable.PartialName[0]) + variable.PartialName.Substring(1);

            string functionSignature = "".PadLeft(4 * offset) + "void " + functionName + "(" + variable.Type + " " + variable.PartialName + ")";

            string functionDefinition = variable.FullName + " = " + variable.PartialName + ";";

            if (variable.FullName == variable.PartialName)
            {
                functionDefinition = "this->" + functionDefinition;
            }


            if (isWithFunctionDefinition)
            {
                return(functionSignature + " { " + functionDefinition + " }" + Environment.NewLine);
            }
            else
            {
                return(functionSignature + ";" + Environment.NewLine);
            }
        }
Example #2
0
        public string WriteSourceGetterFunction(MemberVariable variable)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            string functionName = "get" + char.ToUpper(variable.PartialName[0]) + variable.PartialName.Substring(1);

            string functionSignature = variable.Type + " " + variable.ClassName + "::" + functionName + "() const";

            string functionDefinition = "return " + variable.FullName + ";";

            return(functionSignature + Environment.NewLine +
                   "{" + Environment.NewLine +
                   "".PadLeft(4) + functionDefinition + Environment.NewLine +
                   "}" + Environment.NewLine);
        }
Example #3
0
        //Gets the variables in the class
        public Dictionary <string, MemberVariable> GetClassVariables(CodeClass codeClass)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            Dictionary <string, MemberVariable> memberVariables = new Dictionary <string, MemberVariable>();
            List <CodeVariable> attributes = new List <CodeVariable>();

            foreach (CodeElement codeElement in codeClass.Children)
            {
                if (codeElement.Kind == vsCMElement.vsCMElementVariable)
                {
                    MemberVariable memberVariable = new MemberVariable((codeElement as CodeVariable), codeClass.Name);
                    memberVariables.Add(memberVariable.FullName, memberVariable);
                }
            }
            return(memberVariables);
        }
Example #4
0
        public string WriteSourceSetterFunction(MemberVariable variable)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            string functionName = "set" + char.ToUpper(variable.PartialName[0]) + variable.PartialName.Substring(1);

            string functionSignature = "void " + variable.ClassName + "::" + functionName + "(" + variable.Type + " " + variable.PartialName + ")";

            string functionDefinition = variable.FullName + " = " + variable.PartialName + ";";

            if (variable.FullName == variable.PartialName)
            {
                functionDefinition = "this->" + functionDefinition;
            }

            return(functionSignature + Environment.NewLine +
                   "{" + Environment.NewLine +
                   "".PadLeft(4) + functionDefinition + Environment.NewLine +
                   "}" + Environment.NewLine);
        }