Ejemplo n.º 1
0
        /// <summary>
        /// Create an <see cref="AutoWrapAttribute"/> instance from a so called attached attribute. An attached attribute is
        /// an XML child element of the element the attribute is defined for. See "readme-attributes.txt" for more information.
        /// </summary>
        /// <param name="elem">the attribute as attached attribute XML element</param>
        private static AutoWrapAttribute CreateAttributeFromAttachedAttribute(XmlElement elem)
        {
            // Strip underscore (indicator for attached attributes)
            string typename = elem.Name.Substring(1);
            Type   type     = AutoWrapAttribute.FindAttribute(typename);

            return((AutoWrapAttribute)type.GetMethod("FromElement").Invoke(null, new object[] { elem }));
        }
Ejemplo n.º 2
0
        protected void AddAttributeToInheritanceChain(DefClass type, AutoWrapAttribute attr)
        {
            bool hasit = false;
            foreach (AutoWrapAttribute a in type.Attributes)
            {
                if (a.GetType() == attr.GetType())
                {
                    hasit = true;
                    break;
                }
            }

            if (!hasit)
                type.Attributes.Add(attr);

            if (type.BaseClass != null)
                AddAttributeToInheritanceChain(type.BaseClass, attr);
        }
Ejemplo n.º 3
0
        protected void AddAttributeToInheritanceChain(DefClass type, AutoWrapAttribute attr)
        {
            bool hasit = false;

            foreach (AutoWrapAttribute a in type.Attributes)
            {
                if (a.GetType() == attr.GetType())
                {
                    hasit = true;
                    break;
                }
            }

            if (!hasit)
            {
                type.Attributes.Add(attr);
            }

            if (type.BaseClass != null)
            {
                AddAttributeToInheritanceChain(type.BaseClass, attr);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Adds an attribute to an attribute set and marks the attribute as "not yet processed" so that it can
 /// be processed later.
 /// </summary>
 /// <param name="attributeSet">the set the attribute is to be added to</param>
 /// <param name="attrib">the attribute to be added</param>
 /// <param name="unprocessedAttributes">the list of unprocessed attributes</param>
 private static void AddAttributeToSet(AttributeSet attributeSet, AutoWrapAttribute attrib, List <KeyValuePair <AttributeSet, AutoWrapAttribute> > unprocessedAttributes)
 {
     attributeSet.AddAttribute(attrib);
     unprocessedAttributes.Add(new KeyValuePair <AttributeSet, AutoWrapAttribute>(attributeSet, attrib));
 }
Ejemplo n.º 5
0
 private void AddAttributeInHolder(AttributeHolder holder, AutoWrapAttribute attr)
 {
     holder.Attributes.Add(attr);
     _holders.Add(new KeyValuePair <AttributeHolder, AutoWrapAttribute>(holder, attr));
 }
Ejemplo n.º 6
0
 private void AddAttributeInHolder(AttributeHolder holder, AutoWrapAttribute attr)
 {
     holder.Attributes.Add(attr);
     _holders.Add(new KeyValuePair<AttributeHolder, AutoWrapAttribute>(holder, attr));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Adds an attribute to this set. If this attribute has already been added then it's
 /// overwritten.
 /// </summary>
 public virtual void AddAttribute(AutoWrapAttribute attrib)
 {
     _attributes[attrib.GetType()] = attrib;
 }