// -------------------------------
        // - Begin public methods region -
        // -------------------------------
        /// <summary>
        /// VisitEnter method in the context of the "Hierarchical Visitor Pattern".
        /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
        /// </summary>
        /// <param name="Macro">The Macro 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 VisitEnterMacro(Macro macro)
        {
            if (macro.Name == "Document Relationship Macro")
            {
                this.documentRelationshipMacro = macro;
            }

            return (true);
        }
예제 #2
0
 /// <summary>
 /// VisitEnter method in the context of the "Hierarchical Visitor Pattern".
 /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
 /// </summary>
 /// <param name="Macro">The Macro 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 VisitEnterMacro(Macro Macro)
 {
     return (true);
 }
예제 #3
0
 /// <summary>
 /// VisitLeave method in the context of the "Hierarchical Visitor Pattern".
 /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
 /// </summary>
 /// <param name="macro">The Macro 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 VisitLeaveMacro(Macro macro)
 {
     return (true);
 }
예제 #4
0
파일: Macro.cs 프로젝트: ewcasas/DVTK
        /// <summary>
        /// Create a Macro instance using a raw xml file (that is generated by the ODD).
        /// </summary>
        /// <param name="macroNode">The Macro node.</param>
        /// <param name="parent">The parent.</param>
        /// <returns>The created Macro instance.</returns>
        public static Macro Create(XPathNavigator macroNode, AttributesAndMacros parent)
        {
            string name = string.Empty;

            //
            // Determine Macro name.
            //

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

            //
            // Construct Macro instance.
            //

            Macro macro = new Macro(name, parent);

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

            macro.AddAttributesAndMacros(macroNode);

            //
            // Return created instance.
            //

            return (macro);
        }
예제 #5
0
 /// <summary>
 /// VisitEnter method in the context of the "Hierarchical Visitor Pattern".
 /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
 /// </summary>
 /// <param name="Macro">The Macro 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 VisitEnterMacro(Macro Macro)
 {
     return(true);
 }
예제 #6
0
 /// <summary>
 /// VisitLeave method in the context of the "Hierarchical Visitor Pattern".
 /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
 /// </summary>
 /// <param name="macro">The Macro 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 VisitLeaveMacro(Macro macro)
 {
     return(true);
 }
예제 #7
0
        /// <summary>
        /// VisitEnter method in the context of the "Hierarchical Visitor Pattern".
        /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
        /// </summary>
        /// <param name="Macro">The Macro 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 VisitEnterMacro(Macro macro)
        {
            bool visitChilds = true;

            stringBuilder.Append(this.prefix + "Macro\n");
            stringBuilder.Append(this.prefix + "  Name: " + macro.Name + "\n");

            if (this.parentMacros.ContainsKey(macro))
            {
                stringBuilder.Append(this.prefix + "  Macro has already been visited. Stopping string dump of this Macro to avoid infinite loop.\n");

                visitChilds = false;
            }
            else
            {
                stringBuilder.Append(this.prefix + "  Attributes and Macros\n");

                this.parentMacros.Add(macro, 0);
            }

            this.prefix += "    ";

            return (visitChilds);
        }
예제 #8
0
        /// <summary>
        /// VisitLeave method in the context of the "Hierarchical Visitor Pattern".
        /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
        /// </summary>
        /// <param name="macro">The Macro 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 VisitLeaveMacro(Macro macro)
        {
            this.prefix = this.prefix.Substring(0, this.prefix.Length - 4);

            this.parentMacros.Remove(macro);

            return (true);
        }