Пример #1
0
        public MemberDefinitionBase(XmlElement elem, ClassDefinition containingClass)
            : base(containingClass.MetaDef)
        {
            _containingClass = containingClass;
            IsStatic         = elem.GetAttribute("static") == "yes";
            ProtectionLevel  = ProtectionLevelExtensions.ParseProtectionLevel(elem.GetAttribute("protection"));
            _passedByType    = (PassedByType)Enum.Parse(typeof(PassedByType), elem.GetAttribute("passedBy"), true);

            foreach (XmlElement child in elem.ChildNodes)
            {
                switch (child.Name)
                {
                case "name":
                    _nativeName = child.InnerText;
                    break;

                case "type":
                    _typeName       = child.InnerText;
                    _container      = child.GetAttribute("container");
                    _containerKey   = child.GetAttribute("containerKey");
                    _containerValue = child.GetAttribute("containerValue");
                    break;

                case "definition":
                    Definition = child.InnerText;
                    break;

                default:
                    // Let the subclass decide what to do with this.
                    InterpretChildElement(child);
                    break;
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Used for types defined in the meta.xml file.
        /// </summary>
        /// <param name="nsDef">the namespace in which this type is defined. Must not be <c>null</c>.</param>
        /// <param name="surroundingClass">The class this type definition is nested in or <c>null</c> if it's not nested.
        /// In the former case the namespace of the class must be identical to the namespace passed as argument.</param>
        /// <param name="elem">the XML element describing the type; must not be <c>null</c></param>
        protected AbstractTypeDefinition(NamespaceDefinition nsDef, ClassDefinition surroundingClass, XmlElement elem)
            : base(nsDef.MetaDef)
        {
            DefiningXmlElement = elem;
            IncludeFileName    = elem.GetAttribute("includeFile");

            Namespace = nsDef;
            if (surroundingClass != null && surroundingClass.Namespace != nsDef)
            {
                throw new ArgumentException("Namespaces don't match.");
            }
            SurroundingClass = surroundingClass;

            ProtectionLevel = ProtectionLevelExtensions.ParseProtectionLevel(elem.GetAttribute("protection"));
        }