Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

TXFMBase.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 2002-2005 The Apache Software Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 /*
00018  * XSEC
00019  *
00020  * TXFMBase := Base (virtual) class that defines a DSIG Transformer
00021  *
00022  * Author(s): Berin Lautenbach
00023  *
00024  * $Id: TXFMBase.hpp,v 1.10 2005/02/03 13:50:12 milan Exp $
00025  *
00026  */
00027 
00028 #ifndef TXFMBASE_INCLUDE
00029 #define TXFMBASE_INCLUDE
00030 
00031 #include <xercesc/dom/DOM.hpp>
00032 #include <xsec/canon/XSECC14n20010315.hpp>
00033 #include <xsec/utils/XSECNameSpaceExpander.hpp>
00034 #include <xsec/utils/XSECXPathNodeList.hpp>
00035 
00036 // Xalan
00037 
00038 #include <xercesc/util/BinInputStream.hpp>
00039 
00040 #include <stdlib.h>
00041 
00042 class TXFMChain;
00043 
00063 class DSIG_EXPORT TXFMBase {
00064 
00065 protected:
00066 
00067     TXFMBase                *input;         // The input source that we read from
00068     bool                    keepComments;   // Each transform needs to tell the next whether comments are still in
00069     XSECNameSpaceExpander   * mp_nse;       // For expanding document name spaces
00070     XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument              
00071                             * mp_expansionDoc;  // For expanding
00072     XSECXPathNodeList       m_XPathMap;     // For node lists if necessary
00073 
00074 public:
00075 
00076     TXFMBase(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc) 
00077         {input = NULL; keepComments = true; mp_nse = NULL; mp_expansionDoc = doc;}
00078     virtual ~TXFMBase();
00079 
00080     // For getting/setting input/output type
00081 
00082     enum ioType {
00083 
00084         NONE            = 1,            // For when there is no Input
00085         BYTE_STREAM     = 2,
00086         DOM_NODES       = 3
00087 
00088     };
00089 
00090     enum nodeType {
00091 
00092         DOM_NODE_NONE               = 1,            // No nodes set
00093         DOM_NODE_DOCUMENT           = 2,            // This is a dom document
00094         DOM_NODE_DOCUMENT_FRAGMENT  = 3,            // This is a fragment only
00095         DOM_NODE_DOCUMENT_NODE      = 4,            // This is a fragment id;d by DOM_Node
00096         DOM_NODE_XPATH_NODESET      = 5             // This is a set of nodes
00097 
00098     };
00099 
00100 
00101     // Methods to set the inputs
00102     // NOTE:  If this throws an exception, the implementation class
00103     // MUST have added the newInput to it's chain to ensure that
00104     // Deletion of the chain will include everything.
00105 
00106     virtual void setInput(TXFMBase *newInput) = 0;
00107 
00108     // Methods to get tranform output type and input requirement
00109 
00110     virtual ioType getInputType(void) = 0;
00111     virtual ioType getOutputType(void) = 0;
00112     virtual nodeType getNodeType(void) = 0;
00113 
00114     // Name space expansion handling
00115     virtual bool nameSpacesExpanded(void);
00116     virtual void expandNameSpaces(void);
00117     void deleteExpandedNameSpaces(void);
00118 
00119     // Comment handling
00120 
00121     virtual void stripComments(void) { keepComments = false;}
00122     virtual void activateComments(void);
00123     virtual bool getCommentsStatus(void) {return keepComments;}
00124 
00125     // Methods to get output data
00126     
00127     // BinInputStream methods:
00128 
00129     virtual unsigned int readBytes(XMLByte * const toFill, const unsigned int maxToFill) = 0;
00130     virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *getDocument() = 0;
00131     virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *getFragmentNode() = 0;
00132     virtual const XMLCh * getFragmentId() = 0;
00133     virtual XSECXPathNodeList & getXPathNodeList() {return m_XPathMap;}
00134 
00135     // Friends and Statics
00136 
00137     friend class TXFMChain;
00138 
00139 
00140 private:
00141 
00142     TXFMBase();
00143 };
00144 
00147 #endif /* #define TXFMBASE_INCLUDE */

Generated on Sun Jul 3 17:37:26 2005 for XML-Security-C by  doxygen 1.4.2