Key() public static method

public static Key ( string _name ) : string
_name string
return string
コード例 #1
0
ファイル: UmlAttribute.cs プロジェクト: ewin66/CSharpUML
        public UmlAttribute(Tag tag, UmlClass classobj)
            : base(tag)
        {
            type = tag.ParseType();

            commentsKey = Comments.Key(classobj.Name, name);
        }
コード例 #2
0
ファイル: UmlMethod.cs プロジェクト: ewin66/CSharpUML
        public UmlMethod(Tag tag, UmlClass classobj)
            : base(tag)
        {
            Tag[] paramtags = VSParser.ExtractTags(ref tag.Content, "parameter");

            returntype = "void";

            List <string> parameterlist = new List <string> ();

            foreach (Tag proptag in paramtags)
            {
                string type = proptag.ParseType();
                if (proptag.Params.ContainsKey("direction") && proptag.Params ["direction"].ToLower() == "return")
                {
                    returntype = type;
                }
                else
                {
                    if (type == "void")
                    {
                        parameterlist.Add(proptag.Name);
                    }
                    else
                    {
                        parameterlist.Add(type + " " + proptag.Name);
                    }
                }
            }
            parameters = parameterlist.ToArray();

            commentsKey = Comments.Key(classobj.Name, name, parameters.Unique() + returntype);
        }
コード例 #3
0
        public UmlEnum(Tag tag)
            : base(tag)
        {
            name = tag.Params ["name"];

            tag.Content = tag.Content.Replace(" = ", "=");
            Tag[] literalTags = VSParser.ExtractTags(ref tag.Content, "enumerationLiteral");

            List <string> literals = new List <string> ();

            foreach (Tag literalTag in literalTags)
            {
                if (literalTag.Params.ContainsKey("name"))
                {
                    literals.Add(literalTag.Params ["name"]);
                }
                else
                {
                    Console.WriteLine("weird: " + literalTag.Content);
                }
            }
            values = literals.ToArray();

            commentsKey = Comments.Key(name);
            Packages.AddToCurrentPackage(name);
        }
コード例 #4
0
        public override string ToTexCode()
        {
            List <string> lines = new List <string> ();

            lines.Add(@"\subsubsection{Enumeration " + name + @"}");
            lines.Add(@"\paragraph{Beschreibung:}\mbox{}\newline\newline");
            foreach (string cmt in Comments.GetComments(commentsKey))
            {
                lines.Add(Packages.AddTexCommands(cmt));
            }
            lines.Add("\n");
            lines.Add(@"\paragraph{Eigenschaften:}\mbox{} \newline\newline");
            foreach (string _literal in values)
            {
                string literal = _literal;
                if (literal.Contains("="))
                {
                    string[] p = literal.Split(new char[] { '=' }, 2, StringSplitOptions.RemoveEmptyEntries);
                    literal = @"\ptype{" + p [0] + @"} \keyword{ = } \varname{" + p [1] + @"}";
                }
                else
                {
                    literal = @"\ptype{" + literal + "}";
                }
                lines.Add(@"\textbf{" + literal + @"}\newline\newline");
                foreach (string cmt in Comments.GetComments(Comments.Key(name, _literal)))
                {
                    lines.Add(cmt);
                }
                lines.Add(@"~\\\\");
            }
            return(string.Join("\n", lines));
        }
コード例 #5
0
        public override string ToCSharpCode(int padding = 0)
        {
            string        paddingStr = String.Concat(Enumerable.Repeat(" ", padding));
            List <string> lines      = new List <string> ();

            lines.AddRange(Packages.GetUsingStatements(Packages.GetPackage(name)));

            if (Packages.IsInPackage(name))
            {
                lines.Add(paddingStr + "namespace " + Packages.GetPackage(name));
                lines.Add(paddingStr + "{");
                paddingStr += "    ";
                padding    += 4;
            }

            lines.AddRange(Comments.CSharpComments(commentsKey, paddingStr));
            lines.Add(paddingStr + Publicity.ToCode("", " ") + Virtuality.ToCode("", " ") + "enum " + name);
            lines.Add(paddingStr + "{");
            foreach (string literal in values)
            {
                lines.AddRange(Comments.CSharpComments(Comments.Key(name, literal), paddingStr + "    "));
                lines.Add(paddingStr + "    " + literal + ",");
            }
            lines.Add(paddingStr + "}");

            if (Packages.IsInPackage(name))
            {
                padding   -= 4;
                paddingStr = paddingStr.Substring(4);
                lines.Add(paddingStr + "}");
            }

            return(string.Join("\n", lines));
        }
コード例 #6
0
ファイル: UmlMethod.cs プロジェクト: ewin66/CSharpUML
        public UmlMethod(CSharpBlock block, UmlClass classobj)
            : base(block)
        {
            parseParams();

            if (name.Contains(" "))
            {
                string[] p = name.CleanGenerics()
                             .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                returntype = p [0];
                name       = "";
                for (int i = 0; i < p.Length; ++i)
                {
                    name += i == 0 ? "" : " " + p [i];
                }
            }
            if (name == "")
            {
                name       = returntype;
                returntype = "";
            }
            if (returntype == "void")
            {
                returntype = "";
            }
            name = name.TrimAll();

            commentsKey = Comments.Key(classobj.Name, name, parameters.Unique() + returntype);
        }
コード例 #7
0
        public UmlClass(Tag classtag)
            : base(classtag)
        {
            if (classtag.Tagname == "interface")
            {
                type = ClassType.Interface;
            }
            else
            {
                type = ClassType.Class;
            }

            Content   = ParseContent(classtag).ToArray();
            Publicity = Publicity.Public;

            List <string> _bases = new List <string> ();

            Tag[] baseclasses = VSParser.ExtractTags(ref classtag.Content, "generalization");
            foreach (Tag baseclass in baseclasses)
            {
                _bases.Add(baseclass.ParseType());
            }
            Tag[] baseinterfaces = VSParser.ExtractTags(ref classtag.Content, "interfaceRealization");
            Console.WriteLine("interfaceRealization: " + name + ": " + classtag.Content);
            foreach (Tag baseinterface in baseinterfaces)
            {
                Console.WriteLine("interfaceRealization: " + name + " <- " + baseinterface.Content);
                _bases.Add(baseinterface.ParseType());
            }

            bases = _bases.ToArray();

            commentsKey = Comments.Key(name);
            Packages.AddToCurrentPackage(name);
        }
コード例 #8
0
        public UmlClass(UmlBlock block)
            : base(block)
        {
            name = name.IfContains("class ", () => type = ClassType.Class);
            name = name.IfContains("struct ", () => type = ClassType.Struct);
            name = name.IfContains("interface ", () => type = ClassType.Interface);

            string[] p = name.Split(":");
            if (p.Length == 2)
            {
                name  = p [0].Trim();
                bases = p [1].Trim().Split(",").TrimAll().ToArray();
                if (bases.Length == 1 && bases [0].Length == 0)
                {
                    bases = new string[] {}
                }
                ;
            }
            else
            {
                bases = new string[] {};
            }

            Content = ParseContent(block.Content).ToArray();

            string _name = name;

            Packages.SplitName(_name, out Packages.CurrentPackage, out name);

            Comments.AddTo(commentsKey = Comments.Key(name), block.comments);
            Packages.AddToCurrentPackage(name);
        }
コード例 #9
0
        public UmlClass(CSharpBlock block)
            : base(block)
        {
            name = name.IfContains("class ", () => type = ClassType.Class);
            name = name.IfContains("struct ", () => type = ClassType.Struct);
            name = name.IfContains("interface ", () => type = ClassType.Interface);

            string[] p = name.Split(":");
            if (p.Length == 2)
            {
                name  = p [0].Trim();
                bases = new HashSet <string> (p [1].Trim().Split(",").TrimAll()).ToArray();
            }
            else
            {
                bases = new string[] {};
            }

            Content = ParseContent(block.Content).ToArray();
            if (type == ClassType.Interface)
            {
                foreach (IUmlObject obj in Content)
                {
                    if (obj is UmlObject)
                    {
                        (obj as UmlObject).Publicity = CSharpUML.Publicity.Public;
                    }
                }
            }

            commentsKey = Comments.Key(name);
            Packages.AddToCurrentPackage(name);
        }
コード例 #10
0
 public IEnumerable <string> ParseContent(IEnumerable <UmlBlock> blocks)
 {
     foreach (UmlBlock subblock in blocks)
     {
         string literal = subblock.Name.TrimAll();
         Comments.AddTo(commentsKey = Comments.Key(name, literal), subblock.comments);
         yield return(literal);
     }
 }
コード例 #11
0
        public UmlEnum(CSharpBlock block)
            : base(block)
        {
            name   = name.IfContains("enum ", () => {});
            values = ParseContent(block.Content).ToArray();

            commentsKey = Comments.Key(name);
            Packages.AddToCurrentPackage(name);
        }
コード例 #12
0
ファイル: UmlAttribute.cs プロジェクト: ewin66/CSharpUML
        public UmlAttribute(UmlBlock block, UmlClass classobj)
            : base(block)
        {
            if (name.Contains(":"))
            {
                string[] p = name.Split(":").TrimAll().ToArray();
                name = p [0];
                type = p [1];
            }

            Comments.AddTo(commentsKey = Comments.Key(classobj.Name, name), block.comments);
        }
コード例 #13
0
        public UmlEnum(UmlBlock block)
            : base(block)
        {
            name   = name.IfContains("enum ", () => {});
            values = ParseContent(block.Content).ToArray();

            string _name = name;

            Packages.SplitName(_name, out Packages.CurrentPackage, out name);

            Comments.AddTo(commentsKey = Comments.Key(name), block.comments);
            Packages.AddToCurrentPackage(name);
        }
コード例 #14
0
        public override string ToUmlCode(int padding = 0)
        {
            string        paddingStr = String.Concat(Enumerable.Repeat(" ", padding));
            List <string> lines      = new List <string> ();

            lines.AddRange(Comments.PrintComments(commentsKey, paddingStr));
            string nameWithPackage = Packages.IsInPackage(name) ? Packages.GetPackage(name) + "." + name : name;

            lines.Add(paddingStr + Publicity.ToCode("", " ") + Virtuality.ToCode("", " ") + "enum " + nameWithPackage);
            foreach (string literal in values)
            {
                lines.AddRange(Comments.PrintComments(Comments.Key(name, literal), paddingStr + "    "));
                lines.Add(paddingStr + "    " + literal);
            }
            return(string.Join("\n", lines));
        }
コード例 #15
0
ファイル: UmlMethod.cs プロジェクト: ewin66/CSharpUML
        public UmlMethod(UmlBlock block, UmlClass classobj)
            : base(block)
        {
            parseParams();

            if (name.Contains(":"))
            {
                string[] p = name.Split(":").TrimAll().ToArray();
                name       = p [0];
                returntype = p [1];
            }
            else
            {
                returntype = "";
            }

            Comments.AddTo(commentsKey = Comments.Key(classobj.Name, name, parameters.Unique() + returntype),
                           block.comments);
        }
コード例 #16
0
ファイル: UmlAttribute.cs プロジェクト: ewin66/CSharpUML
        public UmlAttribute(CSharpBlock block, UmlClass classobj)
            : base(block)
        {
            name = name.Split('=') [0].TrimAll();

            if (name.Contains(" "))
            {
                string[] p = name.CleanGenerics()
                             .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                type = p [0];
                name = "";
                for (int i = 0; i < p.Length; ++i)
                {
                    name += i == 0 ? "" : " " + p [i];
                }
            }
            name = name.TrimAll();

            commentsKey = Comments.Key(classobj.Name, name);
        }