Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.4

Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

OutputContextStack.hpp

Go to the documentation of this file.
00001 /*
00002  * The Apache Software License, Version 1.1
00003  *
00004  *
00005  * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
00006  * reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions
00010  * are met:
00011  *
00012  * 1. Redistributions of source code must retain the above copyright
00013  *    notice, this list of conditions and the following disclaimer. 
00014  *
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in
00017  *    the documentation and/or other materials provided with the
00018  *    distribution.
00019  *
00020  * 3. The end-user documentation included with the redistribution,
00021  *    if any, must include the following acknowledgment:  
00022  *       "This product includes software developed by the
00023  *        Apache Software Foundation (http://www.apache.org/)."
00024  *    Alternately, this acknowledgment may appear in the software itself,
00025  *    if and wherever such third-party acknowledgments normally appear.
00026  *
00027  * 4. The names "Xalan" and "Apache Software Foundation" must
00028  *    not be used to endorse or promote products derived from this
00029  *    software without prior written permission. For written 
00030  *    permission, please contact apache@apache.org.
00031  *
00032  * 5. Products derived from this software may not be called "Apache",
00033  *    nor may "Apache" appear in their name, without prior written
00034  *    permission of the Apache Software Foundation.
00035  *
00036  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
00037  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00038  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00039  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
00040  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00041  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00042  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
00043  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00044  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00045  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00046  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00047  * SUCH DAMAGE.
00048  * ====================================================================
00049  *
00050  * This software consists of voluntary contributions made by many
00051  * individuals on behalf of the Apache Software Foundation and was
00052  * originally based on software copyright (c) 1999, International
00053  * Business Machines, Inc., http://www.ibm.com.  For more
00054  * information on the Apache Software Foundation, please see
00055  * <http://www.apache.org/>.
00056  */
00057 #if !defined(XALAN_OUTPUTCONTEXTSTACK_HEADER_GUARD)
00058 #define XALAN_OUTPUTCONTEXTSTACK_HEADER_GUARD
00059 
00060 
00061 
00062 // Base include file.  Must be first.
00063 #include <XSLT/XSLTDefinitions.hpp>
00064 
00065 
00066 
00067 #include <deque>
00068 
00069 
00070 
00071 #include <XalanDOM/XalanDOMString.hpp>
00072 
00073 
00074 
00075 #include <PlatformSupport/AttributeListImpl.hpp>
00076 #include <PlatformSupport/DOMStringHelper.hpp>
00077 
00078 
00079 
00080 class FormatterListener;
00081 
00082 
00083 
00084 class XALAN_XSLT_EXPORT OutputContextStack
00085 {
00086 public:
00087 
00088     struct OutputContext
00089     {
00090         OutputContext(FormatterListener*    theListener = 0) :
00091             m_flistener(theListener),
00092             m_pendingAttributes(),
00093             m_pendingElementName(),
00094             m_hasPendingStartDocument(false),
00095             m_mustFlushPendingStartDocument(false)
00096         {
00097         }
00098 
00099         ~OutputContext()
00100         {
00101         }
00102 
00103         void
00104         reset()
00105         {
00106             m_flistener = 0;
00107 
00108             m_pendingAttributes.clear();
00109 
00110             ::clear(m_pendingElementName);
00111 
00112             m_hasPendingStartDocument = false;
00113 
00114             m_mustFlushPendingStartDocument = false;
00115         }
00116 
00117         FormatterListener*  m_flistener;
00118 
00119         AttributeListImpl   m_pendingAttributes;
00120 
00121         XalanDOMString      m_pendingElementName;
00122 
00123         bool                m_hasPendingStartDocument;
00124 
00125         bool                m_mustFlushPendingStartDocument;
00126     };
00127 
00128 #if defined(XALAN_NO_NAMESPACES)
00129     typedef deque<OutputContext>            OutputContextStackType;
00130 #else
00131     typedef std::deque<OutputContext>       OutputContextStackType;
00132 #endif
00133 
00134     typedef OutputContextStackType::size_type   size_type;
00135 
00136     explicit
00137     OutputContextStack();
00138 
00139     ~OutputContextStack();
00140 
00141     void
00142     pushContext(FormatterListener*  theListener = 0);
00143 
00144     void
00145     popContext();
00146 
00147     FormatterListener*
00148     getFormatterListener() const
00149     {
00150         return (*m_stackPosition).m_flistener;
00151     }
00152 
00153     FormatterListener*&
00154     getFormatterListener()
00155     {
00156         return (*m_stackPosition).m_flistener;
00157     }
00158 
00159     const AttributeListImpl&
00160     getPendingAttributes() const
00161     {
00162         return (*m_stackPosition).m_pendingAttributes;
00163     }
00164 
00165     AttributeListImpl&
00166     getPendingAttributes()
00167     {
00168         return (*m_stackPosition).m_pendingAttributes;
00169     }
00170 
00171     const XalanDOMString&
00172     getPendingElementName() const
00173     {
00174         return (*m_stackPosition).m_pendingElementName;
00175     }
00176 
00177     XalanDOMString&
00178     getPendingElementName()
00179     {
00180         return (*m_stackPosition).m_pendingElementName;
00181     }
00182 
00183     const bool&
00184     getHasPendingStartDocument() const
00185     {
00186         return (*m_stackPosition).m_hasPendingStartDocument;
00187     }
00188 
00189     bool&
00190     getHasPendingStartDocument()
00191     {
00192         return (*m_stackPosition).m_hasPendingStartDocument;
00193     }
00194 
00195     const bool&
00196     getMustFlushPendingStartDocument() const
00197     {
00198         return (*m_stackPosition).m_mustFlushPendingStartDocument;
00199     }
00200 
00201     bool&
00202     getMustFlushPendingStartDocument()
00203     {
00204         return (*m_stackPosition).m_mustFlushPendingStartDocument;
00205     }
00206 
00207     size_type
00208     size() const
00209     {
00210         // Since we always keep one dummy entry at the beginning,
00211         // subtract one from the size
00212         return m_stack.size() - 1;
00213     }
00214 
00215     bool
00216     empty() const
00217     {
00218         return size() == 0 ? true : false;
00219     }
00220 
00221     void
00222     clear();
00223 
00224     void
00225     reset();
00226 
00227 private:
00228 
00229     // not implemented
00230     OutputContextStack(const OutputContextStack&);
00231 
00232     bool
00233     operator==(const OutputContextStack&) const;
00234 
00235     OutputContextStack&
00236     operator=(const OutputContextStack&);
00237 
00241     OutputContextStackType              m_stack;
00242 
00243     OutputContextStackType::iterator    m_stackPosition;
00244 };
00245 
00246 
00247 
00248 #endif  // XALAN_RESULTNAMESPACESSTACK_HEADER_GUARD

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

Xalan-C++ XSLT Processor Version 1.4
Copyright © 2000, 2001, 2002 The Apache Software Foundation. All Rights Reserved.