Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.6

Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

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 <xalanc/XSLT/XSLTDefinitions.hpp>
00064 
00065 
00066 
00067 #include <deque>
00068 
00069 
00070 
00071 #include <xalanc/XalanDOM/XalanDOMString.hpp>
00072 
00073 
00074 
00075 #include <xalanc/PlatformSupport/AttributeListImpl.hpp>
00076 #include <xalanc/PlatformSupport/DOMStringHelper.hpp>
00077 
00078 
00079 
00080 XALAN_CPP_NAMESPACE_BEGIN
00081 
00082 
00083 
00084 class FormatterListener;
00085 
00086 
00087 
00088 class XALAN_XSLT_EXPORT OutputContextStack
00089 {
00090 public:
00091 
00092     struct OutputContext
00093     {
00094         OutputContext(FormatterListener*    theListener = 0) :
00095             m_flistener(theListener),
00096             m_pendingAttributes(),
00097             m_pendingElementName(),
00098             m_hasPendingStartDocument(false),
00099             m_mustFlushPendingStartDocument(false)
00100         {
00101         }
00102 
00103         ~OutputContext()
00104         {
00105         }
00106 
00107         void
00108         reset()
00109         {
00110             m_flistener = 0;
00111 
00112             m_pendingAttributes.clear();
00113 
00114             m_pendingElementName.clear();
00115 
00116             m_hasPendingStartDocument = false;
00117 
00118             m_mustFlushPendingStartDocument = false;
00119         }
00120 
00121         FormatterListener*  m_flistener;
00122 
00123         AttributeListImpl   m_pendingAttributes;
00124 
00125         XalanDOMString      m_pendingElementName;
00126 
00127         bool                m_hasPendingStartDocument;
00128 
00129         bool                m_mustFlushPendingStartDocument;
00130     };
00131 
00132 #if defined(XALAN_NO_STD_NAMESPACE)
00133     typedef deque<OutputContext>            OutputContextStackType;
00134 #else
00135     typedef std::deque<OutputContext>       OutputContextStackType;
00136 #endif
00137 
00138     typedef OutputContextStackType::size_type   size_type;
00139 
00140     explicit
00141     OutputContextStack();
00142 
00143     ~OutputContextStack();
00144 
00145     void
00146     pushContext(FormatterListener*  theListener = 0);
00147 
00148     void
00149     popContext();
00150 
00151     FormatterListener*
00152     getFormatterListener() const
00153     {
00154         return (*m_stackPosition).m_flistener;
00155     }
00156 
00157     FormatterListener*&
00158     getFormatterListener()
00159     {
00160         return (*m_stackPosition).m_flistener;
00161     }
00162 
00163     const AttributeListImpl&
00164     getPendingAttributes() const
00165     {
00166         return (*m_stackPosition).m_pendingAttributes;
00167     }
00168 
00169     AttributeListImpl&
00170     getPendingAttributes()
00171     {
00172         return (*m_stackPosition).m_pendingAttributes;
00173     }
00174 
00175     const XalanDOMString&
00176     getPendingElementName() const
00177     {
00178         return (*m_stackPosition).m_pendingElementName;
00179     }
00180 
00181     XalanDOMString&
00182     getPendingElementName()
00183     {
00184         return (*m_stackPosition).m_pendingElementName;
00185     }
00186 
00187     const bool&
00188     getHasPendingStartDocument() const
00189     {
00190         return (*m_stackPosition).m_hasPendingStartDocument;
00191     }
00192 
00193     bool&
00194     getHasPendingStartDocument()
00195     {
00196         return (*m_stackPosition).m_hasPendingStartDocument;
00197     }
00198 
00199     const bool&
00200     getMustFlushPendingStartDocument() const
00201     {
00202         return (*m_stackPosition).m_mustFlushPendingStartDocument;
00203     }
00204 
00205     bool&
00206     getMustFlushPendingStartDocument()
00207     {
00208         return (*m_stackPosition).m_mustFlushPendingStartDocument;
00209     }
00210 
00211     size_type
00212     size() const
00213     {
00214         // Since we always keep one dummy entry at the beginning,
00215         // subtract one from the size
00216         assert(m_stackSize == size_type(OutputContextStackType::const_iterator(m_stackPosition) - m_stack.begin()));
00217 
00218         return m_stackSize;
00219     }
00220 
00221     bool
00222     empty() const
00223     {
00224         return size() == 0 ? true : false;
00225     }
00226 
00227     void
00228     clear();
00229 
00230     void
00231     reset();
00232 
00233 private:
00234 
00235     // not implemented
00236     OutputContextStack(const OutputContextStack&);
00237 
00238     bool
00239     operator==(const OutputContextStack&) const;
00240 
00241     OutputContextStack&
00242     operator=(const OutputContextStack&);
00243 
00247     OutputContextStackType              m_stack;
00248 
00249     OutputContextStackType::iterator    m_stackPosition;
00250 
00251     size_type                           m_stackSize;
00252 };
00253 
00254 
00255 
00256 XALAN_CPP_NAMESPACE_END
00257 
00258 
00259 
00260 #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.6
Copyright © 2000, 2001, 2002, 2003 The Apache Software Foundation. All Rights Reserved.