/// <summary> /// Extenstion method to add a Method to an Dox.Type by pre /// checking for the existance of the Method. /// </summary> /// <param name="type"> /// A <see cref="Codaxy.Dox.Type"/> /// </param> /// <param name="method"> /// A <see cref="Codaxy.Dox.Method"/> /// </param> public static void AddMethod(this Codaxy.Dox.Type type, Codaxy.Dox.Method method) { bool Exists = false; foreach (Method m in type.Methods) { if (m.Name.Equals(method.Name)) Exists = true; } if (!Exists) type.Methods.Add(method); }
/// <summary> /// Extenstion method to add a Field to an Dox.Type by pre /// checking for the existance of the Field. /// </summary> /// <param name="type"> /// A <see cref="Codaxy.Dox.Type"/> /// </param> /// <param name="field"> /// A <see cref="Codaxy.Dox.Field"/> /// </param> public static void AddFiled( this Codaxy.Dox.Type type, Codaxy.Dox.Field field) { bool Exists = false; foreach (Field f in type.Fields) { if (f.Name.Equals(field.Name)) Exists = true; } if (!Exists) type.Fields.Add(field); }
/// <summary> /// Extenstion method to add a Event to an Dox.Type by pre /// checking for the existance of the Event. /// </summary> /// <param name="type"> /// A <see cref="Codaxy.Dox.Type"/> /// </param> /// <param name="_event"> /// A <see cref="Codaxy.Dox.Event"/> /// </param> public static void AddEvent(this Codaxy.Dox.Type type, Codaxy.Dox.Event _event) { bool Exists = false; foreach (Event e in type.Events) { if (e.Name.Equals(_event.Name)) Exists = true; } if (!Exists) type.Events.Add(_event); }
private static HorizontalAlignment GetAlignment(Codaxy.CodeReports.CellAlignment cellAlignment) { switch (cellAlignment) { case Codaxy.CodeReports.CellAlignment.Left: return HorizontalAlignment.Left; case Codaxy.CodeReports.CellAlignment.Right: return HorizontalAlignment.Right; case Codaxy.CodeReports.CellAlignment.Center: return HorizontalAlignment.Center; default: return HorizontalAlignment.Left; } }
/// <summary> /// Parse the DoxygenMember information. Creates a Member if existing in /// Dox.Member definition and add it to the given Dox.Type. /// </summary> /// <param name="m"> /// A <see cref="MemberType"/> /// </param> /// <param name="type"> /// A <see cref="Dox.Type"/> /// </param> /// <param name="types"> /// A <see cref="List<Dox.Type>"/> /// </param> /// <param name="nSpace"> /// A <see cref="System.String"/> /// </param> public static void GetMember(this MemberType m, Codaxy.Dox.Type type, List<Codaxy.Dox.Type> types, string nSpace) { switch (m.kind) { case MemberKind.@enum: types.Add (new Codaxy.Dox.Type { Name = m.name, TypeKind = TypeKind.ENUM, Namespace = nSpace, RefId = m.refid }); break; case MemberKind.enumvalue: foreach (Codaxy.Dox.Type _type in types) { if (_type.RefId.Equals (m.refid)) { if (_type.Fields == null) _type.Fields = new List<Field> (); _type.Fields.Add (new Field { Name = m.name, RefId = m.refid }); } } break; case MemberKind.function: if (type == null) { // so it is namespace (delegate) types.Add (type = new Codaxy.Dox.Type { Namespace = nSpace, Name = ParserTools.GetNameFromFullName(m.name), RefId = m.refid }); } else { // so it is a member method if (type.Methods == null) type.Methods = new List<Method> (); type.Methods.Add (new Codaxy.Dox.Method { Name = m.name, RefId = m.refid, DeclaringType = type.Name }); } break; case MemberKind.variable: if (type == null) System.Console.WriteLine(""); if (type.Fields == null) type.Fields = new List<Field> (); type.Fields.Add (new Codaxy.Dox.Field { Name = ParserTools.GetNameFromFullName(m.name), RefId = m.refid }); break; case MemberKind.property: if (type != null) if (type.Properties == null) type.Properties = new List<Property>(); type.Properties.Add(new Codaxy.Dox.Property { Name = ParserTools.GetNameFromFullName(m.name), RefId = m.refid }); break; } }
/// <summary> /// Parses children objects for Paramter description, and adds /// it to the given Dox.Parameter /// </summary> /// <param name="t"> /// A <see cref="descriptionType"/> /// </param> /// <param name="parameter"> /// A <see cref="Codaxy.Dox.Parameter"/> /// </param> public static void GetParameterDescription(this descriptionType t, Codaxy.Dox.Parameter parameter) { if (t.para != null) foreach (docParaType para in t.para) if (para.Items != null) foreach (var paraList in para.Items) if (paraList.GetType().Equals(typeof(docParamListType))) foreach (docParamListItem item in ((docParamListType)paraList).parameteritem) { if (item.parameternamelist != null && item.parameternamelist[0].Text != null) if (item.parameternamelist[0].Text[0].Equals(parameter.Name)){ // description found string desc = item.parameterdescription.GetText(); parameter.Description = desc; } } }
/// <summary> /// Extenstion method to add a Property to an Dox.Type by pre /// checking for the existance of the Property. /// </summary> /// <param name="type"> /// A <see cref="Codaxy.Dox.Type"/> /// </param> /// <param name="property"> /// A <see cref="Codaxy.Dox.Property"/> /// </param> public static void AddProperty(this Codaxy.Dox.Type type, Codaxy.Dox.Property property) { bool Exists = false; foreach (Property p in type.Properties) { if (p.Name.Equals(property.Name)) Exists = true; } if (!Exists) type.Properties.Add(property); }
/// <summary> /// Updating the Base-Type information of an Dox.Type object. /// In first pars step, the type has just the BaseType reference /// identifier. In this step the identifier got replaced by the /// related BaseType name. /// </summary> /// <param name="type"> /// A <see cref="Codaxy.Dox.Type"/> /// </param> /// <param name="baseType"> /// A <see cref="Codaxy.Dox.Type"/> /// </param> public static void UpdateBaseType(this Codaxy.Dox.Type type, Codaxy.Dox.Type baseType) { if (type.BaseTypes != null) foreach (String baseRef in type.BaseTypes) { if (baseRef.Equals(baseType.RefId)) // found { // Methods if (baseType.Methods != null){ if (type.Methods == null) type.Methods = new List<Method>(baseType.Methods); else foreach (Method method in baseType.Methods) type.AddMethod(method); } // Properties if (baseType.Properties != null){ if (type.Properties == null) type.Properties = new List<Property>(baseType.Properties); else foreach (Property property in baseType.Properties) type.AddProperty(property); } // Fields if (baseType.Fields != null){ if (type.Fields == null) type.Fields = new List<Field>(baseType.Fields); else foreach (Field field in baseType.Fields) type.AddFiled(field); } // Events if (baseType.Events != null){ if (type.Events == null) type.Events = new List<Event>(baseType.Events); else foreach (Event _event in baseType.Events) type.AddEvent(_event); } type.BaseTypes.Remove(baseRef); type.BaseTypes.Add(baseType.Name); break; } } }