public string GetBlock(string tcLine, string tcBlock)
        {
            this.GetBlankToken(tcLine);

            string cDeclaration = ReplaceManager.GetSingledSpacedString(tcLine);

            //Locate the colon in the enum and if so then the enum has a return type
            int npos = cDeclaration.LastIndexOf(":");

            if (npos > 0)
            {
                this.EnumReturnValue = "As " + cDeclaration.Substring(npos + 1).Trim();
                cDeclaration         = cDeclaration.Substring(0, npos).Trim();
            }

            //handle the appropriate conversions
            cDeclaration = ReplaceManager.HandleTypes(cDeclaration);

            //The last word is the name of the enumeration
            npos                      = cDeclaration.IndexOf(" ");
            this.EnumName             = cDeclaration.Substring(npos + 1);
            this.EnumDeclarationToken = cDeclaration.Substring(0, npos).Trim();

            //Replace any commas in the enum block with a next line + blank space
            this.EnumBlock = this.ExtractBlock(tcBlock, "{", "}").Replace(",", "\r\n" + this.BlankToken + "	");

            return(this.Execute());
        }
Example #2
0
        private void BuildClassDeclaration(string tcline)
        {
            tcline = tcline.Replace(":", " : ");
            tcline = ReplaceManager.GetSingledSpacedString(tcline);

            string cCurrent = "";
            string cParent  = "";
            int    npos     = tcline.IndexOf(":");

            if (npos > 0)
            {
                cCurrent = tcline.Substring(0, npos - 1);
                cParent  = tcline.Substring(npos).Trim();
            }
            else
            {
                cCurrent = tcline;
                cParent  = "";
            }

            cCurrent = ReplaceManager.HandleTypes(cCurrent);
            this.ClassDeclarationToken = cCurrent.Trim();

            int nClassPos = this.ClassDeclarationToken.LastIndexOf(" ");

            this.ClassNameToken = this.ClassDeclarationToken.Substring(nClassPos + 1);


            cParent = cParent.Replace(":", "").Trim();

            if (cParent.Length == 0)
            {
                return;
            }

            string[] aParent = cParent.Split(',');
            for (int i = 0; i < aParent.Length; i++)
            {
                string cParentClass    = aParent[i].Trim();
                string cImplementation = " Inherits ";
                if (cParentClass[0] == 'i' || cParentClass[0] == 'I')
                {
                    cImplementation = " Implements ";
                }

                this.ImplementationDeclationToken += "\n" + ((Char)9).ToString() + cImplementation + cParentClass;
            }
        }