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); }
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); }
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); }
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); }
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; } }
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 (); }
public static bool Matches(UmlBlock block) { return block.Name.Contains ("enum"); }