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

XSECEnv.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 2003-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  * 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.9 2005/06/04 11:30:26 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     XSECEnv(const XSECEnv & theOther);
00071     virtual ~XSECEnv();
00072 
00074     
00077 
00098     void setDSIGNSPrefix(const XMLCh * prefix);
00099 
00116     void setECNSPrefix(const XMLCh * prefix);
00117 
00134     void setXPFNSPrefix(const XMLCh * prefix);
00135 
00143     void setXENCNSPrefix(const XMLCh * prefix);
00144 
00152     void setXKMSNSPrefix(const XMLCh * prefix);
00153 
00162     const XMLCh * getDSIGNSPrefix() const {return mp_prefixNS;}
00163 
00171     const XMLCh * getECNSPrefix() const {return mp_ecPrefixNS;}
00172 
00180     const XMLCh * getXPFNSPrefix() const {return mp_xpfPrefixNS;}
00181 
00191     const XMLCh * getXENCNSPrefix(void) const {return mp_xencPrefixNS;}
00192 
00202     const XMLCh * getXKMSNSPrefix(void) const {return mp_xkmsPrefixNS;}
00203     
00205 
00208 
00220     void setPrettyPrintFlag(bool flag) {m_prettyPrintFlag = flag;}
00221 
00228     bool getPrettyPrintFlag(void) const {return m_prettyPrintFlag;}
00229 
00242     void doPrettyPrint(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * node) const;
00243 
00245     
00248 
00259     XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * getParentDocument() const
00260         {return mp_doc;}
00261 
00272     void setParentDocument(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc)
00273         {mp_doc = doc;}
00274 
00276 
00279 
00288     void setURIResolver(XSECURIResolver * resolver);
00289 
00296     XSECURIResolver * getURIResolver(void) const;
00297 
00298 
00300 
00304 
00329     void setIdByAttributeName(bool flag);
00330 
00340     bool getIdByAttributeName(void) const;
00341 
00354     void registerIdAttributeName(const XMLCh * name);
00355 
00366     bool deregisterIdAttributeName(const XMLCh * name);
00367 
00375     bool isRegisteredIdAttributeName(const XMLCh * name) const;
00376 
00392     void registerIdAttributeNameNS(const XMLCh * ns, const XMLCh * name);
00393 
00406     bool deregisterIdAttributeNameNS(const XMLCh *ns, const XMLCh * name);
00407 
00417     bool isRegisteredIdAttributeNameNS(const XMLCh * ns, const XMLCh * name) const;
00418 
00425     int getIdAttributeNameListSize() const;
00426 
00427     /*
00428      * \brief Get an indexed attribute name to use as an Id
00429      *
00430      * Returns the item at index point in the list
00431      *
00432      * @note This is an internal function and should not be called directly
00433      *
00434      * @param index Pointer into the list
00435      * @returns The indicated element or NULL if it does not exist.
00436      */
00437 
00438     const XMLCh * getIdAttributeNameListItem(int index) const;
00439 
00440     /*
00441      * \brief Get an indexed attribute Namespace to use as an Id
00442      *
00443      * Returns the item at index point in the list
00444      *
00445      * @note This is an internal function and should not be called directly
00446      *
00447      * @param index Pointer into the list
00448      * @returns The indicated element or NULL if it does not exist.
00449      */
00450 
00451     const XMLCh * getIdAttributeNameListItemNS(int index) const;
00452 
00453     /*
00454      * \brief Determine whether the indexed item is namespace aware
00455      *
00456      * Returns the item at index point in the list
00457      *
00458      * @note This is an internal function and should not be called directly
00459      *
00460      * @param index Pointer into the list
00461      * @returns The indicated element or NULL if it does not exist.
00462      */
00463 
00464     bool getIdAttributeNameListItemIsNS(int index) const;
00465 
00467     
00470 
00479     XSECSafeBufferFormatter * getSBFormatter(void) const {return mp_formatter;}
00480 
00482 
00483 private:
00484 
00485     struct IdAttributeStruct;
00486     typedef struct IdAttributeStruct IdAttributeType;
00487 
00488 
00489 #if defined(XSEC_NO_NAMESPACES)
00490     typedef vector<IdAttributeType *>       IdNameVectorType;
00491 #else
00492     typedef std::vector<IdAttributeType *>  IdNameVectorType;
00493 #endif
00494 
00495     // Internal functions
00496 
00497     XSECSafeBufferFormatter     * mp_formatter;
00498     XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument                  
00499                                 * mp_doc;
00500     // For creating functions
00501     XMLCh                       * mp_prefixNS;
00502     XMLCh                       * mp_ecPrefixNS;
00503     XMLCh                       * mp_xpfPrefixNS;
00504     XMLCh                       * mp_xencPrefixNS;
00505     XMLCh                       * mp_xkmsPrefixNS;
00506 
00507     // Resolvers
00508     XSECURIResolver             * mp_URIResolver;
00509 
00510     // Flags
00511     bool                        m_prettyPrintFlag;
00512     bool                        m_idByAttributeNameFlag;
00513 
00514     // Id handling
00515     IdNameVectorType            m_idAttributeNameList;  
00516 
00517     XSECEnv();
00518 
00519     /*\@}*/
00520 };
00521 
00522 #endif /* XSECENV_INCLUDE */

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