Logo Search packages:      
Sourcecode: ndoc version File versions  Download package

void NDoc::Core::Reflection::ReflectionEngine::WriteProperty ( XmlWriter  writer,
PropertyInfo  property,
bool  inherited,
int  overload,
bool  hiding 
) [inline, private]

Writes XML documenting a property.

Parameters:
writer XmlWriter to write on.
property Property to document.
inherited true if a declaringType attribute should be included.
overload If > 0, indicates this it the nth overloaded method with the same name.
hiding true if this property is hiding base class members with the same name.

Definition at line 2247 of file ReflectionEngine.cs.

            {
                  if (property != null)
                  {
                        string memberName = GetMemberName(property);

                        string name = property.Name;
                        string interfaceName = null;

                        MethodInfo getter = property.GetGetMethod(true);
                        MethodInfo setter = property.GetSetMethod(true);

                        int lastIndexOfDot = name.LastIndexOf('.');
                        if (lastIndexOfDot != -1)
                        {
                              //this is an explicit interface implementation. if we don't want
                              //to document them, get out of here quick...
                              if (!this.rep.DocumentExplicitInterfaceImplementations) return;

                              interfaceName = name.Substring(0, lastIndexOfDot);
                              lastIndexOfDot = interfaceName.LastIndexOf('.');
                              if (lastIndexOfDot != -1)
                                    name = name.Substring(lastIndexOfDot + 1);

                              //check if we want to document this interface.
                              ImplementsInfo implements = null;
                              if (getter != null)
                              {
                                    implements = implementations[getter.ToString()];
                              }
                              if (implements == null)
                              {
                                    if (setter != null)
                                    {
                                          implements = implementations[setter.ToString()];
                                    }
                              }
                              if (implements == null) return;
                        }

                        writer.WriteStartElement("property");
                        writer.WriteAttributeString("name", name);
                        writer.WriteAttributeString("id", memberName);
                        writer.WriteAttributeString("access", GetPropertyAccessValue(property));
                        writer.WriteAttributeString("contract", GetPropertyContractValue(property));
                        Type t = property.PropertyType;
                        writer.WriteAttributeString("type", GetTypeName(t));
                        writer.WriteAttributeString("valueType", t.IsValueType.ToString().ToLower());

                        if (inherited)
                        {
                              writer.WriteAttributeString("declaringType", property.DeclaringType.FullName.Replace('+', '.'));
                        }

                        if (overload > 0)
                        {
                              writer.WriteAttributeString("overload", overload.ToString());
                        }

                        if (!IsMemberSafe(property))
                              writer.WriteAttributeString("unsafe", "true");

                        if (hiding)
                        {
                              writer.WriteAttributeString("hiding", "true");
                        }

                        if (interfaceName != null)
                        {
                              writer.WriteAttributeString("interface", interfaceName);
                        }

                        writer.WriteAttributeString("get", getter != null ? "true" : "false");
                        writer.WriteAttributeString("set", setter != null ? "true" : "false");

                        if (inherited)
                        {
                              WriteInheritedDocumentation(writer, memberName, property.DeclaringType);
                        }
                        else
                        {
                              WritePropertyDocumentation(writer, memberName, property, true);
                        }
                        WriteCustomAttributes(writer, property);
                        if (getter != null)
                        {
                              WriteCustomAttributes(writer, getter.ReturnTypeCustomAttributes.GetCustomAttributes(true), "return");
                        }

                        foreach (ParameterInfo parameter in GetIndexParameters(property))
                        {
                              WriteParameter(writer, memberName, parameter);
                        }

                        if (implementations != null)
                        {
                              ImplementsInfo implements = null;
                              if (getter != null)
                              {
                                    implements = implementations[getter.ToString()];
                              }
                              if (implements == null)
                              {
                                    if (setter != null)
                                    {
                                          implements = implementations[setter.ToString()];
                                    }
                              }
                              if (implements != null)
                              {
                                    MethodInfo InterfaceMethod = (MethodInfo)implements.InterfaceMethod;
                                    PropertyInfo InterfaceProperty = DerivePropertyFromAccessorMethod(InterfaceMethod);
                                    if (InterfaceProperty !=null)
                                    {
                                          string InterfacePropertyID = GetMemberName(InterfaceProperty);
                                          writer.WriteStartElement("implements");
                                          writer.WriteAttributeString("name", InterfaceProperty.Name);
                                          writer.WriteAttributeString("id", InterfacePropertyID);
                                          writer.WriteAttributeString("interface", implements.InterfaceType.Name);
                                          writer.WriteAttributeString("interfaceId", GetMemberName(implements.InterfaceType));
                                          writer.WriteAttributeString("declaringType", implements.InterfaceType.FullName.Replace('+', '.'));
                                          writer.WriteEndElement();
                                    }
                                    else if (InterfaceMethod !=null)
                                    {
                                          string InterfaceMethodID = GetMemberName(InterfaceMethod);
                                          writer.WriteStartElement("implements");
                                          writer.WriteAttributeString("name", InterfaceMethod.Name);
                                          writer.WriteAttributeString("id", InterfaceMethodID);
                                          writer.WriteAttributeString("interface", implements.InterfaceType.Name);
                                          writer.WriteAttributeString("interfaceId", GetMemberName(implements.InterfaceType));
                                          writer.WriteAttributeString("declaringType", implements.InterfaceType.FullName.Replace('+', '.'));
                                          writer.WriteEndElement();
                                    }
                              }
                        }

                        writer.WriteEndElement();
                  }
            }


Generated by  Doxygen 1.6.0   Back to index