Added Xerces-C++ 3.1.2
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: NoThreadMutexMgr.cpp 471747 2006-11-06 14:31:56Z amassari $
|
||||
*/
|
||||
|
||||
#include <xercesc/util/MutexManagers/NoThreadMutexMgr.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/*
|
||||
The NoThread mutex manager is for use where no threading is used
|
||||
in an environment. Since no threading is used, mutexes are not
|
||||
needed, so the implementation does essentially nothing.
|
||||
*/
|
||||
|
||||
|
||||
NoThreadMutexMgr::NoThreadMutexMgr()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NoThreadMutexMgr::~NoThreadMutexMgr()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
XMLMutexHandle
|
||||
NoThreadMutexMgr::create(MemoryManager* const manager)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
NoThreadMutexMgr::destroy(XMLMutexHandle mtx, MemoryManager* const manager)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
NoThreadMutexMgr::lock(XMLMutexHandle mtx)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
NoThreadMutexMgr::unlock(XMLMutexHandle mtx)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: NoThreadMutexMgr.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_NOTHREADMUTEXMGR_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_NOTHREADMUTEXMGR_HPP
|
||||
|
||||
#include <xercesc/util/XMLMutexMgr.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/*
|
||||
The NoThread mutex manager is for use where no threading is used
|
||||
in an environment. Since no threading is used, mutexes are not
|
||||
needed, so the implementation does essentially nothing.
|
||||
*/
|
||||
class NoThreadMutexMgr : public XMLMutexMgr
|
||||
{
|
||||
public:
|
||||
NoThreadMutexMgr();
|
||||
virtual ~NoThreadMutexMgr();
|
||||
|
||||
// Mutex operations
|
||||
virtual XMLMutexHandle create(MemoryManager* const manager);
|
||||
virtual void destroy(XMLMutexHandle mtx, MemoryManager* const manager);
|
||||
virtual void lock(XMLMutexHandle mtx);
|
||||
virtual void unlock(XMLMutexHandle mtx);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: PosixMutexMgr.cpp 471747 2006-11-06 14:31:56Z amassari $
|
||||
*/
|
||||
|
||||
// on some platforms, THREAD_MUTEX_RECURSIVE is defined only if _GNU_SOURCE is defined
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include <xercesc/util/MutexManagers/PosixMutexMgr.hpp>
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
#include <xercesc/util/RuntimeException.hpp>
|
||||
#include <xercesc/util/PanicHandler.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
// Wrap up the mutex with XMemory
|
||||
class PosixMutexWrap : public XMemory {
|
||||
public:
|
||||
pthread_mutex_t m;
|
||||
};
|
||||
|
||||
|
||||
PosixMutexMgr::PosixMutexMgr()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
PosixMutexMgr::~PosixMutexMgr()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
XMLMutexHandle
|
||||
PosixMutexMgr::create(MemoryManager* const manager)
|
||||
{
|
||||
PosixMutexWrap* mutex = new (manager) PosixMutexWrap;
|
||||
|
||||
pthread_mutexattr_t attr;
|
||||
pthread_mutexattr_init(&attr);
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
|
||||
if (pthread_mutex_init(&mutex->m, &attr))
|
||||
XMLPlatformUtils::panic(PanicHandler::Panic_MutexErr);
|
||||
|
||||
pthread_mutexattr_destroy(&attr);
|
||||
|
||||
return (void*)(mutex);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PosixMutexMgr::destroy(XMLMutexHandle mtx, MemoryManager* const manager)
|
||||
{
|
||||
PosixMutexWrap* mutex = (PosixMutexWrap*)(mtx);
|
||||
if (mutex != NULL)
|
||||
{
|
||||
if (pthread_mutex_destroy(&mutex->m))
|
||||
{
|
||||
ThrowXMLwithMemMgr(XMLPlatformUtilsException,
|
||||
XMLExcepts::Mutex_CouldNotDestroy, manager);
|
||||
}
|
||||
delete mutex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PosixMutexMgr::lock(XMLMutexHandle mtx)
|
||||
{
|
||||
PosixMutexWrap* mutex = (PosixMutexWrap*)(mtx);
|
||||
if (mutex != NULL)
|
||||
{
|
||||
if (pthread_mutex_lock(&mutex->m))
|
||||
XMLPlatformUtils::panic(PanicHandler::Panic_MutexErr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PosixMutexMgr::unlock(XMLMutexHandle mtx)
|
||||
{
|
||||
PosixMutexWrap* mutex = (PosixMutexWrap*)(mtx);
|
||||
if (mutex != NULL)
|
||||
{
|
||||
if (pthread_mutex_unlock(&mutex->m))
|
||||
XMLPlatformUtils::panic(PanicHandler::Panic_MutexErr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: PosixMutexMgr.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_POSIXMUTEXMGR_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_POSIXMUTEXMGR_HPP
|
||||
|
||||
#include <xercesc/util/XMLMutexMgr.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
// Posix mutex implementation.
|
||||
class PosixMutexMgr : public XMLMutexMgr
|
||||
{
|
||||
public:
|
||||
PosixMutexMgr();
|
||||
virtual ~PosixMutexMgr();
|
||||
|
||||
// Mutex operations
|
||||
virtual XMLMutexHandle create(MemoryManager* const manager);
|
||||
virtual void destroy(XMLMutexHandle mtx, MemoryManager* const manager);
|
||||
virtual void lock(XMLMutexHandle mtx);
|
||||
virtual void unlock(XMLMutexHandle mtx);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: WindowsMutexMgr.cpp 471747 2006-11-06 14:31:56Z amassari $
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <xercesc/util/MutexManagers/WindowsMutexMgr.hpp>
|
||||
#include <xercesc/framework/MemoryManager.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
WindowsMutexMgr::WindowsMutexMgr()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
WindowsMutexMgr::~WindowsMutexMgr()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
XMLMutexHandle
|
||||
WindowsMutexMgr::create(MemoryManager* const manager)
|
||||
{
|
||||
CRITICAL_SECTION* newCS=(CRITICAL_SECTION*)manager->allocate(sizeof(CRITICAL_SECTION));
|
||||
InitializeCriticalSection(newCS);
|
||||
return newCS;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WindowsMutexMgr::destroy(XMLMutexHandle mtx, MemoryManager* const manager)
|
||||
{
|
||||
::DeleteCriticalSection((LPCRITICAL_SECTION)mtx);
|
||||
manager->deallocate(mtx);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WindowsMutexMgr::lock(XMLMutexHandle mtx)
|
||||
{
|
||||
::EnterCriticalSection((LPCRITICAL_SECTION)mtx);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WindowsMutexMgr::unlock(XMLMutexHandle mtx)
|
||||
{
|
||||
::LeaveCriticalSection((LPCRITICAL_SECTION)mtx);
|
||||
}
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: WindowsMutexMgr.hpp 527149 2007-04-10 14:56:39Z amassari $
|
||||
*/
|
||||
|
||||
#if !defined(XERCESC_INCLUDE_GUARD_WINDOWSMUTEXMGR_HPP)
|
||||
#define XERCESC_INCLUDE_GUARD_WINDOWSMUTEXMGR_HPP
|
||||
|
||||
#include <xercesc/util/XMLMutexMgr.hpp>
|
||||
|
||||
XERCES_CPP_NAMESPACE_BEGIN
|
||||
|
||||
/*
|
||||
The mutex manager to use on MS Windows platforms
|
||||
*/
|
||||
class WindowsMutexMgr : public XMLMutexMgr
|
||||
{
|
||||
public:
|
||||
WindowsMutexMgr();
|
||||
virtual ~WindowsMutexMgr();
|
||||
|
||||
// Mutex operations
|
||||
virtual XMLMutexHandle create(MemoryManager* const manager);
|
||||
virtual void destroy(XMLMutexHandle mtx, MemoryManager* const manager);
|
||||
virtual void lock(XMLMutexHandle mtx);
|
||||
virtual void unlock(XMLMutexHandle mtx);
|
||||
};
|
||||
|
||||
XERCES_CPP_NAMESPACE_END
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user