Example #1
0
 /// <summary>
 /// VisitEnter method in the context of the "Hierarchical Visitor Pattern".
 /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
 /// </summary>
 /// <param name="module">The Module instance to visit.</param>
 /// <returns>
 /// true: traverse the children of this instance.
 /// false: do not traverse the children of this instance.
 /// </returns>
 public virtual bool VisitEnterModule(Module module)
 {
     return (true);
 }
Example #2
0
 /// <summary>
 /// VisitLeave method in the context of the "Hierarchical Visitor Pattern".
 /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
 /// </summary>
 /// <param name="module">The Module instance to visit.</param>
 /// <returns>
 /// true: continue traversing the siblings of the supplied instance.
 /// false: stop traversing the siblings of the supplied instance.
 /// </returns>
 public virtual bool VisitLeaveModule(Module module)
 {
     return (true);
 }
        /// <summary>
        /// VisitLeave method in the context of the "Hierarchical Visitor Pattern".
        /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
        /// </summary>
        /// <param name="module">The Module instance to visit.</param>
        /// <returns>
        /// true: continue traversing the siblings of the supplied instance.
        /// false: stop traversing the siblings of the supplied instance.
        /// </returns>
        public override bool VisitLeaveModule(Module module)
        {
            this.prefix = this.prefix.Substring(0, this.prefix.Length - 4);

            return (true);
        }
Example #4
0
        /// <summary>
        /// Create a new Module instance using a node in a raw xml file (that is generated by the ODD).
        /// </summary>
        /// <param name="moduleNode">A module node.</param>
        /// <returns>The created Module instance.</returns>
        public static Module Create(XPathNavigator moduleNode)
        {
            Module module = null; // Return value;
            string name = string.Empty;
            string usage = string.Empty;

            //
            // Determine module name.
            //

            try
            {
                name = moduleNode.GetAttribute("Name", "");
            }
            catch (Exception exception)
            {
                throw (DefinitionFile.CreateException(moduleNode, "Module", "Unable to determine Name", exception));
            }

            //
            // Determine module usage.
            //

            XPathNodeIterator usageNodes = moduleNode.Select("Usage");
            if (usageNodes.MoveNext())
            {
                usage = usageNodes.Current.Value;
            }
            else
            {
                throw (DefinitionFile.CreateException(moduleNode, "Module", "Usage node not found.", null));
            }

            //
            // Construct module instance.
            //

            module = new Module(name, usage);

            //
            // Add attribute instances and Macros instances to created module instance.
            //

            module.AddAttributesAndMacros(moduleNode);

            //
            // Return created instance.
            //

            return (module);
        }
        /// <summary>
        /// VisitEnter method in the context of the "Hierarchical Visitor Pattern".
        /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
        /// </summary>
        /// <param name="module">The Module instance to visit.</param>
        /// <returns>
        /// true: traverse the children of this instance.
        /// false: do not traverse the children of this instance.
        /// </returns>
        public override bool VisitEnterModule(Module module)
        {
            stringBuilder.Append(this.prefix + "Module\n");
            stringBuilder.Append(this.prefix + "  Name: " + module.Name + "\n");
            stringBuilder.Append(this.prefix + "  Usage: " + module.Usage + "\n");
            stringBuilder.Append(this.prefix + "  Attributes and Macros\n");

            this.prefix += "    ";

            return (true);
        }