XamlParser.h

00001 //
00002 //  Copyright (c) 1996-2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00008 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00009 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00010 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00011 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00012 //
00013 //  Use, duplication, or disclosure by the U.S. Government is subject to
00014 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00015 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00016 //  Data and Computer Software), as applicable.
00017 //
00018 #if !defined XAML_XAML_PARSER
00019 #define XAML_XAML_PARSER
00020 
00021 #include "XAML/pch.h"
00022 #include "dwfcore/XMLParser.h"
00023 #include <stack>
00024 
00025 class WT_XAML_Xaml_Parser : public DWFXMLCallback
00026 {
00027     enum eViewportState
00028     {
00029         None = 0,
00030         Inside
00031     };
00032 
00033 public:
00034     typedef std::stack < XamlDrawable* >  tDrawableStack;
00035     typedef std::stack < XamlXML::tAttributeMap* > tAttributeMapStack;
00036 
00037 public:
00038 
00039     WT_XAML_Xaml_Parser(WT_XAML_File& file) throw(WT_Result);
00040     virtual ~WT_XAML_Xaml_Parser() throw();
00041 
00042     WT_XAML_File&            xamlFile() { return _rXamlFile; }
00043     DWFXMLParser*            xamlParser() { return _pXamlParser; }
00044 
00045     WT_Result                parseXaml();
00046 
00047     bool                     isParsingFinished() { return (xamlParser() ?  xamlParser()->isParsingFinished() : true); }
00048 
00049     const XamlCanvas*        viewportCanvas() const { return _pViewportCanvas; }
00050 
00051 private:  
00052     // DWFXMLCallback handlers here
00053     void notifyStartElement( const char* zName, const char** ppAttributeList ) throw();
00054     void notifyEndElement( const char* zName ) throw();
00055     void notifyCharacterData( const char* zCData, int nLength ) throw();
00056     void notifyStartNamespace( const char* zPrefix, const char* zURI ) throw();
00057     void notifyEndNamespace( const char* zPrefix ) throw();
00058 
00059     void _processStartElement(void) throw(DWFException);
00060     void _processEndElement(void) throw();
00061     const wchar_t* _getName( XamlDrawable* pDrawable );
00062 
00063 private:
00064     DWFXMLParser*               _pXamlParser;
00065     WT_XAML_File&               _rXamlFile;
00066     XamlXML::tAttributeMap      _oMap;
00067     XamlCanvas*                 _pViewportCanvas;
00068     tDrawableStack              _oDrawables;
00069     int                         _nLastIndex;
00070     WT_String                   _zCurrentElementName;
00071     bool                        _bPendingElementEnded;
00072     bool                        _bSuspended;
00073 };
00074 
00075 #endif //XAML_XAML_PARSER

Generated on Tue Jan 6 22:40:06 2009 for Autodesk DWF Toolkit by  doxygen 1.4.5