mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 10:32:57 +01:00
trunk/branch integration: adding new files
This commit is contained in:
parent
51ddc1baaa
commit
25eaadca7b
88
Foundation/include/Poco/Process_VX.h
Normal file
88
Foundation/include/Poco/Process_VX.h
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
//
|
||||||
|
// Process_VX.h
|
||||||
|
//
|
||||||
|
// $Id: //poco/1.4/Foundation/include/Poco/Process_VX.h#1 $
|
||||||
|
//
|
||||||
|
// Library: Foundation
|
||||||
|
// Package: Processes
|
||||||
|
// Module: Process
|
||||||
|
//
|
||||||
|
// Definition of the ProcessImpl class for VxWorks.
|
||||||
|
//
|
||||||
|
// Copyright (c) 2004-20011, Applied Informatics Software Engineering GmbH.
|
||||||
|
// and Contributors.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person or organization
|
||||||
|
// obtaining a copy of the software and accompanying documentation covered by
|
||||||
|
// this license (the "Software") to use, reproduce, display, distribute,
|
||||||
|
// execute, and transmit the Software, and to prepare derivative works of the
|
||||||
|
// Software, and to permit third-parties to whom the Software is furnished to
|
||||||
|
// do so, all subject to the following:
|
||||||
|
//
|
||||||
|
// The copyright notices in the Software and this entire statement, including
|
||||||
|
// the above license grant, this restriction and the following disclaimer,
|
||||||
|
// must be included in all copies of the Software, in whole or in part, and
|
||||||
|
// all derivative works of the Software, unless such copies or derivative
|
||||||
|
// works are solely in the form of machine-executable object code generated by
|
||||||
|
// a source language processor.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||||
|
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||||
|
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||||
|
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef Foundation_Process_VX_INCLUDED
|
||||||
|
#define Foundation_Process_VX_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
|
#include "Poco/Foundation.h"
|
||||||
|
#include "Poco/RefCountedObject.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
#undef PID
|
||||||
|
|
||||||
|
|
||||||
|
namespace Poco {
|
||||||
|
|
||||||
|
|
||||||
|
class Pipe;
|
||||||
|
|
||||||
|
|
||||||
|
class Foundation_API ProcessHandleImpl: public RefCountedObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ProcessHandleImpl(int pid);
|
||||||
|
~ProcessHandleImpl();
|
||||||
|
|
||||||
|
int id() const;
|
||||||
|
int wait() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
int _pid;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class Foundation_API ProcessImpl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef int PIDImpl;
|
||||||
|
typedef std::vector<std::string> ArgsImpl;
|
||||||
|
|
||||||
|
static PIDImpl idImpl();
|
||||||
|
static void timesImpl(long& userTime, long& kernelTime);
|
||||||
|
static ProcessHandleImpl* launchImpl(const std::string& command, const ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe);
|
||||||
|
static void killImpl(PIDImpl pid);
|
||||||
|
static void requestTerminationImpl(PIDImpl pid);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Poco
|
||||||
|
|
||||||
|
|
||||||
|
#endif // Foundation_Process_UNIX_INCLUDED
|
91
Foundation/include/Poco/Process_WINCE.h
Normal file
91
Foundation/include/Poco/Process_WINCE.h
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
//
|
||||||
|
// Process_WINCE.h
|
||||||
|
//
|
||||||
|
// $Id: //poco/1.4/Foundation/include/Poco/Process_WINCE.h#1 $
|
||||||
|
//
|
||||||
|
// Library: Foundation
|
||||||
|
// Package: Processes
|
||||||
|
// Module: Process
|
||||||
|
//
|
||||||
|
// Definition of the ProcessImpl class for WIN32.
|
||||||
|
//
|
||||||
|
// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH.
|
||||||
|
// and Contributors.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person or organization
|
||||||
|
// obtaining a copy of the software and accompanying documentation covered by
|
||||||
|
// this license (the "Software") to use, reproduce, display, distribute,
|
||||||
|
// execute, and transmit the Software, and to prepare derivative works of the
|
||||||
|
// Software, and to permit third-parties to whom the Software is furnished to
|
||||||
|
// do so, all subject to the following:
|
||||||
|
//
|
||||||
|
// The copyright notices in the Software and this entire statement, including
|
||||||
|
// the above license grant, this restriction and the following disclaimer,
|
||||||
|
// must be included in all copies of the Software, in whole or in part, and
|
||||||
|
// all derivative works of the Software, unless such copies or derivative
|
||||||
|
// works are solely in the form of machine-executable object code generated by
|
||||||
|
// a source language processor.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||||
|
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||||
|
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||||
|
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef Foundation_Process_WINCE_INCLUDED
|
||||||
|
#define Foundation_Process_WINCE_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
|
#include "Poco/Foundation.h"
|
||||||
|
#include "Poco/RefCountedObject.h"
|
||||||
|
#include <vector>
|
||||||
|
#include "Poco/UnWindows.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Poco {
|
||||||
|
|
||||||
|
|
||||||
|
class Pipe;
|
||||||
|
|
||||||
|
|
||||||
|
class Foundation_API ProcessHandleImpl: public RefCountedObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ProcessHandleImpl(HANDLE _hProcess, UInt32 pid);
|
||||||
|
~ProcessHandleImpl();
|
||||||
|
|
||||||
|
UInt32 id() const;
|
||||||
|
int wait() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
HANDLE _hProcess;
|
||||||
|
UInt32 _pid;
|
||||||
|
|
||||||
|
ProcessHandleImpl(const ProcessHandleImpl&);
|
||||||
|
ProcessHandleImpl& operator = (const ProcessHandleImpl&);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class Foundation_API ProcessImpl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef UInt32 PIDImpl;
|
||||||
|
typedef std::vector<std::string> ArgsImpl;
|
||||||
|
|
||||||
|
static PIDImpl idImpl();
|
||||||
|
static void timesImpl(long& userTime, long& kernelTime);
|
||||||
|
static ProcessHandleImpl* launchImpl(const std::string& command, const ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe);
|
||||||
|
static void killImpl(PIDImpl pid);
|
||||||
|
static void requestTerminationImpl(PIDImpl pid);
|
||||||
|
static std::string terminationEventName(PIDImpl pid);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Poco
|
||||||
|
|
||||||
|
|
||||||
|
#endif // Foundation_Process_WINCE_INCLUDED
|
114
Foundation/include/Poco/RWLock_VX.h
Normal file
114
Foundation/include/Poco/RWLock_VX.h
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
//
|
||||||
|
// RWLock_VX.h
|
||||||
|
//
|
||||||
|
// $Id: //poco/1.4/Foundation/include/Poco/RWLock_VX.h#1 $
|
||||||
|
//
|
||||||
|
// Library: Foundation
|
||||||
|
// Package: Threading
|
||||||
|
// Module: RWLock
|
||||||
|
//
|
||||||
|
// Definition of the RWLockImpl class for POSIX Threads (VxWorks).
|
||||||
|
//
|
||||||
|
// Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH.
|
||||||
|
// and Contributors.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person or organization
|
||||||
|
// obtaining a copy of the software and accompanying documentation covered by
|
||||||
|
// this license (the "Software") to use, reproduce, display, distribute,
|
||||||
|
// execute, and transmit the Software, and to prepare derivative works of the
|
||||||
|
// Software, and to permit third-parties to whom the Software is furnished to
|
||||||
|
// do so, all subject to the following:
|
||||||
|
//
|
||||||
|
// The copyright notices in the Software and this entire statement, including
|
||||||
|
// the above license grant, this restriction and the following disclaimer,
|
||||||
|
// must be included in all copies of the Software, in whole or in part, and
|
||||||
|
// all derivative works of the Software, unless such copies or derivative
|
||||||
|
// works are solely in the form of machine-executable object code generated by
|
||||||
|
// a source language processor.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||||
|
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||||
|
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||||
|
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef Foundation_RWLock_VX_INCLUDED
|
||||||
|
#define Foundation_RWLock_VX_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
|
#include "Poco/Foundation.h"
|
||||||
|
#include "Poco/Exception.h"
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace Poco {
|
||||||
|
|
||||||
|
|
||||||
|
class Foundation_API RWLockImpl
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
RWLockImpl();
|
||||||
|
~RWLockImpl();
|
||||||
|
void readLockImpl();
|
||||||
|
bool tryReadLockImpl();
|
||||||
|
void writeLockImpl();
|
||||||
|
bool tryWriteLockImpl();
|
||||||
|
void unlockImpl();
|
||||||
|
|
||||||
|
private:
|
||||||
|
pthread_mutex_t _mutex;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// inlines
|
||||||
|
//
|
||||||
|
inline void RWLockImpl::readLockImpl()
|
||||||
|
{
|
||||||
|
if (pthread_mutex_lock(&_mutex))
|
||||||
|
throw SystemException("cannot lock mutex");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool RWLockImpl::tryReadLockImpl()
|
||||||
|
{
|
||||||
|
int rc = pthread_mutex_trylock(&_mutex);
|
||||||
|
if (rc == 0)
|
||||||
|
return true;
|
||||||
|
else if (rc == EBUSY)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
throw SystemException("cannot lock mutex");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void RWLockImpl::writeLockImpl()
|
||||||
|
{
|
||||||
|
readLockImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool RWLockImpl::tryWriteLockImpl()
|
||||||
|
{
|
||||||
|
return tryReadLockImpl();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void RWLockImpl::unlockImpl()
|
||||||
|
{
|
||||||
|
if (pthread_mutex_unlock(&_mutex))
|
||||||
|
throw SystemException("cannot unlock mutex");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Poco
|
||||||
|
|
||||||
|
|
||||||
|
#endif // Foundation_RWLock_VX_INCLUDED
|
73
Foundation/include/Poco/SharedLibrary_VX.h
Normal file
73
Foundation/include/Poco/SharedLibrary_VX.h
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
//
|
||||||
|
// SharedLibrary_VX.h
|
||||||
|
//
|
||||||
|
// $Id: //poco/1.4/Foundation/include/Poco/SharedLibrary_VX.h#1 $
|
||||||
|
//
|
||||||
|
// Library: Foundation
|
||||||
|
// Package: SharedLibrary
|
||||||
|
// Module: SharedLibrary
|
||||||
|
//
|
||||||
|
// Definition of the SharedLibraryImpl class for VxWorks.
|
||||||
|
//
|
||||||
|
// Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH.
|
||||||
|
// and Contributors.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person or organization
|
||||||
|
// obtaining a copy of the software and accompanying documentation covered by
|
||||||
|
// this license (the "Software") to use, reproduce, display, distribute,
|
||||||
|
// execute, and transmit the Software, and to prepare derivative works of the
|
||||||
|
// Software, and to permit third-parties to whom the Software is furnished to
|
||||||
|
// do so, all subject to the following:
|
||||||
|
//
|
||||||
|
// The copyright notices in the Software and this entire statement, including
|
||||||
|
// the above license grant, this restriction and the following disclaimer,
|
||||||
|
// must be included in all copies of the Software, in whole or in part, and
|
||||||
|
// all derivative works of the Software, unless such copies or derivative
|
||||||
|
// works are solely in the form of machine-executable object code generated by
|
||||||
|
// a source language processor.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||||
|
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||||
|
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||||
|
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef Foundation_SharedLibrary_VX_INCLUDED
|
||||||
|
#define Foundation_SharedLibrary_VX_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
|
#include "Poco/Foundation.h"
|
||||||
|
#include "Poco/Mutex.h"
|
||||||
|
#include <moduleLib.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace Poco {
|
||||||
|
|
||||||
|
|
||||||
|
class Foundation_API SharedLibraryImpl
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
SharedLibraryImpl();
|
||||||
|
~SharedLibraryImpl();
|
||||||
|
void loadImpl(const std::string& path);
|
||||||
|
void unloadImpl();
|
||||||
|
bool isLoadedImpl() const;
|
||||||
|
void* findSymbolImpl(const std::string& name);
|
||||||
|
const std::string& getPathImpl() const;
|
||||||
|
static std::string suffixImpl();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string _path;
|
||||||
|
MODULE_ID _moduleId;
|
||||||
|
static FastMutex _mutex;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Poco
|
||||||
|
|
||||||
|
|
||||||
|
#endif // Foundation_SharedLibrary_VX_INCLUDED
|
167
Foundation/include/Poco/TextBufferIterator.h
Normal file
167
Foundation/include/Poco/TextBufferIterator.h
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
//
|
||||||
|
// TextBufferIterator.h
|
||||||
|
//
|
||||||
|
// $Id: //poco/1.4/Foundation/include/Poco/TextBufferIterator.h#1 $
|
||||||
|
//
|
||||||
|
// Library: Foundation
|
||||||
|
// Package: Text
|
||||||
|
// Module: TextBufferIterator
|
||||||
|
//
|
||||||
|
// Definition of the TextBufferIterator class.
|
||||||
|
//
|
||||||
|
// Copyright (c) 2010, Applied Informatics Software Engineering GmbH.
|
||||||
|
// and Contributors.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person or organization
|
||||||
|
// obtaining a copy of the software and accompanying documentation covered by
|
||||||
|
// this license (the "Software") to use, reproduce, display, distribute,
|
||||||
|
// execute, and transmit the Software, and to prepare derivative works of the
|
||||||
|
// Software, and to permit third-parties to whom the Software is furnished to
|
||||||
|
// do so, all subject to the following:
|
||||||
|
//
|
||||||
|
// The copyright notices in the Software and this entire statement, including
|
||||||
|
// the above license grant, this restriction and the following disclaimer,
|
||||||
|
// must be included in all copies of the Software, in whole or in part, and
|
||||||
|
// all derivative works of the Software, unless such copies or derivative
|
||||||
|
// works are solely in the form of machine-executable object code generated by
|
||||||
|
// a source language processor.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||||
|
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||||
|
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||||
|
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef Foundation_TextBufferIterator_INCLUDED
|
||||||
|
#define Foundation_TextBufferIterator_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
|
#include "Poco/Foundation.h"
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
|
||||||
|
namespace Poco {
|
||||||
|
|
||||||
|
|
||||||
|
class TextEncoding;
|
||||||
|
|
||||||
|
|
||||||
|
class Foundation_API TextBufferIterator
|
||||||
|
/// An unidirectional iterator for iterating over characters in a buffer.
|
||||||
|
/// The TextBufferIterator uses a TextEncoding object to
|
||||||
|
/// work with multi-byte character encodings like UTF-8.
|
||||||
|
/// Characters are reported in Unicode.
|
||||||
|
///
|
||||||
|
/// Example: Count the number of UTF-8 characters in a buffer.
|
||||||
|
///
|
||||||
|
/// UTF8Encoding utf8Encoding;
|
||||||
|
/// char buffer[] = "...";
|
||||||
|
/// TextBufferIterator it(buffer, utf8Encoding);
|
||||||
|
/// TextBufferIterator end(it.end());
|
||||||
|
/// int n = 0;
|
||||||
|
/// while (it != end) { ++n; ++it; }
|
||||||
|
///
|
||||||
|
/// NOTE: When an UTF-16 encoding is used, surrogate pairs will be
|
||||||
|
/// reported as two separate characters, due to restrictions of
|
||||||
|
/// the TextEncoding class.
|
||||||
|
///
|
||||||
|
/// For iterating over the characters in a std::string, see the
|
||||||
|
/// TextIterator class.
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TextBufferIterator();
|
||||||
|
/// Creates an uninitialized TextBufferIterator.
|
||||||
|
|
||||||
|
TextBufferIterator(const char* begin, const TextEncoding& encoding);
|
||||||
|
/// Creates a TextBufferIterator for the given buffer, which must be 0-terminated.
|
||||||
|
/// The encoding object must not be deleted as long as the iterator
|
||||||
|
/// is in use.
|
||||||
|
|
||||||
|
TextBufferIterator(const char* begin, std::size_t size, const TextEncoding& encoding);
|
||||||
|
/// Creates a TextBufferIterator for the given buffer with the given size.
|
||||||
|
/// The encoding object must not be deleted as long as the iterator
|
||||||
|
/// is in use.
|
||||||
|
|
||||||
|
TextBufferIterator(const char* begin, const char* end, const TextEncoding& encoding);
|
||||||
|
/// Creates a TextBufferIterator for the given range.
|
||||||
|
/// The encoding object must not be deleted as long as the iterator
|
||||||
|
/// is in use.
|
||||||
|
|
||||||
|
TextBufferIterator(const char* end);
|
||||||
|
/// Creates an end TextBufferIterator for the given buffer.
|
||||||
|
|
||||||
|
~TextBufferIterator();
|
||||||
|
/// Destroys the TextBufferIterator.
|
||||||
|
|
||||||
|
TextBufferIterator(const TextBufferIterator& it);
|
||||||
|
/// Copy constructor.
|
||||||
|
|
||||||
|
TextBufferIterator& operator = (const TextBufferIterator& it);
|
||||||
|
/// Assignment operator.
|
||||||
|
|
||||||
|
void swap(TextBufferIterator& it);
|
||||||
|
/// Swaps the iterator with another one.
|
||||||
|
|
||||||
|
int operator * () const;
|
||||||
|
/// Returns the Unicode value of the current character.
|
||||||
|
/// If there is no valid character at the current position,
|
||||||
|
/// -1 is returned.
|
||||||
|
|
||||||
|
TextBufferIterator& operator ++ ();
|
||||||
|
/// Prefix increment operator.
|
||||||
|
|
||||||
|
TextBufferIterator operator ++ (int);
|
||||||
|
/// Postfix increment operator.
|
||||||
|
|
||||||
|
bool operator == (const TextBufferIterator& it) const;
|
||||||
|
/// Compares two iterators for equality.
|
||||||
|
|
||||||
|
bool operator != (const TextBufferIterator& it) const;
|
||||||
|
/// Compares two iterators for inequality.
|
||||||
|
|
||||||
|
TextBufferIterator end() const;
|
||||||
|
/// Returns the end iterator for the range handled
|
||||||
|
/// by the iterator.
|
||||||
|
|
||||||
|
private:
|
||||||
|
const TextEncoding* _pEncoding;
|
||||||
|
const char* _it;
|
||||||
|
const char* _end;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// inlines
|
||||||
|
//
|
||||||
|
inline bool TextBufferIterator::operator == (const TextBufferIterator& it) const
|
||||||
|
{
|
||||||
|
return _it == it._it;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool TextBufferIterator::operator != (const TextBufferIterator& it) const
|
||||||
|
{
|
||||||
|
return _it != it._it;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void swap(TextBufferIterator& it1, TextBufferIterator& it2)
|
||||||
|
{
|
||||||
|
it1.swap(it2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline TextBufferIterator TextBufferIterator::end() const
|
||||||
|
{
|
||||||
|
return TextBufferIterator(_end);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Poco
|
||||||
|
|
||||||
|
|
||||||
|
#endif // Foundation_TextBufferIterator_INCLUDED
|
209
Foundation/include/Poco/Thread_WINCE.h
Normal file
209
Foundation/include/Poco/Thread_WINCE.h
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
//
|
||||||
|
// Thread_WINCE.h
|
||||||
|
//
|
||||||
|
// $Id: //poco/1.4/Foundation/include/Poco/Thread_WINCE.h#1 $
|
||||||
|
//
|
||||||
|
// Library: Foundation
|
||||||
|
// Package: Threading
|
||||||
|
// Module: Thread
|
||||||
|
//
|
||||||
|
// Definition of the ThreadImpl class for WIN32.
|
||||||
|
//
|
||||||
|
// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH.
|
||||||
|
// and Contributors.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person or organization
|
||||||
|
// obtaining a copy of the software and accompanying documentation covered by
|
||||||
|
// this license (the "Software") to use, reproduce, display, distribute,
|
||||||
|
// execute, and transmit the Software, and to prepare derivative works of the
|
||||||
|
// Software, and to permit third-parties to whom the Software is furnished to
|
||||||
|
// do so, all subject to the following:
|
||||||
|
//
|
||||||
|
// The copyright notices in the Software and this entire statement, including
|
||||||
|
// the above license grant, this restriction and the following disclaimer,
|
||||||
|
// must be included in all copies of the Software, in whole or in part, and
|
||||||
|
// all derivative works of the Software, unless such copies or derivative
|
||||||
|
// works are solely in the form of machine-executable object code generated by
|
||||||
|
// a source language processor.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||||
|
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||||
|
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||||
|
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef Foundation_Thread_WINCE_INCLUDED
|
||||||
|
#define Foundation_Thread_WINCE_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
|
#include "Poco/Foundation.h"
|
||||||
|
#include "Poco/Runnable.h"
|
||||||
|
#include "Poco/UnWindows.h"
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(TLS_OUT_OF_INDEXES) // Windows CE 5.x does not define this
|
||||||
|
#define TLS_OUT_OF_INDEXES 0xFFFFFFFF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
namespace Poco {
|
||||||
|
|
||||||
|
|
||||||
|
class Foundation_API ThreadImpl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef DWORD TIDImpl;
|
||||||
|
typedef void (*Callable)(void*);
|
||||||
|
typedef DWORD (WINAPI *Entry)(LPVOID);
|
||||||
|
|
||||||
|
struct CallbackData
|
||||||
|
{
|
||||||
|
CallbackData(): callback(0), pData(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Callable callback;
|
||||||
|
void* pData;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum Priority
|
||||||
|
{
|
||||||
|
PRIO_LOWEST_IMPL = THREAD_PRIORITY_LOWEST,
|
||||||
|
PRIO_LOW_IMPL = THREAD_PRIORITY_BELOW_NORMAL,
|
||||||
|
PRIO_NORMAL_IMPL = THREAD_PRIORITY_NORMAL,
|
||||||
|
PRIO_HIGH_IMPL = THREAD_PRIORITY_ABOVE_NORMAL,
|
||||||
|
PRIO_HIGHEST_IMPL = THREAD_PRIORITY_HIGHEST
|
||||||
|
};
|
||||||
|
|
||||||
|
ThreadImpl();
|
||||||
|
~ThreadImpl();
|
||||||
|
|
||||||
|
TIDImpl tidImpl() const;
|
||||||
|
void setPriorityImpl(int prio);
|
||||||
|
int getPriorityImpl() const;
|
||||||
|
void setOSPriorityImpl(int prio);
|
||||||
|
int getOSPriorityImpl() const;
|
||||||
|
static int getMinOSPriorityImpl();
|
||||||
|
static int getMaxOSPriorityImpl();
|
||||||
|
void setStackSizeImpl(int size);
|
||||||
|
int getStackSizeImpl() const;
|
||||||
|
void startImpl(Runnable& target);
|
||||||
|
void startImpl(Callable target, void* pData = 0);
|
||||||
|
|
||||||
|
void joinImpl();
|
||||||
|
bool joinImpl(long milliseconds);
|
||||||
|
bool isRunningImpl() const;
|
||||||
|
static void sleepImpl(long milliseconds);
|
||||||
|
static void yieldImpl();
|
||||||
|
static ThreadImpl* currentImpl();
|
||||||
|
static TIDImpl currentTidImpl();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static DWORD WINAPI runnableEntry(LPVOID pThread);
|
||||||
|
static DWORD WINAPI callableEntry(LPVOID pThread);
|
||||||
|
|
||||||
|
void createImpl(Entry ent, void* pData);
|
||||||
|
void threadCleanup();
|
||||||
|
|
||||||
|
private:
|
||||||
|
class CurrentThreadHolder
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CurrentThreadHolder(): _slot(TlsAlloc())
|
||||||
|
{
|
||||||
|
if (_slot == TLS_OUT_OF_INDEXES)
|
||||||
|
throw SystemException("cannot allocate thread context key");
|
||||||
|
}
|
||||||
|
~CurrentThreadHolder()
|
||||||
|
{
|
||||||
|
TlsFree(_slot);
|
||||||
|
}
|
||||||
|
ThreadImpl* get() const
|
||||||
|
{
|
||||||
|
return reinterpret_cast<ThreadImpl*>(TlsGetValue(_slot));
|
||||||
|
}
|
||||||
|
void set(ThreadImpl* pThread)
|
||||||
|
{
|
||||||
|
TlsSetValue(_slot, pThread);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
DWORD _slot;
|
||||||
|
};
|
||||||
|
|
||||||
|
Runnable* _pRunnableTarget;
|
||||||
|
CallbackData _callbackTarget;
|
||||||
|
HANDLE _thread;
|
||||||
|
DWORD _threadId;
|
||||||
|
int _prio;
|
||||||
|
int _stackSize;
|
||||||
|
|
||||||
|
static CurrentThreadHolder _currentThreadHolder;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// inlines
|
||||||
|
//
|
||||||
|
inline int ThreadImpl::getPriorityImpl() const
|
||||||
|
{
|
||||||
|
return _prio;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline int ThreadImpl::getOSPriorityImpl() const
|
||||||
|
{
|
||||||
|
return _prio;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline int ThreadImpl::getMinOSPriorityImpl()
|
||||||
|
{
|
||||||
|
return PRIO_LOWEST_IMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline int ThreadImpl::getMaxOSPriorityImpl()
|
||||||
|
{
|
||||||
|
return PRIO_HIGHEST_IMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void ThreadImpl::sleepImpl(long milliseconds)
|
||||||
|
{
|
||||||
|
Sleep(DWORD(milliseconds));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void ThreadImpl::yieldImpl()
|
||||||
|
{
|
||||||
|
Sleep(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void ThreadImpl::setStackSizeImpl(int size)
|
||||||
|
{
|
||||||
|
_stackSize = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline int ThreadImpl::getStackSizeImpl() const
|
||||||
|
{
|
||||||
|
return _stackSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline ThreadImpl::TIDImpl ThreadImpl::tidImpl() const
|
||||||
|
{
|
||||||
|
return _threadId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Poco
|
||||||
|
|
||||||
|
|
||||||
|
#endif // Foundation_Thread_WINCE_INCLUDED
|
60
Foundation/include/Poco/Version.h
Normal file
60
Foundation/include/Poco/Version.h
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
//
|
||||||
|
// Version.h
|
||||||
|
//
|
||||||
|
// $Id: //poco/1.4/Foundation/include/Poco/Version.h#5 $
|
||||||
|
//
|
||||||
|
// Library: Foundation
|
||||||
|
// Package: Core
|
||||||
|
// Module: Version
|
||||||
|
//
|
||||||
|
// Version information for the POCO C++ Libraries.
|
||||||
|
//
|
||||||
|
// Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH.
|
||||||
|
// and Contributors.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person or organization
|
||||||
|
// obtaining a copy of the software and accompanying documentation covered by
|
||||||
|
// this license (the "Software") to use, reproduce, display, distribute,
|
||||||
|
// execute, and transmit the Software, and to prepare derivative works of the
|
||||||
|
// Software, and to permit third-parties to whom the Software is furnished to
|
||||||
|
// do so, all subject to the following:
|
||||||
|
//
|
||||||
|
// The copyright notices in the Software and this entire statement, including
|
||||||
|
// the above license grant, this restriction and the following disclaimer,
|
||||||
|
// must be included in all copies of the Software, in whole or in part, and
|
||||||
|
// all derivative works of the Software, unless such copies or derivative
|
||||||
|
// works are solely in the form of machine-executable object code generated by
|
||||||
|
// a source language processor.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||||
|
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||||
|
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||||
|
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef Foundation_Version_INCLUDED
|
||||||
|
#define Foundation_Version_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Version Information
|
||||||
|
//
|
||||||
|
// Version format is 0xAABBCCDD, where
|
||||||
|
// - AA is the major version number,
|
||||||
|
// - BB is the minor version number,
|
||||||
|
// - CC is the revision number, and
|
||||||
|
// - DD is the patch level number.
|
||||||
|
// Note that some patch level numbers have
|
||||||
|
// a special meaning:
|
||||||
|
// Dx are development releases
|
||||||
|
// Ax are alpha releases
|
||||||
|
// Bx are beta releases
|
||||||
|
//
|
||||||
|
#define POCO_VERSION 0x01040101
|
||||||
|
|
||||||
|
|
||||||
|
#endif // Foundation_Version_INCLUDED
|
Loading…
Reference in New Issue
Block a user