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

XSECEnv.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 2003-2004 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  * imitations under the License.
00015  */
00016 
00017 /*
00018  * XSEC
00019  *
00020  * XSECEnv := Configuration class - used by the other classes to retrieve
00021  *            information on the environment they are working under
00022  *
00023  * $Id: XSECEnv.hpp,v 1.5 2004/02/29 06:39:45 blautenb Exp $
00024  *
00025  */
00026 
00027 #ifndef XSECENV_INCLUDE
00028 #define XSECENV_INCLUDE
00029 
00030 // XSEC Includes
00031 #include <xsec/framework/XSECDefs.hpp>
00032 #include <xsec/utils/XSECSafeBufferFormatter.hpp>
00033 
00034 #include <vector>
00035 
00036 // Xerces Includes
00037 
00038 #include <xercesc/dom/DOM.hpp>
00039 
00040 class XSECURIResolver;
00041 
00045 /*\@{*/
00046 
00057 class DSIG_EXPORT XSECEnv {
00058 
00059 public:
00060     
00063     
00069     XSECEnv(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc);
00070     virtual ~XSECEnv();
00071 
00073     
00076 
00097     void setDSIGNSPrefix(const XMLCh * prefix);
00098 
00115     void setECNSPrefix(const XMLCh * prefix);
00116 
00133     void setXPFNSPrefix(const XMLCh * prefix);
00134 
00142     void setXENCNSPrefix(const XMLCh * prefix);
00143 
00152     const XMLCh * getDSIGNSPrefix() const {return mp_prefixNS;}
00153 
00161     const XMLCh * getECNSPrefix() const {return mp_ecPrefixNS;}
00162 
00170     const XMLCh * getXPFNSPrefix() const {return mp_xpfPrefixNS;}
00171 
00181     const XMLCh * getXENCNSPrefix(void) const {return mp_xencPrefixNS;}
00182 
00184 
00187 
00199     void setPrettyPrintFlag(bool flag) {m_prettyPrintFlag = flag;}
00200 
00207     bool getPrettyPrintFlag(void) const {return m_prettyPrintFlag;}
00208 
00221     void doPrettyPrint(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * node) const;
00222 
00224     
00227 
00238     XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * getParentDocument() const
00239         {return mp_doc;}
00240 
00251     void setParentDocument(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc)
00252         {mp_doc = doc;}
00253 
00255 
00258 
00267     void setURIResolver(XSECURIResolver * resolver);
00268 
00275     XSECURIResolver * getURIResolver(void) const;
00276 
00277 
00279 
00283 
00308     void setIdByAttributeName(bool flag);
00309 
00319     bool getIdByAttributeName(void) const;
00320 
00333     void registerIdAttributeName(const XMLCh * name);
00334 
00345     bool deregisterIdAttributeName(const XMLCh * name);
00346 
00354     bool isRegisteredIdAttributeName(const XMLCh * name) const;
00355 
00362     int getIdAttributeNameListSize() const;
00363 
00364     /*
00365      * \brief Get an indexed attribute name to use as an Id
00366      *
00367      * Returns the item at index point in the list
00368      *
00369      * @note This is an internal function and should not be called directly
00370      *
00371      * @param index Pointer into the list
00372      * @returns The indicated element or NULL if it does not exist.
00373      */
00374 
00375     const XMLCh * getIdAttributeNameListItem(int index) const;
00376 
00378     
00381 
00390     XSECSafeBufferFormatter * getSBFormatter(void) const {return mp_formatter;}
00391 
00393 
00394 private:
00395 
00396 #if defined(XSEC_NO_NAMESPACES)
00397     typedef vector<XMLCh *>                 IdNameVectorType;
00398 #else
00399     typedef std::vector<XMLCh *>            IdNameVectorType;
00400 #endif
00401 
00402     // Internal functions
00403 
00404     XSECSafeBufferFormatter     * mp_formatter;
00405     XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument                  
00406                                 * mp_doc;
00407     // For creating functions
00408     XMLCh                       * mp_prefixNS;
00409     XMLCh                       * mp_ecPrefixNS;
00410     XMLCh                       * mp_xpfPrefixNS;
00411     XMLCh                       * mp_xencPrefixNS;
00412 
00413     // Resolvers
00414     XSECURIResolver             * mp_URIResolver;
00415 
00416     // Flags
00417     bool                        m_prettyPrintFlag;
00418     bool                        m_idByAttributeNameFlag;
00419 
00420     // Id handling
00421     IdNameVectorType            m_idAttributeNameList;  
00422 
00423     XSECEnv();
00424 
00425     /*\@}*/
00426 };
00427 
00428 #endif /* XSECENV_INCLUDE */

Generated on Sun Mar 14 21:35:34 2004 for XML-Security-C by doxygen 1.3.2