public NamedCppType(string rawType, List<ParsedTypedef> typedefs = null)
        {
            rawType = SymbolParser.handleTemplatedName(SymbolParser.preprocessTemplate(rawType));

            attributes = new ParsedAttributes(rawType);
            rawType = string.Join(" ", rawType.Split(' ').Where(str => !str.Contains("__attribute__")));

            string[] bitFieldSplit = rawType.Split(':');
            string[] typeSplit = bitFieldSplit[0].Trim().Split(' ');

            string unprocessedType = "";
            for (int i = 0; i < typeSplit.Length - 1; ++i)
            {
                unprocessedType += typeSplit[i] + " ";
            }

            if (bitFieldSplit.Length > 1)
            {
                unprocessedType += ": " + bitFieldSplit[1].Trim();
            }

            string unprocessedName = typeSplit[typeSplit.Length-1];

            var arraySplit = unprocessedName.Split('[', ']');

            if (arraySplit.Length > 1)
            {
                for (int i = 1; i < arraySplit.Length; i += 2)
                {
                    unprocessedType = unprocessedType + '[' + arraySplit[i] + ']';
                }

                unprocessedName = unprocessedName.Substring(0, unprocessedName.IndexOf('['));
            }

            name = unprocessedName;

            // Replace reserved keywords.
            switch (name)
            {
                case "class":     name = "_class"; break;
                case "struct":    name = "_struct"; break;
                case "private":   name = "_private"; break;
                case "protected": name = "_protected"; break;
                case "public":    name = "_public"; break;
                case "new":       name = "_new"; break;
                case "delete":    name = "_delete"; break;;
                default: break;
            }

            type = new CppType(unprocessedType, typedefs);
        }
        public ParsedFunction(ParsedLine line, ParsedClass theClass, List<ParsedTypedef> typedefs)
        {
            name = SymbolParser.handleTemplatedName(line.functionName);

            if (theClass != null)
            {
                parentClass = theClass;
                accessLevel = stringToAccessLevel(line.accessLevel);

                int templateIndex = theClass.name.IndexOf("Templated", StringComparison.Ordinal);

                if (templateIndex != -1)
                {
                    // This is a template. Let's check for template ctor/dtor names.
                    string className = parentClass.name.Substring(0, templateIndex);

                    if (name == className)
                    {
                        name = theClass.name;
                        isConstructor = true;
                    }
                    else if (name == "~" + className)
                    {
                        name = theClass.name;
                        isDestructor = true;
                    }
                }

                if (name == parentClass.name)
                {
                    isConstructor = true;
                }
                else if (name == "~" + parentClass.name)
                {
                    isDestructor = true;
                }

                isVirtual = line.isVirtual;
                isConst = line.isConst;
            }

            isStatic = line.isStatic;

            friendlyName = makeFriendlyName();

            if (line.returnType != null)
            {
                returnType = new CppType(SymbolParser.handleTemplatedName(line.returnType), typedefs);
            }

            parameters = new List<CppType>();

            foreach (string parameter in line.parameters.Split(','))
            {
                CppType param = new CppType(SymbolParser.handleTemplatedName(parameter), typedefs);

                if (!param.isBaseType || param.isPointer || (param.baseType.HasValue && param.baseType.Value != BuiltInCppTypes.VOID))
                {
                    parameters.Add(param);
                }
            }

            callingConvention = stringToCallingConv(line.callingConvention);
            address = Convert.ToUInt32(line.address, 16);
        }
        public void crossReferenceUsing(ParsedFunction otherFunc)
        {
            if (returnType == null)
            {
                returnType = otherFunc.returnType;
            }

            if (!accessLevel.HasValue)
            {
                accessLevel = otherFunc.accessLevel;
            }
        }