示例#1
0
 public UmlObject(UmlBlock block)
     : this(block.Name)
 {
     name = name.IfContains ("+ ", () => Publicity = Publicity.Public);
     name = name.IfContains ("# ", () => Publicity = Publicity.Protected);
     name = name.IfContains ("- ", () => Publicity = Publicity.Private);
 }
示例#2
0
        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);
        }
示例#3
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);
        }
示例#4
0
        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);
        }
示例#5
0
        public static bool Matches(UmlBlock block)
        {
            string line = block.Name;

            // index operator?
            if (line.Contains ("this [") && line.Contains ("]")) {
                return false;
            }

            // normal method?
            int indexBracketOpen = line.IndexOf ("(");
            int indexBracketClose = line.IndexOf (")");
            if (indexBracketOpen == -1 && indexBracketClose == -1) {
                return true;
            } else {
                return false;
            }
        }
示例#6
0
        private UmlBlock[] ParseBlocks(string[] lines, ref int i, int parentIndent)
        {
            int baseIndent = nextIndent (lines, i);

            List<UmlBlock> blocks = new List<UmlBlock> ();
            for (; i < lines.Length; ++i) {
                string line = lines [i];
                int indent = line.Indentation ();
                // Console.WriteLine (indent + "  " + line + "  (" + baseIndent + ")");

                if (line.Trim ().Contains ("//")) {
                    //Console.WriteLine ("CurrentComments.add(" + line + ")");
                    Comments.AddParsedComment (line.TrimAll ().Substring (2).TrimAll ());

                } else if (indent < baseIndent) {
                    --i;
                    break;

                } else if (indent == baseIndent) {
                    UmlBlock block;
                    string[] comments = Comments.CurrentComments ();
                    if (i + 1 < lines.Length && nextIndent (lines, i + 1) > indent) {
                        i += 1;
                        block = new UmlBlock (
                            name: line.TrimAll (),
                            content: ParseBlocks (lines, ref i, indent),
                            comments : comments
                        );
                    } else {
                        block = new UmlBlock (
                            name: line.TrimAll (),
                            comments: comments
                        );
                    }
                    blocks.Add (block);

                } else if (line.Trim ().Length > 0) {
                    throw new InvalidOperationException ("This should never happen! " + line);
                }
            }
            return blocks.ToArray ();
        }
示例#7
0
 public static bool Matches(UmlBlock block)
 {
     return block.Name.Contains ("enum");
 }