⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 platformutils.hpp

📁 基于属性证书的访问控制源代码,由c++编写,包括openssl,xercesc等
💻 HPP
📖 第 1 页 / 共 3 页
字号:
/* * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in *    the documentation and/or other materials provided with the *    distribution. * * 3. The end-user documentation included with the redistribution, *    if any, must include the following acknowledgment: *       "This product includes software developed by the *        Apache Software Foundation (http://www.apache.org/)." *    Alternately, this acknowledgment may appear in the software itself, *    if and wherever such third-party acknowledgments normally appear. * * 4. The names "Xerces" and "Apache Software Foundation" must *    not be used to endorse or promote products derived from this *    software without prior written permission. For written *    permission, please contact apache\@apache.org. * * 5. Products derived from this software may not be called "Apache", *    nor may "Apache" appear in their name, without prior written *    permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation, and was * originally based on software copyright (c) 1999, International * Business Machines, Inc., http://www.ibm.com .  For more information * on the Apache Software Foundation, please see * <http://www.apache.org/>. *//* * $Id: PlatformUtils.hpp,v 1.24 2004/01/29 11:48:46 cargilld Exp $ */#if !defined(PLATFORMUTILS_HPP)#define PLATFORMUTILS_HPP#include <xercesc/util/XMLException.hpp>#include <xercesc/util/PanicHandler.hpp>XERCES_CPP_NAMESPACE_BEGINclass XMLMsgLoader;class XMLNetAccessor;class XMLTransService;class MemoryManager;class XMLMutex;////  For internal use only////  This class provides a simple abstract API via which lazily evaluated//  data can be cleaned up.//class XMLUTIL_EXPORT XMLDeleter{public :    virtual ~XMLDeleter();protected :    XMLDeleter();private :    XMLDeleter(const XMLDeleter&);    XMLDeleter& operator=(const XMLDeleter&);};/**  * Utilities that must be implemented in a platform-specific way.  *  * This class contains methods that must be implemented in a platform  * specific manner. The actual implementations of these methods are  * available in the per-platform files indide <code>src/util/Platforms  * </code>.  */class XMLUTIL_EXPORT XMLPlatformUtils{public :    /** @name Public Static Data */    //@{    /** The network accessor      *      * This is provided by the per-platform driver, so each platform can      * choose what actual implementation it wants to use. The object must      * be dynamically allocated.      *      * <i>Note that you may optionally, if your platform driver does not      * install a network accessor, set it manually from your client code      * after calling Initialize(). This works because this object is      * not required during initialization, and only comes into play during      * actual XML parsing.</i>      */    static XMLNetAccessor*      fgNetAccessor;    /** The transcoding service.      *      * This is provided by the per platform driver, so each platform can      * choose what implemenation it wants to use. When the platform      * independent initialization code needs to get a transcoding service      * object, it will call <code>makeTransService()</code> to ask the      * per-platform code to create one. Only one transcoding service      * object is reqeusted per-process, so it is shared and synchronized      * among parser instances within that process.      */    static XMLTransService*     fgTransService;    /** The Panic Handler      *      *   This is the application provided panic handler.       */    static PanicHandler*        fgUserPanicHandler;        /** The Panic Handler      *      *   This is the default panic handler.       */        static PanicHandler*        fgDefaultPanicHandler;    /** The configurable memory manager      *      *   This is the pluggable memory manager. If it is not provided by an      *   application, a default implementation is used.      */    static MemoryManager*       fgMemoryManager;        /** The array-allocating memory manager      *      *   This memory manager always allocates memory by calling the      *   global new[] operator. It may be used to allocate memory      *   where such memory needs to be deletable by calling delete [].      *   Since this allocator is always guaranteed to do the same thing      *   there is no reason, nor facility, to override it.      */    static MemoryManager*       fgArrayMemoryManager;    static XMLMutex*            fgAtomicMutex;        //@}    /** @name Initialization amd Panic methods */    //@{    /** Perform per-process parser initialization      *      * Initialization <b>must</b> be called first in any client code.      *      * The locale is set iff the Initialize() is invoked for the very first time,      * to ensure that each and every message loaders, in the process space, share      * the same locale.      *      * All subsequent invocations of Initialize(), with a different locale, have      * no effect on the message loaders, either instantiated, or to be instantiated.      *      * To set to a different locale, client application needs to Terminate() (or      * multiple Terminate() in the case where multiple Initialize() have been invoked      * before), followed by Initialize(new_locale).      *      * The default locale is "en_US".      *      * nlsHome: user specified location where MsgLoader retrieves error message files.      *          the discussion above with regard to locale, applies to this nlsHome      *          as well.      *      * panicHandler: application's panic handler, application owns this handler.      *               Application shall make sure that the plugged panic handler persists       *               through the call to XMLPlatformUtils::terminate().             *      * memoryManager: plugged-in memory manager which is owned by user      *                applications. Applications must make sure that the      *                plugged-in memory manager persisit through the call to      *                XMLPlatformUtils::terminate()      */    static void Initialize(const char*          const locale = XMLUni::fgXercescDefaultLocale                         , const char*          const nlsHome = 0                         ,       PanicHandler*  const panicHandler = 0                         ,       MemoryManager* const memoryManager = 0);    /** Perform per-process parser termination      *      * The termination call is currently optional, to aid those dynamically      * loading the parser to clean up before exit, or to avoid spurious      * reports from leak detectors.      */    static void Terminate();    /** The panic mechanism.      *      * If, during initialization, we cannot even get far enough along      * to get transcoding up or get message loading working, we call      * this method.</p>      *      * Each platform can implement it however they want. This method will      * delegate the panic handling to a user specified panic handler or      * in the absence of it, the default panic handler.      *      * In case the default panic handler does not support a particular      * platform, the platform specific panic hanlding shall be implemented      * here </p>.      *       * @param reason The enumeration that defines the cause of the failure      */    static void panic    (        const   PanicHandler::PanicReasons    reason    );        //@}    /** @name File Methods */    //@{    /** Get the current file position      *      * This must be implemented by the per-platform driver, which should      * use local file services to deterine the current position within      * the passed file.      *      * Since the file API provided here only reads, if the host platform      * supports separate read/write positions, only the read position is      * of any interest, and hence should be the one returned.      *      * @param theFile The file handle      */    static unsigned int curFilePos(FileHandle theFile        , MemoryManager* const manager  = XMLPlatformUtils::fgMemoryManager);    /** Closes the file handle      *      * This must be implemented by the per-platform driver, which should      * use local file services to close the passed file handle, and to      * destroy the passed file handle and any allocated data or system      * resources it contains.      *      * @param theFile The file handle to close      */    static void closeFile(FileHandle theFile        , MemoryManager* const manager  = XMLPlatformUtils::fgMemoryManager);    /** Returns the file size      *      * This must be implemented by the per-platform driver, which should      * use local file services to determine the current size of the file      * represented by the passed handle.      *      * @param theFile The file handle whose size you want      *      * @return Returns the size of the file in bytes      */    static unsigned int fileSize(FileHandle theFile        , MemoryManager* const manager  = XMLPlatformUtils::fgMemoryManager);    /** Opens the file      *      * This must be implemented by the per-platform driver, which should      * use local file services to open passed file. If it fails, a      * null handle pointer should be returned.      *      * @param fileName The string containing the name of the file      *      * @return The file handle of the opened file      */    static FileHandle openFile(const char* const fileName        , MemoryManager* const manager  = XMLPlatformUtils::fgMemoryManager);    /** Opens a named file      *

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -