Esempio n. 1
0
        public ParsedEnum Clone()
        {
            ParsedEnum cloneToReturn = (ParsedEnum)this.MemberwiseClone();


            cloneToReturn.mValues = new List <string>();

            cloneToReturn.mValues.AddRange(this.mValues);

            return(cloneToReturn);
        }
Esempio n. 2
0
        private void CreateParsedEnum()
        {
            StringBuilder temporaryStringBuilder = new StringBuilder();

            foreach (string s in mCurrentBlock)
            {
                temporaryStringBuilder.AppendLine(s);
            }

            int startingIndex = 0;

            ParsedEnum parsedEnum = new ParsedEnum();

            parsedEnum.Parse(temporaryStringBuilder.ToString(), ref startingIndex);
            parsedEnum.ClassDefinedIn = this.Name;
            mParsedEnums.Add(parsedEnum);
        }
Esempio n. 3
0
        private void CreateParsedEnum()
        {
            StringBuilder temporaryStringBuilder = new StringBuilder();

            foreach (string s in mCurrentBlock)
            {
                temporaryStringBuilder.AppendLine(s);
            }

            int startingIndex = 0;

            ParsedEnum parsedEnum = new ParsedEnum();
            parsedEnum.Parse(temporaryStringBuilder.ToString(), ref startingIndex);
            parsedEnum.ClassDefinedIn = this.Name;
            mParsedEnums.Add(parsedEnum);
        }
Esempio n. 4
0
        public ParsedNamespace(string namespaceContents, bool removeComments, bool trimParsedClassContents)
        {
            int indexIntoFile = 0;

            if (removeComments)
            {
                namespaceContents = ParsedClass.RemoveComments(namespaceContents);
            }

            namespaceContents = ParsedClass.RemovePreprocessoredOutCode(namespaceContents);


            #region Get the namespace name

            Name = FlatRedBall.Utilities.StringFunctions.GetWordAfter("namespace ", namespaceContents);


            #endregion


            while (true)
            {


                int startOfEnum = namespaceContents.IndexOf("enum ", indexIntoFile + 1);

                int startOfClass = namespaceContents.IndexOf("class ", indexIntoFile + 1);
                int startOfStruct = namespaceContents.IndexOf("struct ", indexIntoFile + 1);
                if (startOfStruct != -1 && startOfStruct < startOfClass || startOfClass == -1)
                {
                    startOfClass = startOfStruct;
                }


                int startOfInterface = namespaceContents.IndexOf("interface ", indexIntoFile + 1);

                if (startOfEnum == -1 && startOfClass == -1 && startOfInterface == -1)
                {
                    break;
                }

                if (startOfInterface != -1 && (startOfClass == -1 || startOfInterface < startOfClass))
                {
                    startOfClass = startOfInterface;
                }

                #region Get all enums


                if (startOfEnum != -1 && 
                    (startOfClass == -1 || startOfEnum < startOfClass))
                {

                    ParsedEnum parsedEnum = new ParsedEnum();

                    int startOfLine = 1 + namespaceContents.LastIndexOf('\n', startOfEnum - 1, startOfEnum);


                    parsedEnum.Parse(namespaceContents, ref startOfLine);
                    
                    startOfEnum = namespaceContents.IndexOf("enum ", startOfLine);

                    parsedEnum.Namespace = this.Name;
                    mEnums.Add(parsedEnum);
                    indexIntoFile = startOfLine;

                }

                #endregion

                #region Get all classes



                else if( startOfClass != -1)
                {
                    int i = GetEndOfClassIndex(namespaceContents, startOfClass);

                    indexIntoFile = i;

                    string substring = namespaceContents.Substring(startOfClass, i - startOfClass + 1);

                    ParsedClass parsedClass = new ParsedClass(substring, trimParsedClassContents);

                    parsedClass.Namespace = this.Name;
                    mClasses.Add(parsedClass);
                }
                #endregion

            }
		}
Esempio n. 5
0
        public ParsedNamespace(string namespaceContents, bool removeComments, bool trimParsedClassContents)
        {
            int indexIntoFile = 0;

            if (removeComments)
            {
                namespaceContents = ParsedClass.RemoveComments(namespaceContents);
            }

            namespaceContents = ParsedClass.RemovePreprocessoredOutCode(namespaceContents);


            #region Get the namespace name

            Name = FlatRedBall.Utilities.StringFunctions.GetWordAfter("namespace ", namespaceContents);


            #endregion


            while (true)
            {
                int startOfEnum = namespaceContents.IndexOf("enum ", indexIntoFile + 1);

                int startOfClass  = namespaceContents.IndexOf("class ", indexIntoFile + 1);
                int startOfStruct = namespaceContents.IndexOf("struct ", indexIntoFile + 1);
                if (startOfStruct != -1 && startOfStruct < startOfClass || startOfClass == -1)
                {
                    startOfClass = startOfStruct;
                }


                int startOfInterface = namespaceContents.IndexOf("interface ", indexIntoFile + 1);

                if (startOfEnum == -1 && startOfClass == -1 && startOfInterface == -1)
                {
                    break;
                }

                if (startOfInterface != -1 && (startOfClass == -1 || startOfInterface < startOfClass))
                {
                    startOfClass = startOfInterface;
                }

                #region Get all enums


                if (startOfEnum != -1 &&
                    (startOfClass == -1 || startOfEnum < startOfClass))
                {
                    ParsedEnum parsedEnum = new ParsedEnum();

                    int startOfLine = 1 + namespaceContents.LastIndexOf('\n', startOfEnum - 1, startOfEnum);


                    parsedEnum.Parse(namespaceContents, ref startOfLine);

                    startOfEnum = namespaceContents.IndexOf("enum ", startOfLine);

                    parsedEnum.Namespace = this.Name;
                    mEnums.Add(parsedEnum);
                    indexIntoFile = startOfLine;
                }

                #endregion

                #region Get all classes



                else if (startOfClass != -1)
                {
                    int i = GetEndOfClassIndex(namespaceContents, startOfClass);

                    indexIntoFile = i;

                    string substring = namespaceContents.Substring(startOfClass, i - startOfClass + 1);

                    ParsedClass parsedClass = new ParsedClass(substring, trimParsedClassContents);

                    parsedClass.Namespace = this.Name;
                    mClasses.Add(parsedClass);
                }
                #endregion
            }
        }