This commit is contained in:
Guenter Obiltschnig 2006-11-17 16:21:51 +00:00
Родитель 7ff71d107f
Коммит 768642ae98
744 изменённых файлов: 6781 добавлений и 1036 удалений

Просмотреть файл

@ -302,9 +302,6 @@
Name="VCCLCompilerTool"/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\HashStatistic.cpp">
</File>
<File
RelativePath=".\src\MemoryPool.cpp">
</File>
@ -402,18 +399,15 @@
<File
RelativePath=".\include\Poco\FPEnvironment_WIN32.h">
</File>
<File
RelativePath=".\include\Poco\HashFunction.h">
</File>
<File
RelativePath=".\include\Poco\HashTable.h">
</File>
<File
RelativePath=".\include\Poco\Instantiator.h">
</File>
<File
RelativePath=".\include\Poco\MemoryPool.h">
</File>
<File
RelativePath=".\include\Poco\MetaProgramming.h">
</File>
<File
RelativePath=".\include\Poco\NestedDiagnosticContext.h">
</File>
@ -444,9 +438,6 @@
<File
RelativePath=".\include\Poco\SharedPtr.h">
</File>
<File
RelativePath=".\include\Poco\SimpleHashTable.h">
</File>
<File
RelativePath=".\include\Poco\SingletonHolder.h">
</File>
@ -456,6 +447,12 @@
<File
RelativePath=".\include\Poco\StringTokenizer.h">
</File>
<File
RelativePath=".\include\Poco\Tuple.h">
</File>
<File
RelativePath=".\include\Poco\TypeList.h">
</File>
<File
RelativePath=".\include\Poco\Types.h">
</File>
@ -1453,6 +1450,9 @@
<Filter
Name="Source Files"
Filter="">
<File
RelativePath=".\src\AbstractObserver.cpp">
</File>
<File
RelativePath=".\src\Notification.cpp">
</File>
@ -1462,13 +1462,16 @@
<File
RelativePath=".\src\NotificationQueue.cpp">
</File>
<File
RelativePath=".\src\AbstractObserver.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="">
<File
RelativePath=".\include\Poco\AbstractObserver.h">
</File>
<File
RelativePath=".\include\Poco\NObserver.h">
</File>
<File
RelativePath=".\include\Poco\Notification.h">
</File>
@ -1478,15 +1481,9 @@
<File
RelativePath=".\include\Poco\NotificationQueue.h">
</File>
<File
RelativePath=".\include\Poco\AbstractObserver.h">
</File>
<File
RelativePath=".\include\Poco\Observer.h">
</File>
<File
RelativePath=".\include\Poco\NObserver.h">
</File>
</Filter>
</Filter>
<Filter
@ -2405,6 +2402,9 @@
<File
RelativePath=".\include\Poco\AbstractStrategy.h">
</File>
<File
RelativePath=".\include\Poco\ExpirationDecorator.h">
</File>
<File
RelativePath=".\include\Poco\ExpireCache.h">
</File>
@ -2426,11 +2426,62 @@
<File
RelativePath=".\include\Poco\StrategyCollection.h">
</File>
<File
RelativePath=".\include\Poco\UniqueExpireCache.h">
</File>
<File
RelativePath=".\include\Poco\UniqueExpireLRUCache.h">
</File>
<File
RelativePath=".\include\Poco\UniqueExpireStrategy.h">
</File>
<File
RelativePath=".\include\Poco\ValidArgs.h">
</File>
</Filter>
</Filter>
<Filter
Name="Hashing"
Filter="">
<Filter
Name="Header Files"
Filter="">
<File
RelativePath=".\include\Poco\Hash.h">
</File>
<File
RelativePath=".\include\Poco\HashFunction.h">
</File>
<File
RelativePath=".\include\Poco\HashMap.h">
</File>
<File
RelativePath=".\include\Poco\HashSet.h">
</File>
<File
RelativePath=".\include\Poco\HashStatistic.h">
</File>
<File
RelativePath=".\include\Poco\HashTable.h">
</File>
<File
RelativePath=".\include\Poco\LinearHashTable.h">
</File>
<File
RelativePath=".\include\Poco\SimpleHashTable.h">
</File>
</Filter>
<Filter
Name="Source Files"
Filter="">
<File
RelativePath=".\src\Hash.cpp">
</File>
<File
RelativePath=".\src\HashStatistic.cpp">
</File>
</Filter>
</Filter>
</Files>
<Globals>
</Globals>

Просмотреть файл

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Version="8,00"
Name="Foundation"
ProjectGUID="{8164D41D-B053-405B-826C-CF37AC0EF176}"
RootNamespace="Foundation"
@ -417,10 +417,6 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\HashStatistic.cpp"
>
</File>
<File
RelativePath=".\src\MemoryPool.cpp"
>
@ -549,18 +545,6 @@
RelativePath=".\include\Poco\FPEnvironment_WIN32.h"
>
</File>
<File
RelativePath=".\include\Poco\HashFunction.h"
>
</File>
<File
RelativePath=".\include\Poco\HashStatistic.h"
>
</File>
<File
RelativePath=".\include\Poco\HashTable.h"
>
</File>
<File
RelativePath=".\include\Poco\Instantiator.h"
>
@ -569,6 +553,10 @@
RelativePath=".\include\Poco\MemoryPool.h"
>
</File>
<File
RelativePath=".\include\Poco\MetaProgramming.h"
>
</File>
<File
RelativePath=".\include\Poco\NestedDiagnosticContext.h"
>
@ -609,10 +597,6 @@
RelativePath=".\include\Poco\SharedPtr.h"
>
</File>
<File
RelativePath=".\include\Poco\SimpleHashTable.h"
>
</File>
<File
RelativePath=".\include\Poco\SingletonHolder.h"
>
@ -625,6 +609,14 @@
RelativePath=".\include\Poco\StringTokenizer.h"
>
</File>
<File
RelativePath=".\include\Poco\Tuple.h"
>
</File>
<File
RelativePath=".\include\Poco\TypeList.h"
>
</File>
<File
RelativePath=".\include\Poco\Types.h"
>
@ -1919,6 +1911,10 @@
<Filter
Name="Source Files"
>
<File
RelativePath=".\src\AbstractObserver.cpp"
>
</File>
<File
RelativePath=".\src\Notification.cpp"
>
@ -1931,14 +1927,18 @@
RelativePath=".\src\NotificationQueue.cpp"
>
</File>
<File
RelativePath=".\src\AbstractObserver.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
>
<File
RelativePath=".\include\Poco\AbstractObserver.h"
>
</File>
<File
RelativePath=".\include\Poco\NObserver.h"
>
</File>
<File
RelativePath=".\include\Poco\Notification.h"
>
@ -1951,18 +1951,10 @@
RelativePath=".\include\Poco\NotificationQueue.h"
>
</File>
<File
RelativePath=".\include\Poco\AbstractObserver.h"
>
</File>
<File
RelativePath=".\include\Poco\Observer.h"
>
</File>
<File
RelativePath=".\include\Poco\NObserver.h"
>
</File>
</Filter>
</Filter>
<Filter
@ -3147,6 +3139,10 @@
RelativePath=".\include\Poco\AbstractStrategy.h"
>
</File>
<File
RelativePath=".\include\Poco\ExpirationDecorator.h"
>
</File>
<File
RelativePath=".\include\Poco\ExpireCache.h"
>
@ -3175,6 +3171,18 @@
RelativePath=".\include\Poco\StrategyCollection.h"
>
</File>
<File
RelativePath=".\include\Poco\UniqueExpireCache.h"
>
</File>
<File
RelativePath=".\include\Poco\UniqueExpireLRUCache.h"
>
</File>
<File
RelativePath=".\include\Poco\UniqueExpireStrategy.h"
>
</File>
<File
RelativePath=".\include\Poco\ValidArgs.h"
>
@ -3185,6 +3193,58 @@
>
</Filter>
</Filter>
<Filter
Name="Hashing"
>
<Filter
Name="Header Files"
>
<File
RelativePath=".\include\Poco\Hash.h"
>
</File>
<File
RelativePath=".\include\Poco\HashFunction.h"
>
</File>
<File
RelativePath=".\include\Poco\HashMap.h"
>
</File>
<File
RelativePath=".\include\Poco\HashSet.h"
>
</File>
<File
RelativePath=".\include\Poco\HashStatistic.h"
>
</File>
<File
RelativePath=".\include\Poco\HashTable.h"
>
</File>
<File
RelativePath=".\include\Poco\LinearHashTable.h"
>
</File>
<File
RelativePath=".\include\Poco\SimpleHashTable.h"
>
</File>
</Filter>
<Filter
Name="Source Files"
>
<File
RelativePath=".\src\Hash.cpp"
>
</File>
<File
RelativePath=".\src\HashStatistic.cpp"
>
</File>
</Filter>
</Filter>
</Files>
<Globals>
</Globals>

Просмотреть файл

@ -1,7 +1,7 @@
#
# Makefile
#
# $Id: //poco/1.2/Foundation/Makefile#2 $
# $Id: //poco/1.3/Foundation/Makefile#1 $
#
# Makefile for Poco Foundation
#
@ -24,7 +24,7 @@ objects = ArchiveStrategy ASCIIEncoding AsyncChannel Base64Decoder Base64Encoder
SHA1Engine Semaphore SharedLibrary SimpleFileChannel \
SignalHandler SplitterChannel Stopwatch StreamChannel StreamConverter StreamCopier \
StreamTokenizer String StringTokenizer SynchronizedObject SyslogChannel \
Task TaskManager TaskNotification TeeStream HashStatistic\
Task TaskManager TaskNotification TeeStream Hash HashStatistic \
TemporaryFile TextConverter TextEncoding TextIterator Thread ThreadLocal \
ThreadPool ActiveDispatcher Timer Timespan Timestamp Timezone Token URI \
FileStreamFactory URIStreamFactory URIStreamOpener UTF16Encoding Windows1252Encoding \

Просмотреть файл

@ -1,7 +1,7 @@
//
// ASCIIEncoding.h
//
// $Id: //poco/1.2/Foundation/include/Poco/ASCIIEncoding.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/ASCIIEncoding.h#1 $
//
// Library: Foundation
// Package: Text

Просмотреть файл

@ -1,7 +1,7 @@
//
// AbstractCache.h
//
// $Id: //poco/1.2/Foundation/include/Poco/AbstractCache.h#4 $
// $Id: //poco/1.3/Foundation/include/Poco/AbstractCache.h#1 $
//
// Library: Foundation
// Package: Cache
@ -44,7 +44,7 @@
#include "Poco/ValidArgs.h"
#include "Poco/Mutex.h"
#include "Poco/Exception.h"
#include "Poco/BasicEvent.h"
#include "Poco/FIFOEvent.h"
#include "Poco/EventArgs.h"
#include "Poco/Delegate.h"
#include "Poco/SharedPtr.h"
@ -60,10 +60,10 @@ class AbstractCache
/// An AbstractCache is the interface of all caches.
{
public:
BasicEvent<const KeyValueArgs<TKey, TValue > > Add;
BasicEvent<const TKey> Remove;
BasicEvent<const TKey> Get;
BasicEvent<const EventArgs> Clear;
FIFOEvent<const KeyValueArgs<TKey, TValue > > Add;
FIFOEvent<const TKey> Remove;
FIFOEvent<const TKey> Get;
FIFOEvent<const EventArgs> Clear;
typedef std::map<TKey, SharedPtr<TValue > > DataHolder;
typedef typename DataHolder::iterator Iterator;
@ -98,7 +98,8 @@ public:
/// the remove is ignored.
{
FastMutex::ScopedLock lock(_mutex);
doRemove(key);
Iterator it = _data.find(key);
doRemove(it);
}
bool has(const TKey& key) const
@ -124,10 +125,11 @@ public:
doClear();
}
std::size_t size() const
std::size_t size()
/// Returns the number of cached elements
{
FastMutex::ScopedLock lock(_mutex);
doReplace();
return _data.size();
}
@ -142,10 +144,23 @@ public:
doReplace();
}
std::set<TKey> getAllKeys()
/// Returns a copy of all keys stored in the cache
{
FastMutex::ScopedLock lock(_mutex);
doReplace();
ConstIterator it = _data.begin();
ConstIterator itEnd = _data.end();
std::set<TKey> result;
for (; it != itEnd; ++it)
result.insert(it->first);
return result;
}
protected:
mutable BasicEvent<ValidArgs<TKey> > IsValid;
mutable BasicEvent<KeySet> Replace;
mutable FIFOEvent<ValidArgs<TKey> > IsValid;
mutable FIFOEvent<KeySet> Replace;
void initialize()
/// Sets up event registration.
@ -173,10 +188,8 @@ protected:
/// Adds the key value pair to the cache.
/// If for the key already an entry exists, it will be overwritten.
{
if (doHas(key))
{
doRemove(key);
}
Iterator it = _data.find(key);
doRemove(it);
KeyValueArgs<TKey, TValue> args(key, val);
Add.notify(this, args);
@ -185,12 +198,15 @@ protected:
doReplace();
}
void doRemove(const TKey& key)
void doRemove(Iterator it)
/// Removes an entry from the cache. If the entry is not found
/// the remove is ignored.
{
Remove.notify(this, key);
_data.erase(key);
if (it != _data.end())
{
Remove.notify(this, it->first);
_data.erase(it);
}
}
bool doHas(const TKey& key) const
@ -227,7 +243,7 @@ protected:
if (!args.isValid())
{
doRemove(key);
doRemove(it);
}
else
{
@ -255,7 +271,8 @@ protected:
for (; it != endIt; ++it)
{
doRemove(*it);
Iterator itH = _data.find(*it);
doRemove(itH);
}
}

Просмотреть файл

@ -1,7 +1,7 @@
//
// AbstractDelegate.h
//
// $Id: //poco/1.2/Foundation/include/Poco/AbstractDelegate.h#2 $
// $Id: //poco/1.3/Foundation/include/Poco/AbstractDelegate.h#1 $
//
// Library: Foundation
// Package: Events

Просмотреть файл

@ -1,7 +1,7 @@
//
// AbstractEvent.h
//
// $Id: //poco/1.2/Foundation/include/Poco/AbstractEvent.h#3 $
// $Id: //poco/1.3/Foundation/include/Poco/AbstractEvent.h#1 $
//
// Library: Foundation
// Package: Events
@ -76,12 +76,15 @@ class AbstractEvent
/// ...
/// };
///
/// Throwing the event can be done either by the events notify or notifyAsync method:
/// Throwing the event can be done either by the events notify() or notifyAsync() method:
///
///
/// Alternatively, instead of notify(), operator () can be used.
///
/// void MyData::setAge(int i)
/// {
/// this->_age = i;
/// AgeChanged.notify(this, this->_age);
/// AgeChanged(this, this->_age);
/// }
///
/// Note that notify and notifyAsync do not catch exceptions, i.e. in case a delegate
@ -171,6 +174,11 @@ public:
FastMutex::ScopedLock lock(_mutex);
_strategy.remove(aDelegate);
}
void operator () (const void* pSender, TArgs& args)
{
notify(pSender, args);
}
void notify(const void* pSender, TArgs& args)
/// Sends a notification to all registered delegates. The order is

Просмотреть файл

@ -1,7 +1,7 @@
//
// AbstractObserver.h
//
// $Id: //poco/1.2/Foundation/include/Poco/AbstractObserver.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/AbstractObserver.h#1 $
//
// Library: Foundation
// Package: Notifications

Просмотреть файл

@ -1,7 +1,7 @@
//
// AbstractPriorityDelegate.h
//
// $Id: //poco/1.2/Foundation/include/Poco/AbstractPriorityDelegate.h#2 $
// $Id: //poco/1.3/Foundation/include/Poco/AbstractPriorityDelegate.h#1 $
//
// Library: Foundation
// Package: Events

Просмотреть файл

@ -1,7 +1,7 @@
//
// AbstractStrategy.h
//
// $Id: //poco/1.2/Foundation/include/Poco/AbstractStrategy.h#2 $
// $Id: //poco/1.3/Foundation/include/Poco/AbstractStrategy.h#1 $
//
// Library: Foundation
// Package: Cache

Просмотреть файл

@ -1,7 +1,7 @@
//
// ActiveDispatcher.h
//
// $Id: //poco/1.2/Foundation/include/Poco/ActiveDispatcher.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/ActiveDispatcher.h#1 $
//
// Library: Foundation
// Package: Threading

Просмотреть файл

@ -1,7 +1,7 @@
//
// ActiveMethod.h
//
// $Id: //poco/1.2/Foundation/include/Poco/ActiveMethod.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/ActiveMethod.h#1 $
//
// Library: Foundation
// Package: Threading

Просмотреть файл

@ -1,7 +1,7 @@
//
// ActiveResult.h
//
// $Id: //poco/1.2/Foundation/include/Poco/ActiveResult.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/ActiveResult.h#1 $
//
// Library: Foundation
// Package: Threading
@ -45,6 +45,7 @@
#include "Poco/Event.h"
#include "Poco/RefCountedObject.h"
#include "Poco/Exception.h"
#include <algorithm>
namespace Poco {
@ -60,16 +61,24 @@ class ActiveResultHolder: public RefCountedObject
{
public:
ActiveResultHolder():
_pData(0),
_pExc(0),
_event(false)
/// Creates an ActiveResultHolder.
{
}
ResultType& data()
/// Returns a reference to the actual result.
{
return _data;
poco_check_ptr(_pData);
return *_pData;
}
void data(ResultType* pData)
{
delete _pData;
_pData = pData;
}
void wait()
@ -142,13 +151,14 @@ public:
protected:
~ActiveResultHolder()
{
delete _pData;
delete _pExc;
}
private:
ResultType _data;
Exception* _pExc;
Event _event;
ResultType* _pData;
Exception* _pExc;
Event _event;
};
@ -185,21 +195,28 @@ public:
ActiveResult& operator = (const ActiveResult& result)
/// Assignment operator.
{
if (&result != this)
{
_pHolder->release();
_pHolder = result._pHolder;
_pHolder->duplicate();
}
ActiveResult tmp(result);
swap(tmp);
return *this;
}
const ResultType& data() const
void swap(const ActiveResult& result)
{
using std::swap;
swap(_pHolder, result._pHolder);
}
ResultType& data() const
/// Returns a reference to the result data.
{
return _pHolder->data();
}
void data(ResultType* pValue)
{
_pHolder->data(pValue);
}
void wait()
/// Pauses the caller until the result becomes available.
{

Просмотреть файл

@ -1,7 +1,7 @@
//
// ActiveRunnable.h
//
// $Id: //poco/1.2/Foundation/include/Poco/ActiveRunnable.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/ActiveRunnable.h#1 $
//
// Library: Foundation
// Package: Threading
@ -71,7 +71,7 @@ public:
{
try
{
_result.data() = (_pOwner->*_method)(_arg);
_result.data(new ResultType((_pOwner->*_method)(_arg)));
}
catch (Exception& e)
{

Просмотреть файл

@ -1,7 +1,7 @@
//
// ActiveStarter.h
//
// $Id: //poco/1.2/Foundation/include/Poco/ActiveStarter.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/ActiveStarter.h#1 $
//
// Library: Foundation
// Package: Threading

Просмотреть файл

@ -1,7 +1,7 @@
//
// Activity.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Activity.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/Activity.h#1 $
//
// Library: Foundation
// Package: Threading

Просмотреть файл

@ -1,7 +1,7 @@
//
// Any.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Any.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/Any.h#1 $
//
// Library: Foundation
// Package: Core

Просмотреть файл

@ -1,7 +1,7 @@
//
// ArchiveStrategy.h
//
// $Id: //poco/1.2/Foundation/include/Poco/ArchiveStrategy.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/ArchiveStrategy.h#1 $
//
// Library: Foundation
// Package: Logging

Просмотреть файл

@ -1,7 +1,7 @@
//
// AsyncChannel.h
//
// $Id: //poco/1.2/Foundation/include/Poco/AsyncChannel.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/AsyncChannel.h#1 $
//
// Library: Foundation
// Package: Logging

Просмотреть файл

@ -1,7 +1,7 @@
//
// AutoPtr.h
//
// $Id: //poco/1.2/Foundation/include/Poco/AutoPtr.h#2 $
// $Id: //poco/1.3/Foundation/include/Poco/AutoPtr.h#1 $
//
// Library: Foundation
// Package: Core
@ -111,8 +111,8 @@ public:
{
if (_ptr) _ptr->release();
}
AutoPtr& operator = (C* ptr)
AutoPtr& assign(C* ptr)
{
if (_ptr != ptr)
{
@ -122,7 +122,18 @@ public:
return *this;
}
AutoPtr& operator = (const AutoPtr& ptr)
AutoPtr& assign(C* ptr, bool shared)
{
if (_ptr != ptr)
{
if (_ptr) _ptr->release();
_ptr = ptr;
if (shared && _ptr) _ptr->duplicate();
}
return *this;
}
AutoPtr& assign(const AutoPtr& ptr)
{
if (&ptr != this)
{
@ -133,13 +144,8 @@ public:
return *this;
}
void swap(AutoPtr& ptr)
{
std::swap(_ptr, ptr._ptr);
}
template <class Other>
AutoPtr& operator = (const AutoPtr<Other>& ptr)
AutoPtr& assign(const AutoPtr<Other>& ptr)
{
if (ptr.get() != _ptr)
{
@ -150,8 +156,29 @@ public:
return *this;
}
AutoPtr& operator = (C* ptr)
{
return assign(ptr);
}
AutoPtr& operator = (const AutoPtr& ptr)
{
return assign(ptr);
}
template <class Other>
AutoPtr<Other> cast()
AutoPtr& operator = (const AutoPtr<Other>& ptr)
{
return assign<Other>(ptr);
}
void swap(AutoPtr& ptr)
{
std::swap(_ptr, ptr._ptr);
}
template <class Other>
AutoPtr<Other> cast() const
/// Casts the AutoPtr via a dynamic cast to the given type.
/// Returns an AutoPtr containing NULL if the cast fails.
/// Example: (assume class Sub: public Super)
@ -159,10 +186,8 @@ public:
/// AutoPtr<Sub> sub = super.cast<Sub>();
/// poco_assert (sub.get());
{
Other* pOther = dynamic_cast <Other*>(_ptr);
if (pOther)
pOther->duplicate();
return AutoPtr<Other>(pOther);
Other* pOther = dynamic_cast<Other*>(_ptr);
return AutoPtr<Other>(pOther, true);
}
C* operator -> ()
@ -202,11 +227,11 @@ public:
return _ptr;
}
bool isNull() const
const C* get() const
{
return _ptr == 0;
return _ptr;
}
operator C* ()
{
return _ptr;
@ -216,12 +241,17 @@ public:
{
return _ptr;
}
const C* get() const
bool operator ! () const
{
return _ptr;
return _ptr == 0;
}
bool isNull() const
{
return _ptr == 0;
}
C* duplicate()
{
if (_ptr) _ptr->duplicate();

Просмотреть файл

@ -1,7 +1,7 @@
//
// AutoReleasePool.h
//
// $Id: //poco/1.2/Foundation/include/Poco/AutoReleasePool.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/AutoReleasePool.h#1 $
//
// Library: Foundation
// Package: Core

Просмотреть файл

@ -1,7 +1,7 @@
//
// Base64Decoder.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Base64Decoder.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/Base64Decoder.h#1 $
//
// Library: Foundation
// Package: Streams

Просмотреть файл

@ -1,7 +1,7 @@
//
// Base64Encoder.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Base64Encoder.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/Base64Encoder.h#1 $
//
// Library: Foundation
// Package: Streams

Просмотреть файл

@ -1,7 +1,7 @@
//
// BasicEvent.h
//
// $Id: //poco/1.2/Foundation/include/Poco/BasicEvent.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/BasicEvent.h#1 $
//
// Library: Foundation
// Package: Events

Просмотреть файл

@ -1,7 +1,7 @@
//
// BinaryReader.h
//
// $Id: //poco/1.2/Foundation/include/Poco/BinaryReader.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/BinaryReader.h#1 $
//
// Library: Foundation
// Package: Streams

Просмотреть файл

@ -1,7 +1,7 @@
//
// BinaryWriter.h
//
// $Id: //poco/1.2/Foundation/include/Poco/BinaryWriter.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/BinaryWriter.h#1 $
//
// Library: Foundation
// Package: Streams

Просмотреть файл

@ -1,7 +1,7 @@
//
// Buffer.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Buffer.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/Buffer.h#1 $
//
// Library: Foundation
// Package: Core
@ -41,6 +41,7 @@
#include "Poco/Foundation.h"
#include <cstddef>
namespace Poco {
@ -56,7 +57,7 @@ class Buffer
/// is needed.
{
public:
Buffer(int size):
Buffer(std::size_t size):
_size(size),
_ptr(new T[size])
/// Creates and allocates the Buffer.
@ -69,7 +70,7 @@ public:
delete [] _ptr;
}
int size() const
std::size_t size() const
/// Returns the size of the buffer.
{
return _size;
@ -99,14 +100,14 @@ public:
return _ptr + _size;
}
T& operator [] (int index)
T& operator [] (std::size_t index)
{
poco_assert (index >= 0 && index < _size);
return _ptr[index];
}
const T& operator [] (int index) const
const T& operator [] (std::size_t index) const
{
poco_assert (index >= 0 && index < _size);
@ -118,8 +119,8 @@ private:
Buffer(const Buffer&);
Buffer& operator = (const Buffer&);
int _size;
T* _ptr;
std::size_t _size;
T* _ptr;
};

Просмотреть файл

@ -1,7 +1,7 @@
//
// BufferAllocator.h
//
// $Id: //poco/1.2/Foundation/include/Poco/BufferAllocator.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/BufferAllocator.h#1 $
//
// Library: Foundation
// Package: Streams

Просмотреть файл

@ -1,7 +1,7 @@
//
// BufferedBidirectionalStreamBuf.h
//
// $Id: //poco/1.2/Foundation/include/Poco/BufferedBidirectionalStreamBuf.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/BufferedBidirectionalStreamBuf.h#1 $
//
// Library: Foundation
// Package: Streams

Просмотреть файл

@ -1,7 +1,7 @@
//
// BufferedStreamBuf.h
//
// $Id: //poco/1.2/Foundation/include/Poco/BufferedStreamBuf.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/BufferedStreamBuf.h#1 $
//
// Library: Foundation
// Package: Streams

Просмотреть файл

@ -1,7 +1,7 @@
//
// Bugcheck.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Bugcheck.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/Bugcheck.h#1 $
//
// Library: Foundation
// Package: Core
@ -90,7 +90,8 @@ protected:
// useful macros (these automatically supply line number and file name)
//
#if defined(_DEBUG)
#define poco_assert_dbg(cond) if (!(cond)) Poco::Bugcheck::assertion(#cond, __FILE__, __LINE__); else (void) 0
#define poco_assert_dbg(cond) \
if (!(cond)) Poco::Bugcheck::assertion(#cond, __FILE__, __LINE__); else (void) 0
#else
#define poco_assert_dbg(cond)
#endif

Просмотреть файл

@ -1,7 +1,7 @@
//
// ByteOrder.h
//
// $Id: //poco/1.2/Foundation/include/Poco/ByteOrder.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/ByteOrder.h#1 $
//
// Library: Foundation
// Package: Core

Просмотреть файл

@ -1,7 +1,7 @@
//
// Channel.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Channel.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/Channel.h#1 $
//
// Library: Foundation
// Package: Logging

Просмотреть файл

@ -1,7 +1,7 @@
//
// ClassLibrary.h
//
// $Id: //poco/1.2/Foundation/include/Poco/ClassLibrary.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/ClassLibrary.h#1 $
//
// Library: Foundation
// Package: SharedLibrary

Просмотреть файл

@ -1,7 +1,7 @@
//
// ClassLoader.h
//
// $Id: //poco/1.2/Foundation/include/Poco/ClassLoader.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/ClassLoader.h#1 $
//
// Library: Foundation
// Package: SharedLibrary

Просмотреть файл

@ -1,7 +1,7 @@
//
// CompareFunctions.h
//
// $Id: //poco/1.2/Foundation/include/Poco/CompareFunctions.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/CompareFunctions.h#1 $
//
// Library: Foundation
// Package: Events

Просмотреть файл

@ -1,7 +1,7 @@
//
// Config.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Config.h#2 $
// $Id: //poco/1.3/Foundation/include/Poco/Config.h#1 $
//
// Library: Foundation
// Package: Core

Просмотреть файл

@ -1,7 +1,7 @@
//
// Configurable.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Configurable.h#2 $
// $Id: //poco/1.3/Foundation/include/Poco/Configurable.h#1 $
//
// Library: Foundation
// Package: Logging

Просмотреть файл

@ -1,7 +1,7 @@
//
// ConsoleChannel.h
//
// $Id: //poco/1.2/Foundation/include/Poco/ConsoleChannel.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/ConsoleChannel.h#1 $
//
// Library: Foundation
// Package: Logging

Просмотреть файл

@ -1,7 +1,7 @@
//
// CountingStream.h
//
// $Id: //poco/1.2/Foundation/include/Poco/CountingStream.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/CountingStream.h#1 $
//
// Library: Foundation
// Package: Streams

Просмотреть файл

@ -1,7 +1,7 @@
//
// DateTime.h
//
// $Id: //poco/1.2/Foundation/include/Poco/DateTime.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/DateTime.h#1 $
//
// Library: Foundation
// Package: DateTime

Просмотреть файл

@ -1,7 +1,7 @@
//
// DateTimeFormat.h
//
// $Id: //poco/1.2/Foundation/include/Poco/DateTimeFormat.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/DateTimeFormat.h#1 $
//
// Library: Foundation
// Package: DateTime

Просмотреть файл

@ -1,7 +1,7 @@
//
// DateTimeFormatter.h
//
// $Id: //poco/1.2/Foundation/include/Poco/DateTimeFormatter.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/DateTimeFormatter.h#1 $
//
// Library: Foundation
// Package: DateTime

Просмотреть файл

@ -1,7 +1,7 @@
//
// DateTimeParser.h
//
// $Id: //poco/1.2/Foundation/include/Poco/DateTimeParser.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/DateTimeParser.h#1 $
//
// Library: Foundation
// Package: DateTime

Просмотреть файл

@ -1,7 +1,7 @@
//
// Debugger.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Debugger.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/Debugger.h#1 $
//
// Library: Foundation
// Package: Core

Просмотреть файл

@ -1,7 +1,7 @@
//
// DefaultStrategy.h
//
// $Id: //poco/1.2/Foundation/include/Poco/DefaultStrategy.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/DefaultStrategy.h#1 $
//
// Library: Foundation
// Package: Events

Просмотреть файл

@ -1,7 +1,7 @@
//
// DeflatingStream.h
//
// $Id: //poco/1.2/Foundation/include/Poco/DeflatingStream.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/DeflatingStream.h#1 $
//
// Library: Foundation
// Package: Streams

Просмотреть файл

@ -1,7 +1,7 @@
//
// Delegate.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Delegate.h#3 $
// $Id: //poco/1.3/Foundation/include/Poco/Delegate.h#1 $
//
// Library: Foundation
// Package: Events

Просмотреть файл

@ -1,7 +1,7 @@
//
// DigestEngine.h
//
// $Id: //poco/1.2/Foundation/include/Poco/DigestEngine.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/DigestEngine.h#1 $
//
// Library: Foundation
// Package: Crypt

Просмотреть файл

@ -1,7 +1,7 @@
//
// DigestStream.h
//
// $Id: //poco/1.2/Foundation/include/Poco/DigestStream.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/DigestStream.h#1 $
//
// Library: Foundation
// Package: Crypt

Просмотреть файл

@ -1,7 +1,7 @@
//
// DirectoryIterator.h
//
// $Id: //poco/1.2/Foundation/include/Poco/DirectoryIterator.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/DirectoryIterator.h#1 $
//
// Library: Foundation
// Package: Filesystem
@ -54,6 +54,14 @@ class DirectoryIteratorImpl;
class Foundation_API DirectoryIterator
/// The DirectoryIterator class is used to enumerate
/// all files in a directory.
///
/// DirectoryIterator has some limitations:
/// * only forward iteration (++) is supported
/// * an iterator copied from another one will always
/// * point to the same file as the original iterator,
/// * even is the original iterator has been advanced
/// (all copies of an iterator share their state with
/// the original iterator)
{
public:
DirectoryIterator();

Просмотреть файл

@ -1,7 +1,7 @@
//
// DirectoryIterator_UNIX.h
//
// $Id: //poco/1.2/Foundation/include/Poco/DirectoryIterator_UNIX.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/DirectoryIterator_UNIX.h#1 $
//
// Library: Foundation
// Package: Filesystem

Просмотреть файл

@ -1,7 +1,7 @@
//
// DirectoryIterator_VMS.h
//
// $Id: //poco/1.2/Foundation/include/Poco/DirectoryIterator_VMS.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/DirectoryIterator_VMS.h#1 $
//
// Library: Foundation
// Package: Filesystem

Просмотреть файл

@ -1,7 +1,7 @@
//
// DirectoryIterator_WIN32.h
//
// $Id: //poco/1.2/Foundation/include/Poco/DirectoryIterator_WIN32.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/DirectoryIterator_WIN32.h#1 $
//
// Library: Foundation
// Package: Filesystem

Просмотреть файл

@ -1,7 +1,7 @@
//
// DirectoryIterator_WIN32U.h
//
// $Id: //poco/1.2/Foundation/include/Poco/DirectoryIterator_WIN32U.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/DirectoryIterator_WIN32U.h#1 $
//
// Library: Foundation
// Package: Filesystem

Просмотреть файл

@ -1,7 +1,7 @@
//
// DynamicFactory.h
//
// $Id: //poco/1.2/Foundation/include/Poco/DynamicFactory.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/DynamicFactory.h#1 $
//
// Library: Foundation
// Package: Core

Просмотреть файл

@ -1,7 +1,7 @@
//
// Environment.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Environment.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/Environment.h#1 $
//
// Library: Foundation
// Package: Core
@ -56,6 +56,11 @@ public:
/// with the given name. Throws a NotFoundException
/// if the variable does not exist.
static std::string get(const std::string& name, const std::string& defaultValue);
/// Returns the value of the environment variable
/// with the given name. If the environment variable
/// is undefined, returns defaultValue instead.
static bool has(const std::string& name);
/// Returns true iff an environment variable
/// with the given name is defined.

Просмотреть файл

@ -1,7 +1,7 @@
//
// Environment_UNIX.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Environment_UNIX.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/Environment_UNIX.h#1 $
//
// Library: Foundation
// Package: Core

Просмотреть файл

@ -1,7 +1,7 @@
//
// Environment_VMS.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Environment_VMS.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/Environment_VMS.h#1 $
//
// Library: Foundation
// Package: Core

Просмотреть файл

@ -1,7 +1,7 @@
//
// Environment_WIN32.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Environment_WIN32.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/Environment_WIN32.h#1 $
//
// Library: Foundation
// Package: Core

Просмотреть файл

@ -1,7 +1,7 @@
//
// Environment_WIN32U.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Environment_WIN32U.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/Environment_WIN32U.h#1 $
//
// Library: Foundation
// Package: Core

Просмотреть файл

@ -1,7 +1,7 @@
//
// ErrorHandler.h
//
// $Id: //poco/1.2/Foundation/include/Poco/ErrorHandler.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/ErrorHandler.h#1 $
//
// Library: Foundation
// Package: Threading

Просмотреть файл

@ -1,7 +1,7 @@
//
// Event.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Event.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/Event.h#1 $
//
// Library: Foundation
// Package: Threading

Просмотреть файл

@ -1,7 +1,7 @@
//
// EventArgs.h
//
// $Id: //poco/1.2/Foundation/include/Poco/EventArgs.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/EventArgs.h#1 $
//
// Library: Foundation
// Package: Events

Просмотреть файл

@ -1,7 +1,7 @@
//
// EventLogChannel.h
//
// $Id: //poco/1.2/Foundation/include/Poco/EventLogChannel.h#2 $
// $Id: //poco/1.3/Foundation/include/Poco/EventLogChannel.h#1 $
//
// Library: Foundation
// Package: Logging

Просмотреть файл

@ -1,7 +1,7 @@
//
// Event_POSIX.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Event_POSIX.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/Event_POSIX.h#1 $
//
// Library: Foundation
// Package: Threading

Просмотреть файл

@ -1,7 +1,7 @@
//
// Event_WIN32.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Event_WIN32.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/Event_WIN32.h#1 $
//
// Library: Foundation
// Package: Threading

Просмотреть файл

@ -1,7 +1,7 @@
//
// Exception.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Exception.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/Exception.h#1 $
//
// Library: Foundation
// Package: Core
@ -78,7 +78,9 @@ public:
/// Returns the name of the exception class.
virtual const char* what() const throw();
/// Returns the message text as a C string.
/// Returns a static string describing the exception.
///
/// Same as name(), but for compatibility with std::exception.
const Exception* nested() const;
/// Returns a pointer to the nested exception, or
@ -136,19 +138,19 @@ inline const std::string& Exception::message() const
// are not allowed as template arguments.
//
#define POCO_DECLARE_EXCEPTION(API, CLS, BASE) \
class API CLS: public BASE \
class API CLS: public BASE \
{ \
public: \
CLS(); \
CLS(const std::string& msg); \
CLS(const std::string& msg, const std::string& arg); \
CLS(const std::string& msg, const Poco::Exception& exc); \
CLS(const std::string& msg, const Poco::Exception& exc); \
CLS(const CLS& exc); \
~CLS() throw(); \
CLS& operator = (const CLS& exc); \
const char* name() const throw(); \
const char* className() const throw(); \
Poco::Exception* clone() const; \
Poco::Exception* clone() const; \
void rethrow() const; \
};
@ -163,7 +165,7 @@ inline const std::string& Exception::message() const
CLS::CLS(const std::string& msg, const std::string& arg): BASE(msg, arg) \
{ \
} \
CLS::CLS(const std::string& msg, const Poco::Exception& exc): BASE(msg, exc) \
CLS::CLS(const std::string& msg, const Poco::Exception& exc): BASE(msg, exc) \
{ \
} \
CLS::CLS(const CLS& exc): BASE(exc) \
@ -185,7 +187,7 @@ inline const std::string& Exception::message() const
{ \
return typeid(*this).name(); \
} \
Poco::Exception* CLS::clone() const \
Poco::Exception* CLS::clone() const \
{ \
return new CLS(*this); \
} \

Просмотреть файл

@ -0,0 +1,113 @@
//
// ExpirationDecorator.h
//
// $Id: //poco/1.3/Foundation/include/Poco/ExpirationDecorator.h#1 $
//
// Library: Foundation
// Package: Events
// Module: ExpirationDecorator
//
// Implementation of the ExpirationDecorator template.
//
// Copyright (c) 2006, 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_ExpirationDecorator_INCLUDED
#define Foundation_ExpirationDecorator_INCLUDED
#include "Poco/Timestamp.h"
#include "Poco/Timespan.h"
namespace Poco {
template <typename TArgs>
class ExpirationDecorator
/// ExpirationDecorator adds an expiration method to values so that they can be used
/// with the UniqueExpireCache
{
public:
ExpirationDecorator():
_value(),
_expiresAt()
{
}
ExpirationDecorator(const TArgs& p, const Poco::Timespan::TimeDiff& diffInMs):
/// Creates an element that will expire in diff milliseconds
_value(p),
_expiresAt()
{
_expiresAt += (diffInMs*1000);
}
ExpirationDecorator(const TArgs& p, const Poco::Timespan& timeSpan):
/// Creates an element that will expire after the given timeSpan
_value(p),
_expiresAt()
{
_expiresAt += timeSpan.totalMicroseconds();
}
ExpirationDecorator(const TArgs& p, const Poco::Timestamp& timeStamp):
/// Creates an element that will expire at the given time point
_value(p),
_expiresAt(timeStamp)
{
}
~ExpirationDecorator()
{
}
const Poco::Timestamp& getExpiration() const
{
return _expiresAt;
}
const TArgs& value() const
{
return _value;
}
TArgs& value()
{
return _value;
}
private:
TArgs _value;
Timestamp _expiresAt;
};
} // namespace Poco
#endif

Просмотреть файл

@ -1,7 +1,7 @@
//
// Expire.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Expire.h#2 $
// $Id: //poco/1.3/Foundation/include/Poco/Expire.h#1 $
//
// Library: Foundation
// Package: Events

Просмотреть файл

@ -1,7 +1,7 @@
//
// ExpireCache.h
//
// $Id: //poco/1.2/Foundation/include/Poco/ExpireCache.h#3 $
// $Id: //poco/1.3/Foundation/include/Poco/ExpireCache.h#1 $
//
// Library: Foundation
// Package: Cache

Просмотреть файл

@ -1,7 +1,7 @@
//
// ExpireLRUCache.h
//
// $Id: //poco/1.2/Foundation/include/Poco/ExpireLRUCache.h#4 $
// $Id: //poco/1.3/Foundation/include/Poco/ExpireLRUCache.h#1 $
//
// Library: Foundation
// Package: Cache

Просмотреть файл

@ -1,7 +1,7 @@
//
// ExpireStrategy.h
//
// $Id: //poco/1.2/Foundation/include/Poco/ExpireStrategy.h#2 $
// $Id: //poco/1.3/Foundation/include/Poco/ExpireStrategy.h#1 $
//
// Library: Foundation
// Package: Cache

Просмотреть файл

@ -1,7 +1,7 @@
//
// FIFOEvent.h
//
// $Id: //poco/1.2/Foundation/include/Poco/FIFOEvent.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/FIFOEvent.h#1 $
//
// Library: Foundation
// Package: Events

Просмотреть файл

@ -1,7 +1,7 @@
//
// FIFOStrategy.h
//
// $Id: //poco/1.2/Foundation/include/Poco/FIFOStrategy.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/FIFOStrategy.h#1 $
//
// Library: Foundation
// Package: Events

Просмотреть файл

@ -1,7 +1,7 @@
//
// FPEnvironment.h
//
// $Id: //poco/1.2/Foundation/include/Poco/FPEnvironment.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/FPEnvironment.h#1 $
//
// Library: Foundation
// Package: Core

Просмотреть файл

@ -1,7 +1,7 @@
//
// FPEnvironment_C99.h
//
// $Id: //poco/1.2/Foundation/include/Poco/FPEnvironment_C99.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/FPEnvironment_C99.h#1 $
//
// Library: Foundation
// Package: Core

Просмотреть файл

@ -1,7 +1,7 @@
//
// FPEnvironment_DEC.h
//
// $Id: //poco/1.2/Foundation/include/Poco/FPEnvironment_DEC.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/FPEnvironment_DEC.h#1 $
//
// Library: Foundation
// Package: Core

Просмотреть файл

@ -1,7 +1,7 @@
//
// FPEnvironment_DUMMY.h
//
// $Id: //poco/1.2/Foundation/include/Poco/FPEnvironment_DUMMY.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/FPEnvironment_DUMMY.h#1 $
//
// Library: Foundation
// Package: Core

Просмотреть файл

@ -1,7 +1,7 @@
//
// FPEnvironment_SUN.h
//
// $Id: //poco/1.2/Foundation/include/Poco/FPEnvironment_SUN.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/FPEnvironment_SUN.h#1 $
//
// Library: Foundation
// Package: Core

Просмотреть файл

@ -1,7 +1,7 @@
//
// FPEnvironment_WIN32.h
//
// $Id: //poco/1.2/Foundation/include/Poco/FPEnvironment_WIN32.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/FPEnvironment_WIN32.h#1 $
//
// Library: Foundation
// Package: Core

Просмотреть файл

@ -1,7 +1,7 @@
//
// File.h
//
// $Id: //poco/1.2/Foundation/include/Poco/File.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/File.h#1 $
//
// Library: Foundation
// Package: Filesystem

Просмотреть файл

@ -1,7 +1,7 @@
//
// FileChannel.h
//
// $Id: //poco/1.2/Foundation/include/Poco/FileChannel.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/FileChannel.h#1 $
//
// Library: Foundation
// Package: Logging

Просмотреть файл

@ -1,7 +1,7 @@
//
// FileStreamFactory.h
//
// $Id: //poco/1.2/Foundation/include/Poco/FileStreamFactory.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/FileStreamFactory.h#1 $
//
// Library: Foundation
// Package: URI

Просмотреть файл

@ -1,7 +1,7 @@
//
// File_UNIX.h
//
// $Id: //poco/1.2/Foundation/include/Poco/File_UNIX.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/File_UNIX.h#1 $
//
// Library: Foundation
// Package: Filesystem

Просмотреть файл

@ -1,7 +1,7 @@
//
// File_VMS.h
//
// $Id: //poco/1.2/Foundation/include/Poco/File_VMS.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/File_VMS.h#1 $
//
// Library: Foundation
// Package: Filesystem

Просмотреть файл

@ -1,7 +1,7 @@
//
// File_WIN32.h
//
// $Id: //poco/1.2/Foundation/include/Poco/File_WIN32.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/File_WIN32.h#1 $
//
// Library: Foundation
// Package: Filesystem

Просмотреть файл

@ -1,7 +1,7 @@
//
// File_WIN32U.h
//
// $Id: //poco/1.2/Foundation/include/Poco/File_WIN32U.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/File_WIN32U.h#1 $
//
// Library: Foundation
// Package: Filesystem

Просмотреть файл

@ -1,7 +1,7 @@
//
// Format.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Format.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/Format.h#1 $
//
// Library: Foundation
// Package: Core

Просмотреть файл

@ -1,7 +1,7 @@
//
// Formatter.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Formatter.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/Formatter.h#1 $
//
// Library: Foundation
// Package: Logging

Просмотреть файл

@ -1,7 +1,7 @@
//
// FormattingChannel.h
//
// $Id: //poco/1.2/Foundation/include/Poco/FormattingChannel.h#2 $
// $Id: //poco/1.3/Foundation/include/Poco/FormattingChannel.h#1 $
//
// Library: Foundation
// Package: Logging

Просмотреть файл

@ -1,7 +1,7 @@
//
// Foundation.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Foundation.h#2 $
// $Id: //poco/1.3/Foundation/include/Poco/Foundation.h#1 $
//
// Library: Foundation
// Package: Core
@ -42,6 +42,12 @@
#define Foundation_Foundation_INCLUDED
//
// Include library configuration
//
#include "Poco/Config.h"
//
// Ensure that POCO_DLL is default unless POCO_STATIC is defined
//
@ -74,12 +80,6 @@
#endif
//
// Include library configuration
//
#include "Poco/Config.h"
//
// Include platform-specific definitions
//

Просмотреть файл

@ -1,7 +1,7 @@
//
// Glob.h
//
// $Id: //poco/1.2/Foundation/include/Poco/Glob.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/Glob.h#1 $
//
// Library: Foundation
// Package: Filesystem
@ -55,9 +55,9 @@ class Foundation_API Glob
/// as known from Unix shells.
///
/// In the pattern string, '*' matches any sequence of characters,
/// '?' matches any character, [SET] matches any character in the
/// specified set, [!SET] matches any character not in the specified
/// set.
/// '?' matches any single character, [SET] matches any single character
/// in the specified set, [!SET] matches any character not in the
/// specified set.
///
/// A set is composed of characters or ranges; a range looks like
/// character hyphen character (as in 0-9 or A-Z).

Просмотреть файл

@ -1,7 +1,7 @@
//
// HMACEngine.h
//
// $Id: //poco/1.2/Foundation/include/Poco/HMACEngine.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/HMACEngine.h#1 $
//
// Library: Foundation
// Package: Crypt

Просмотреть файл

@ -0,0 +1,127 @@
//
// Hash.h
//
// $Id: //poco/1.3/Foundation/include/Poco/Hash.h#1 $
//
// Library: Foundation
// Package: Hashing
// Module: Hash
//
// Definition of the Hash class.
//
// Copyright (c) 2006, 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_Hash_INCLUDED
#define Foundation_Hash_INCLUDED
#include "Poco/Foundation.h"
#include <cstddef>
namespace Poco {
template <class T>
struct Hash
/// A generic hash function.
{
std::size_t operator () (T value) const
/// Returns the hash for the given value.
{
return hash(value);
}
};
std::size_t Foundation_API hash(Int8 n);
std::size_t Foundation_API hash(UInt8 n);
std::size_t Foundation_API hash(Int16 n);
std::size_t Foundation_API hash(UInt16 n);
std::size_t Foundation_API hash(Int32 n);
std::size_t Foundation_API hash(UInt32 n);
std::size_t Foundation_API hash(Int64 n);
std::size_t Foundation_API hash(UInt64 n);
std::size_t Foundation_API hash(const std::string& str);
//
// inlines
//
inline std::size_t hash(Int8 n)
{
return static_cast<std::size_t>(n)*2654435761U;
}
inline std::size_t hash(UInt8 n)
{
return static_cast<std::size_t>(n)*2654435761U;
}
inline std::size_t hash(Int16 n)
{
return static_cast<std::size_t>(n)*2654435761U;
}
inline std::size_t hash(UInt16 n)
{
return static_cast<std::size_t>(n)*2654435761U;
}
inline std::size_t hash(Int32 n)
{
return static_cast<std::size_t>(n)*2654435761U;
}
inline std::size_t hash(UInt32 n)
{
return static_cast<std::size_t>(n)*2654435761U;
}
inline std::size_t hash(Int64 n)
{
return static_cast<std::size_t>(n)*2654435761U;
}
inline std::size_t hash(UInt64 n)
{
return static_cast<std::size_t>(n)*2654435761U;
}
} // namespace Poco
#endif // Foundation_Hash_INCLUDED

Просмотреть файл

@ -1,10 +1,10 @@
//
// HashFunction.h
//
// $Id: //poco/1.2/Foundation/include/Poco/HashFunction.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/HashFunction.h#1 $
//
// Library: Foundation
// Package: Core
// Package: Hashing
// Module: HashFunction
//
// Definition of the HashFunction class.
@ -41,37 +41,21 @@
#include "Poco/Foundation.h"
#include "Poco/Hash.h"
namespace Poco {
//@ deprecated
template <class T>
struct HashFunction
/// A generic hash function for numeric values.
/// A generic hash function.
{
static UInt32 hash(T key, UInt32 maxValue)
/// Returns the hash value for the given key
UInt32 operator () (T key, UInt32 maxValue) const
/// Returns the hash value for the given key.
{
return key * 0xf4243 % maxValue;
}
};
template <>
struct HashFunction<std::string>
/// A specialization of HashFunction for strings.
{
static UInt32 hash(const std::string& key, UInt32 maxValue)
{
// hash function taken from XML expat
UInt32 h = 0;
for (int i = 0; i < key.length(); ++i)
{
h = h * 0xf4243 ^ key[i];
}
return h % maxValue;
return ((UInt32) hash(key)) % maxValue;
}
};

Просмотреть файл

@ -0,0 +1,244 @@
//
// HashMap.h
//
// $Id: //poco/1.3/Foundation/include/Poco/HashMap.h#1 $
//
// Library: Foundation
// Package: Hashing
// Module: HashMap
//
// Definition of the HashMap class.
//
// Copyright (c) 2006, 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_HashMap_INCLUDED
#define Foundation_HashMap_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/LinearHashTable.h"
#include "Poco/Exception.h"
#include <utility>
namespace Poco {
template <class Key, class Value>
struct HashMapEntry
/// This class template is used internally by HashMap.
{
Key first;
Value second;
HashMapEntry():
first(),
second()
{
}
HashMapEntry(const Key& key):
first(key),
second()
{
}
HashMapEntry(const Key& key, const Value& value):
first(key),
second(value)
{
}
bool operator == (const HashMapEntry& entry) const
{
return first == entry.first;
}
bool operator != (const HashMapEntry& entry) const
{
return first != entry.first;
}
};
template <class HME, class KeyHashFunc>
struct HashMapEntryHash
/// This class template is used internally by HashMap.
{
std::size_t operator () (const HME& entry) const
{
return _func(entry.first);
}
private:
KeyHashFunc _func;
};
template <class Key, class Mapped, class HashFunc = Hash<Key> >
class HashMap
/// This class implements a map using a LinearHashTable.
///
/// A HashMap can be used just like a std::map.
{
public:
typedef Key KeyType;
typedef Mapped MappedType;
typedef Mapped& Reference;
typedef const Mapped& ConstReference;
typedef Mapped* Pointer;
typedef const Mapped* ConstPointer;
typedef HashMapEntry<Key, Mapped> ValueType;
typedef std::pair<KeyType, MappedType> PairType;
typedef HashMapEntryHash<ValueType, HashFunc> HashType;
typedef LinearHashTable<ValueType, HashType> HashTable;
typedef typename HashTable::Iterator Iterator;
typedef typename HashTable::ConstIterator ConstIterator;
HashMap()
/// Creates an empty HashMap.
{
}
HashMap(std::size_t initialReserve):
_table(initialReserve)
/// Creates the HashMap with room for initialReserve entries.
{
}
HashMap& operator = (const HashMap& map)
/// Assigns another HashMap.
{
HashMap tmp(map);
swap(tmp);
return *this;
}
void swap(HashMap& map)
/// Swaps the HashMap with another one.
{
_table.swap(map._table);
}
ConstIterator begin() const
{
return _table.begin();
}
ConstIterator end() const
{
return _table.end();
}
Iterator begin()
{
return _table.begin();
}
Iterator end()
{
return _table.end();
}
ConstIterator find(const KeyType& key) const
{
ValueType value(key);
return _table.find(value);
}
Iterator find(const KeyType& key)
{
ValueType value(key);
return _table.find(value);
}
std::pair<Iterator, bool> insert(const PairType& pair)
{
ValueType value(pair.first, pair.second);
return _table.insert(value);
}
std::pair<Iterator, bool> insert(const ValueType& value)
{
return _table.insert(value);
}
void erase(Iterator it)
{
_table.erase(it);
}
void erase(const KeyType& key)
{
Iterator it = find(key);
_table.erase(it);
}
void clear()
{
_table.clear();
}
std::size_t size() const
{
return _table.size();
}
bool empty() const
{
return _table.empty();
}
ConstReference operator [] (const KeyType& key) const
{
ConstIterator it = _table.find(key);
if (it != _table.end())
return it->second;
else
throw NotFoundException();
}
Reference operator [] (const KeyType& key)
{
ValueType value(key);
std::pair<Iterator, bool> res = _table.insert(value);
return res.first->second;
}
private:
HashTable _table;
};
} // namespace Poco
#endif // Foundation_HashMap_INCLUDED

Просмотреть файл

@ -0,0 +1,199 @@
//
// HashSet.h
//
// $Id: //poco/1.3/Foundation/include/Poco/HashSet.h#1 $
//
// Library: Foundation
// Package: Hashing
// Module: HashSet
//
// Definition of the HashSet class.
//
// Copyright (c) 2006, 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_HashSet_INCLUDED
#define Foundation_HashSet_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/LinearHashTable.h"
namespace Poco {
template <class Value, class HashFunc = Hash<Value> >
class HashSet
/// This class implements a set using a LinearHashTable.
///
/// A HashSet can be used just like a std::set.
{
public:
typedef Value ValueType;
typedef Value& Reference;
typedef const Value& ConstReference;
typedef Value* Pointer;
typedef const Value* ConstPointer;
typedef HashFunc Hash;
typedef LinearHashTable<ValueType, Hash> HashTable;
typedef typename HashTable::Iterator Iterator;
typedef typename HashTable::ConstIterator ConstIterator;
HashSet()
/// Creates an empty HashSet.
{
}
HashSet(std::size_t initialReserve):
_table(initialReserve)
/// Creates the HashSet, using the given initialReserve.
{
}
HashSet(const HashSet& set):
_table(set._table)
/// Creates the HashSet by copying another one.
{
}
~HashSet()
/// Destroys the HashSet.
{
}
HashSet& operator = (const HashSet& table)
/// Assigns another HashSet.
{
HashSet tmp(table);
swap(tmp);
return *this;
}
void swap(HashSet& set)
/// Swaps the HashSet with another one.
{
_table.swap(set._table);
}
ConstIterator begin() const
/// Returns an iterator pointing to the first entry, if one exists.
{
return _table.begin();
}
ConstIterator end() const
/// Returns an iterator pointing to the end of the table.
{
return _table.end();
}
Iterator begin()
/// Returns an iterator pointing to the first entry, if one exists.
{
return _table.begin();
}
Iterator end()
/// Returns an iterator pointing to the end of the table.
{
return _table.end();
}
ConstIterator find(const ValueType& value) const
/// Finds an entry in the table.
{
return _table.find(value);
}
Iterator find(const ValueType& value)
/// Finds an entry in the table.
{
return _table.find(value);
}
std::size_t count(const ValueType& value) const
/// Returns the number of elements with the given
/// value, with is either 1 or 0.
{
return _table.count(value);
}
std::pair<Iterator, bool> insert(const ValueType& value)
/// Inserts an element into the set.
///
/// If the element already exists in the set,
/// a pair(iterator, false) with iterator pointing to the
/// existing element is returned.
/// Otherwise, the element is inserted an a
/// pair(iterator, true) with iterator
/// pointing to the new element is returned.
{
return _table.insert(value);
}
void erase(Iterator it)
/// Erases the element pointed to by it.
{
_table.erase(it);
}
void erase(const ValueType& value)
/// Erases the element with the given value, if it exists.
{
_table.erase(value);
}
void clear()
/// Erases all elements.
{
_table.clear();
}
std::size_t size() const
/// Returns the number of elements in the table.
{
return _table.size();
}
bool empty() const
/// Returns true iff the table is empty.
{
return _table.empty();
}
private:
HashTable _table;
};
} // namespace Poco
#endif // Foundation_HashSet_INCLUDED

Просмотреть файл

@ -1,10 +1,10 @@
//
// HashStatistic.h
//
// $Id: //poco/1.2/Foundation/include/Poco/HashStatistic.h#1 $
// $Id: //poco/1.3/Foundation/include/Poco/HashStatistic.h#1 $
//
// Library: Foundation
// Package: Core
// Package: Hashing
// Module: HashStatistic
//
// Definition of the HashStatistic class.
@ -47,6 +47,7 @@
namespace Poco {
//@ deprecated
class Foundation_API HashStatistic
/// HashStatistic class bundles statistical information on the current state of a HashTable
{

Просмотреть файл

@ -1,10 +1,10 @@
//
// HashTable.h
//
// $Id: //poco/1.2/Foundation/include/Poco/HashTable.h#2 $
// $Id: //poco/1.3/Foundation/include/Poco/HashTable.h#1 $
//
// Library: Foundation
// Package: Core
// Package: Hashing
// Module: HashTable
//
// Definition of the HashTable class.
@ -52,6 +52,7 @@
namespace Poco {
//@ deprecated
template <class Key, class Value, class KeyHashFunction = HashFunction<Key> >
class HashTable
/// A HashTable stores a key value pair that can be looked up via a hashed key.
@ -146,15 +147,17 @@ public:
return hsh;
}
void insertRaw(const Key& key, UInt32 hsh, const Value& value)
Value& insertRaw(const Key& key, UInt32 hsh, const Value& value)
/// Returns the hash value of the inserted item.
/// Throws an exception if the entry was already inserted
{
if (!_entries[hsh])
_entries[hsh] = new HashEntryMap();
if (!_entries[hsh]->insert(std::make_pair(key, value)).second)
std::pair<typename HashEntryMap::iterator, bool> res(_entries[hsh]->insert(std::make_pair(key, value)));
if (!res.second)
throw InvalidArgumentException("HashTable::insert, key already exists.");
_size++;
return res.first->second;
}
UInt32 update(const Key& key, const Value& value)
@ -196,7 +199,7 @@ public:
UInt32 hash(const Key& key) const
{
return KeyHashFunction::hash(key, _maxCapacity);
return _hash(key, _maxCapacity);
}
const Value& get(const Key& key) const
@ -219,6 +222,32 @@ public:
return it->second;
}
Value& get(const Key& key)
/// Throws an exception if the value does not exist
{
UInt32 hsh = hash(key);
return const_cast<Value&>(getRaw(key, hsh));
}
const Value& operator [] (const Key& key) const
{
return get(key);
}
Value& operator [] (const Key& key)
{
UInt32 hsh = hash(key);
if (!_entries[hsh])
return insertRaw(key, hsh, Value());
ConstIterator it = _entries[hsh]->find(key);
if (it == _entries[hsh]->end())
return insertRaw(key, hsh, Value());
return it->second;
}
const Key& getKeyRaw(const Key& key, UInt32 hsh)
/// Throws an exception if the key does not exist. returns a reference to the internally
/// stored key. Useful when someone does an insert and wants for performance reason only to store
@ -264,7 +293,6 @@ public:
return _entries[hsh] && (_entries[hsh]->end() != _entries[hsh]->find(key));
}
size_t size() const
/// Returns the number of elements already inserted into the HashTable
{
@ -353,6 +381,7 @@ private:
HashTableVector _entries;
size_t _size;
UInt32 _maxCapacity;
KeyHashFunction _hash;
};

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше