xmlwrapp
xsltwrapp/init.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2001-2003 Peter J Jones (pjones@pmade.org)
00003  * All Rights Reserved
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * 1. Redistributions of source code must retain the above copyright
00010  *    notice, this list of conditions and the following disclaimer.
00011  * 2. Redistributions in binary form must reproduce the above copyright
00012  *    notice, this list of conditions and the following disclaimer in
00013  *    the documentation and/or other materials provided with the
00014  *    distribution.
00015  * 3. Neither the name of the Author nor the names of its contributors
00016  *    may be used to endorse or promote products derived from this software
00017  *    without specific prior written permission.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
00020  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
00021  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00022  * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR
00023  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00024  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00025  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
00026  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00027  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00028  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00029  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00030  * SUCH DAMAGE.
00031  */
00032 
00033 /**
00034     @file
00035 
00036     This file contains the definition of the xslt::init class.
00037  */
00038 
00039 #ifndef _xsltwrapp_init_h_
00040 #define _xsltwrapp_init_h_
00041 
00042 // xmlwrapp includes
00043 #include "xmlwrapp/init.h"
00044 
00045 /// XSLT library namespace
00046 namespace xslt
00047 {
00048 
00049 /**
00050     The xslt::init class is used to configure the XSLT engine.
00051 
00052     If you want to use any of the xslt::init member functions, do so before
00053     you start any threads or use any other part of xsltwrapp. The member
00054     functions may alter global and/or static variables. In other words, this
00055     class is not thread safe.
00056 
00057     @note In xmlwrapp versions prior to 0.6.0, this class was used to initialize
00058           the library and exactly one instance had to be created before first
00059           use. This is no longer true: user code doesn't have to create any
00060           instances, but it @em can create as many instances as it wants.
00061  */
00062 class init : public xml::init
00063 {
00064 public:
00065     init();
00066     ~init();
00067 
00068     /**
00069         This function controls whether or not the XSLT engine will process
00070         XInclusions by default while parsing the stylesheet. The default is
00071         true.
00072 
00073         @param flag True to enable XInclusing processing; False otherwise.
00074      */
00075     static void process_xincludes(bool flag);
00076 
00077 private:
00078     init(const init&);
00079     init& operator=(const init&);
00080 
00081     void init_library();
00082     void shutdown_library();
00083 
00084     static int ms_counter;
00085 }; // end xslt::init class
00086 
00087 
00088 // use a "nifty counter" to ensure that any source file that uses xsltwrapp
00089 // will initialize the library prior to its first use
00090 namespace
00091 {
00092 xslt::init g_xsltwrapp_initializer;
00093 }
00094 
00095 } // end xslt namespace
00096 
00097 #endif // _xsltwrapp_init_h_