Esempio n. 1
0
        private static CppName ParseCppName(string name, ref int index)
        {
            CppName result = new CppName();

            result.Name       = ParseName(name, ref index);
            result.Parameters = new CppName[0];
            if (ParseChar(name, '<', ref index))
            {
                List <CppName> parameters = new List <CppName>();
                while (true)
                {
                    parameters.Add(ParseCppName(name, ref index));
                    if (ParseChar(name, '>', ref index))
                    {
                        break;
                    }
                    else if (!ParseChar(name, ',', ref index))
                    {
                        throw new ArgumentException();
                    }
                }
                result.Parameters = parameters.ToArray();
            }
            if (ParseChar(name, ':', ref index))
            {
                if (!ParseChar(name, ':', ref index))
                {
                    throw new ArgumentException();
                }
                result.Member = ParseCppName(name, ref index);
            }
            return(result);
        }
Esempio n. 2
0
        public IEnumerable <CppName> Cascade()
        {
            CppName current = this;

            while (current != null)
            {
                yield return(current);

                current = current.Member;
            }
        }
Esempio n. 3
0
        public static CppName Parse(string name)
        {
            int     index  = 0;
            CppName result = ParseCppName(name.Trim(), ref index);

            if (index != name.Length)
            {
                throw new ArgumentException();
            }
            return(result);
        }