synchronized trunk

This commit is contained in:
Guenter Obiltschnig
2007-08-10 13:57:07 +00:00
parent 2ef3a4f9d2
commit a04bae94d7
63 changed files with 2735 additions and 352 deletions

View File

@@ -1,7 +1,7 @@
//
// Base64Decoder.h
//
// $Id: //poco/Main/Foundation/include/Poco/Base64Decoder.h#2 $
// $Id: //poco/Main/Foundation/include/Poco/Base64Decoder.h#3 $
//
// Library: Foundation
// Package: Streams
@@ -67,6 +67,10 @@ private:
static unsigned char IN_ENCODING[256];
static bool IN_ENCODING_INIT;
private:
Base64DecoderBuf(const Base64DecoderBuf&);
Base64DecoderBuf& operator = (const Base64DecoderBuf&);
};
@@ -83,6 +87,10 @@ public:
protected:
Base64DecoderBuf _buf;
private:
Base64DecoderIOS(const Base64DecoderIOS&);
Base64DecoderIOS& operator = (const Base64DecoderIOS&);
};
@@ -93,6 +101,10 @@ class Foundation_API Base64Decoder: public Base64DecoderIOS, public std::istream
public:
Base64Decoder(std::istream& istr);
~Base64Decoder();
private:
Base64Decoder(const Base64Decoder&);
Base64Decoder& operator = (const Base64Decoder&);
};

View File

@@ -1,7 +1,7 @@
//
// Base64Encoder.h
//
// $Id: //poco/Main/Foundation/include/Poco/Base64Encoder.h#3 $
// $Id: //poco/Main/Foundation/include/Poco/Base64Encoder.h#4 $
//
// Library: Foundation
// Package: Streams
@@ -83,6 +83,9 @@ private:
static const unsigned char OUT_ENCODING[64];
friend class Base64DecoderBuf;
Base64EncoderBuf(const Base64EncoderBuf&);
Base64EncoderBuf& operator = (const Base64EncoderBuf&);
};
@@ -100,6 +103,10 @@ public:
protected:
Base64EncoderBuf _buf;
private:
Base64EncoderIOS(const Base64EncoderIOS&);
Base64EncoderIOS& operator = (const Base64EncoderIOS&);
};
@@ -114,6 +121,10 @@ class Foundation_API Base64Encoder: public Base64EncoderIOS, public std::ostream
public:
Base64Encoder(std::ostream& ostr);
~Base64Encoder();
private:
Base64Encoder(const Base64Encoder&);
Base64Encoder& operator = (const Base64Encoder&);
};

View File

@@ -1,7 +1,7 @@
//
// BufferedBidirectionalStreamBuf.h
//
// $Id: //poco/Main/Foundation/include/Poco/BufferedBidirectionalStreamBuf.h#5 $
// $Id: //poco/Main/Foundation/include/Poco/BufferedBidirectionalStreamBuf.h#6 $
//
// Library: Foundation
// Package: Streams
@@ -178,6 +178,9 @@ private:
char_type* _pReadBuffer;
char_type* _pWriteBuffer;
openmode _mode;
BasicBufferedBidirectionalStreamBuf(const BasicBufferedBidirectionalStreamBuf&);
BasicBufferedBidirectionalStreamBuf& operator = (const BasicBufferedBidirectionalStreamBuf&);
};

View File

@@ -1,7 +1,7 @@
//
// BufferedStreamBuf.h
//
// $Id: //poco/Main/Foundation/include/Poco/BufferedStreamBuf.h#4 $
// $Id: //poco/Main/Foundation/include/Poco/BufferedStreamBuf.h#5 $
//
// Library: Foundation
// Package: Streams
@@ -170,6 +170,9 @@ private:
std::streamsize _bufsize;
char_type* _pBuffer;
openmode _mode;
BasicBufferedStreamBuf(const BasicBufferedStreamBuf&);
BasicBufferedStreamBuf& operator = (const BasicBufferedStreamBuf&);
};

View File

@@ -1,7 +1,7 @@
//
// Channel.h
//
// $Id: //poco/Main/Foundation/include/Poco/Channel.h#2 $
// $Id: //poco/Main/Foundation/include/Poco/Channel.h#3 $
//
// Library: Foundation
// Package: Logging
@@ -87,6 +87,10 @@ public:
protected:
virtual ~Channel();
private:
Channel(const Channel&);
Channel& operator = (const Channel&);
};

View File

@@ -1,7 +1,7 @@
//
// DynamicAny.h
//
// $Id: //poco/Main/Foundation/include/Poco/DynamicAny.h#9 $
// $Id: //poco/Main/Foundation/include/Poco/DynamicAny.h#10 $
//
// Library: Foundation
// Package: Core
@@ -64,7 +64,7 @@ class Foundation_API DynamicAny
/// String truncation is allowed -- it is possible to convert between string and character when string length is
/// greater than 1. An empty string gets converted to the char '\0', a non-empty string is truncated to the first character.
///
/// Bolean conversion are performed as follows:
/// Boolean conversion is performed as follows:
///
/// A string value "false" (not case sensitive) or "0" can be converted to a boolean value false, any other string
/// not being false by the above criteria evaluates to true (e.g: "hi" -> true).
@@ -180,7 +180,7 @@ public:
}
template <typename T>
bool operator == (const T& other)
bool operator == (const T& other) const
/// Equality operator
{
T value;
@@ -188,7 +188,7 @@ public:
return value == other;
}
bool operator == (const char* other)
bool operator == (const char* other) const
/// Equality operator
{
std::string value;
@@ -197,7 +197,7 @@ public:
}
template <typename T>
bool operator != (const T& other)
bool operator != (const T& other) const
/// Inequality operator
{
T value;
@@ -205,7 +205,7 @@ public:
return value != other;
}
bool operator != (const char* other)
bool operator != (const char* other) const
/// Inequality operator
{
std::string value;
@@ -213,14 +213,63 @@ public:
return value != other;
}
const std::type_info& type() const;
bool isArray() const;
/// Returns true if DynamicAny represents a vector
bool isStruct() const;
/// Returns true if DynamicAny represents a struct
DynamicAny& operator[](std::vector<DynamicAny>::size_type n);
/// Index operator, only use on DynamicAnys where isArray
/// returns true! In all other cases a BadCastException is thrown!
const DynamicAny& operator[](std::vector<DynamicAny>::size_type n) const;
/// const Index operator, only use on DynamicAnys where isArray
/// returns true! In all other cases a BadCastException is thrown!
DynamicAny& operator[](const std::string& name);
/// Index operator by name, only use on DynamicAnys where isStruct
/// returns true! In all other cases a BadCastException is thrown!
const DynamicAny& operator[](const std::string& name) const;
/// Index operator by name, only use on DynamicAnys where isStruct
/// returns true! In all other cases a BadCastException is thrown!
const std::type_info& type() const;
/// Returns the type information of the stored content.
static DynamicAny parse(const std::string& val);
/// Parses the string which must be in JSON format
static std::string toString(const DynamicAny& any);
/// Converts the DynamicAny to a string in JSON format. Note that toString will return
/// a different result than any.convert<std::string>()!
private:
static DynamicAny parse(const std::string& val, std::string::size_type& offset);
/// Parses the string which must be in JSON format
static DynamicAny parseObject(const std::string& val, std::string::size_type& pos);
static DynamicAny parseArray(const std::string& val, std::string::size_type& pos);
static std::string parseString(const std::string& val, std::string::size_type& pos);
static void skipWhiteSpace(const std::string& val, std::string::size_type& pos);
private:
DynamicAnyHolder* _pHolder;
};
inline bool DynamicAny::isArray() const
{
return _pHolder->isArray();
}
inline bool DynamicAny::isStruct() const
{
return _pHolder->isStruct();
}
} // namespace Poco

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,378 @@
//
// DynamicStruct.h
//
// $Id: //poco/Main/Foundation/include/Poco/DynamicStruct.h#9 $
//
// Library: Foundation
// Package: Core
// Module: DynamicStruct
//
// Definition of the DynamicStruct class.
//
// Copyright (c) 2007, 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_DynamicStruct_INCLUDED
#define Foundation_DynamicStruct_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/DynamicAny.h"
#include "Poco/DynamicAnyHolder.h"
#include <map>
#include <set>
namespace Poco {
class Foundation_API DynamicStruct
/// DynamicStruct allows to define a named collection of DynamicAnys
{
public:
typedef std::map<std::string, DynamicAny> Data;
typedef Data::iterator Iterator;
typedef Data::const_iterator ConstIterator;
DynamicStruct();
/// Creates an empty DynamicStruct
DynamicStruct(const Data &val);
/// Creates the DynamicStruct from the given value.
virtual ~DynamicStruct();
/// Destroys the DynamicStruct.
DynamicAny& operator[](const std::string& name);
/// Returns the DynamicAny with the given name, creates an entry if not found.
const DynamicAny& operator[](const std::string& name) const;
/// Returns the DynamicAny with the given name, throws a
/// NotFoundException if the data member is not found.
bool contains(const std::string& name) const;
/// Returns true if the DynamicStruct contains a member with the given
/// name
Iterator find(const std::string& name);
/// Returns an iterator, pointing to the <name,DynamicAny> pair containing
/// the element, or it returns end() if the member was not found
ConstIterator find(const std::string& name) const;
/// Returns a const iterator, pointing to the <name,DynamicAny> pair containing
/// the element, or it returns end() if the member was not found
Iterator end();
/// Returns the end iterator for the DynamicStruct
ConstIterator end() const;
/// Returns the end const iterator for the DynamicStruct
Iterator begin();
/// Returns the begin iterator for the DynamicStruct
ConstIterator begin() const;
/// Returns the begin const iterator for the DynamicStruct
std::pair<DynamicStruct::Iterator, bool> insert(const std::string& key, const DynamicAny& value);
/// Inserts a <name, DynamicAny> pair into the DynamicStruct,
/// returns a pair containing the iterator and a boolean which
/// indicates success or not (is true, when insert succeeded, false,
/// when already another element was present, in this case Iterator
/// points to that other element)
std::pair<DynamicStruct::Iterator, bool> insert(const DynamicStruct::Data::value_type& aPair);
/// Inserts a <name, DynamicAny> pair into the DynamicStruct,
/// returns a pair containing the iterator and a boolean which
/// indicates success or not (is true, when insert succeeded, false,
/// when already another element was present, in this case Iterator
/// points to that other element)
DynamicStruct::Data::size_type erase(const std::string& key);
/// Erases the element if found, returns number of elements deleted
void erase(DynamicStruct::Iterator it);
/// Erases the element at the given position
bool empty() const;
/// Returns true if the DynamicStruct doesn't contain any members
DynamicStruct::Data::size_type size() const;
/// Returns the number of members the DynamicStruct contains
std::set<std::string> members() const;
/// Returns a sorted collection containing all member names
private:
Data _data;
};
inline DynamicAny& DynamicStruct::operator[](const std::string& name)
{
return _data.operator [](name);
}
inline bool DynamicStruct::contains(const std::string& name) const
{
return find(name) != end();
}
inline DynamicStruct::Iterator DynamicStruct::find(const std::string& name)
{
return _data.find(name);
}
inline DynamicStruct::ConstIterator DynamicStruct::find(const std::string& name) const
{
return _data.find(name);
}
inline DynamicStruct::Iterator DynamicStruct::end()
{
return _data.end();
}
inline DynamicStruct::ConstIterator DynamicStruct::end() const
{
return _data.end();
}
inline DynamicStruct::Iterator DynamicStruct::begin()
{
return _data.begin();
}
inline DynamicStruct::ConstIterator DynamicStruct::begin() const
{
return _data.begin();
}
inline std::pair<DynamicStruct::Iterator, bool> DynamicStruct::insert(const std::string& key, const DynamicAny& value)
{
return insert(std::make_pair(key, value));
}
inline std::pair<DynamicStruct::Iterator, bool> DynamicStruct::insert(const DynamicStruct::Data::value_type& aPair)
{
return _data.insert(aPair);
}
inline DynamicStruct::Data::size_type DynamicStruct::erase(const std::string& key)
{
return _data.erase(key);
}
inline void DynamicStruct::erase(DynamicStruct::Iterator it)
{
_data.erase(it);
}
inline bool DynamicStruct::empty() const
{
return _data.empty();
}
inline DynamicStruct::Data::size_type DynamicStruct::size() const
{
return _data.size();
}
template <>
class DynamicAnyHolderImpl<DynamicStruct >: public DynamicAnyHolder
{
public:
DynamicAnyHolderImpl(const DynamicStruct& val): _val(val)
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(DynamicStruct);
}
void convert(Int8& val) const
{
throw BadCastException("Cannot cast DynamicStruct type to Int8");
}
void convert(Int16& val) const
{
throw BadCastException("Cannot cast DynamicStruct type to Int16");
}
void convert(Int32& val) const
{
throw BadCastException("Cannot cast DynamicStruct type to Int32");
}
void convert(Int64& val) const
{
throw BadCastException("Cannot cast DynamicStruct type to Int64");
}
void convert(UInt8& val) const
{
throw BadCastException("Cannot cast DynamicStruct type to UInt8");
}
void convert(UInt16& val) const
{
throw BadCastException("Cannot cast DynamicStruct type to UInt16");
}
void convert(UInt32& val) const
{
throw BadCastException("Cannot cast DynamicStruct type to UInt32");
}
void convert(UInt64& val) const
{
throw BadCastException("Cannot cast DynamicStruct type to UInt64");
}
void convert(bool& val) const
{
throw BadCastException("Cannot cast DynamicStruct type to bool");
}
void convert(float& val) const
{
throw BadCastException("Cannot cast DynamicStruct type to float");
}
void convert(double& val) const
{
throw BadCastException("Cannot cast DynamicStruct type to double");
}
void convert(char& val) const
{
throw BadCastException("Cannot cast DynamicStruct type to char");
}
void convert(std::string& val) const
{
// Serialize in JSON format: equals an object
// JSON format definition: { string ':' value } string:value pair n-times, sep. by ','
val.append("{ ");
DynamicStruct::ConstIterator it = _val.begin();
DynamicStruct::ConstIterator itEnd = _val.end();
if (!_val.empty())
{
DynamicAny key(it->first);
appendJSONString(val, key);
val.append(" : ");
appendJSONString(val, it->second);
++it;
}
for (; it != itEnd; ++it)
{
val.append(", ");
DynamicAny key(it->first);
appendJSONString(val, key);
val.append(" : ");
appendJSONString(val, it->second);
}
val.append(" }");
}
void convert(Poco::DateTime&) const
{
throw BadCastException("DynamicStruct -> Poco::DateTime");
}
void convert(Poco::LocalDateTime&) const
{
throw BadCastException("DynamicStruct -> Poco::LocalDateTime");
}
void convert(Poco::Timestamp&) const
{
throw BadCastException("DynamicStruct -> Poco::Timestamp");
}
DynamicAnyHolder* clone() const
{
return new DynamicAnyHolderImpl(_val);
}
const DynamicStruct& value() const
{
return _val;
}
bool isArray() const
{
return false;
}
bool isStruct() const
{
return true;
}
DynamicAny& operator[](const std::string& name)
{
return _val.operator[](name);
}
const DynamicAny& operator[](const std::string& name) const
{
return _val.operator[](name);
}
private:
DynamicStruct _val;
};
} // namespace Poco
#endif // Foundation_DynamicStruct_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// Glob.h
//
// $Id: //poco/Main/Foundation/include/Poco/Glob.h#3 $
// $Id: //poco/Main/Foundation/include/Poco/Glob.h#4 $
//
// Library: Foundation
// Package: Filesystem
@@ -73,9 +73,10 @@ public:
enum Options
/// Flags that modify the matching behavior.
{
GLOB_DEFAULT = 0x00, /// default behavior
GLOB_DOT_SPECIAL = 0x01, /// '*' and '?' do not match '.' at beginning of subject
GLOB_DIRS_ONLY = 0x80 /// only glob for directories (for internal use only)
GLOB_DEFAULT = 0x00, /// default behavior
GLOB_DOT_SPECIAL = 0x01, /// '*' and '?' do not match '.' at beginning of subject
GLOB_FOLLOW_SYMLINKS = 0x02, /// follow symbolic links
GLOB_DIRS_ONLY = 0x80 /// only glob for directories (for internal use only)
};
Glob(const std::string& pattern, int options = 0);
@@ -141,7 +142,8 @@ protected:
bool matchAfterAsterisk(std::string::const_iterator itp, const std::string::const_iterator& endp, std::string::const_iterator its, const std::string::const_iterator& ends);
bool matchSet(std::string::const_iterator& itp, const std::string::const_iterator& endp, char c);
static void collect(const Path& pathPattern, const Path& base, const Path& current, const std::string& pattern, std::set<std::string>& files, int options);
static bool isDirectory(const Path& path, bool followSymlink);
private:
std::string _pattern;
int _options;

View File

@@ -1,7 +1,7 @@
//
// HMACEngine.h
//
// $Id: //poco/Main/Foundation/include/Poco/HMACEngine.h#3 $
// $Id: //poco/Main/Foundation/include/Poco/HMACEngine.h#4 $
//
// Library: Foundation
// Package: Crypt
@@ -153,6 +153,8 @@ protected:
private:
HMACEngine();
HMACEngine(const HMACEngine&);
HMACEngine& operator = (const HMACEngine&);
Engine _engine;
char* _ipad;

View File

@@ -1,7 +1,7 @@
//
// LinearHashTable.h
//
// $Id: //poco/Main/Foundation/include/Poco/LinearHashTable.h#11 $
// $Id: //poco/Main/Foundation/include/Poco/LinearHashTable.h#13 $
//
// Library: Foundation
// Package: Hashing
@@ -86,40 +86,38 @@ public:
typedef HashFunc Hash;
typedef std::vector<Value> Bucket;
typedef std::vector<Bucket> BucketVec;
template <class VecIt, class BuckIt>
class BasicConstIterator;
template <class VecIt, class BuckIt>
class BasicIterator
typedef typename Bucket::iterator BucketIterator;
typedef typename BucketVec::iterator BucketVecIterator;
class ConstIterator
{
public:
BasicIterator()
ConstIterator()
{
}
BasicIterator(const VecIt& vecIt, const VecIt& endIt, const BuckIt& buckIt):
ConstIterator(const BucketVecIterator& vecIt, const BucketVecIterator& endIt, const BucketIterator& buckIt):
_vecIt(vecIt),
_endIt(endIt),
_buckIt(buckIt)
{
}
BasicIterator(const BasicIterator& it):
ConstIterator(const ConstIterator& it):
_vecIt(it._vecIt),
_endIt(it._endIt),
_buckIt(it._buckIt)
{
}
BasicIterator& operator = (const BasicIterator& it)
ConstIterator& operator = (const ConstIterator& it)
{
BasicIterator tmp(it);
ConstIterator tmp(it);
swap(tmp);
return *this;
}
void swap(BasicIterator& it)
void swap(ConstIterator& it)
{
using std::swap;
swap(_vecIt, it._vecIt);
@@ -127,169 +125,119 @@ public:
swap(_buckIt, it._buckIt);
}
bool operator == (const BasicIterator& it) const
bool operator == (const ConstIterator& it) const
{
return _vecIt == it._vecIt && (_vecIt == _endIt || _buckIt == it._buckIt);
}
bool operator != (const BasicIterator& it) const
bool operator != (const ConstIterator& it) const
{
return _vecIt != it._vecIt || (_vecIt != _endIt && _buckIt != it._buckIt);
}
typename Bucket::value_type& operator * ()
const typename Bucket::value_type& operator * () const
{
return *_buckIt;
}
const typename Bucket::value_type* operator -> () const
{
return &*_buckIt;
}
ConstIterator& operator ++ () // prefix
{
if (_vecIt != _endIt)
{
++_buckIt;
while (_vecIt != _endIt && _buckIt == _vecIt->end())
{
++_vecIt;
if (_vecIt != _endIt) _buckIt = _vecIt->begin();
}
}
return *this;
}
ConstIterator operator ++ (int) // postfix
{
ConstIterator tmp(*this);
++*this;
return tmp;
}
protected:
BucketVecIterator _vecIt;
BucketVecIterator _endIt;
BucketIterator _buckIt;
friend class LinearHashTable;
};
class Iterator: public ConstIterator
{
public:
Iterator()
{
}
Iterator(const BucketVecIterator& vecIt, const BucketVecIterator& endIt, const BucketIterator& buckIt):
ConstIterator(vecIt, endIt, buckIt)
{
}
Iterator(const Iterator& it):
ConstIterator(it)
{
}
Iterator& operator = (const Iterator& it)
{
Iterator tmp(it);
swap(tmp);
return *this;
}
void swap(Iterator& it)
{
ConstIterator::swap(it);
}
typename Bucket::value_type& operator * ()
{
return *this->_buckIt;
}
const typename Bucket::value_type& operator * () const
{
return *_buckIt;
return *this->_buckIt;
}
typename Bucket::value_type* operator -> ()
{
return &*_buckIt;
return &*this->_buckIt;
}
const typename Bucket::value_type* operator -> () const
{
return &*_buckIt;
return &*this->_buckIt;
}
BasicIterator& operator ++ () // prefix
Iterator& operator ++ () // prefix
{
if (_vecIt != _endIt)
{
++_buckIt;
while (_vecIt != _endIt && _buckIt == _vecIt->end())
{
++_vecIt;
if (_vecIt != _endIt) _buckIt = _vecIt->begin();
}
}
ConstIterator::operator ++ ();
return *this;
}
BasicIterator operator ++ (int) // postfix
Iterator operator ++ (int) // postfix
{
BasicIterator tmp(*this);
Iterator tmp(*this);
++*this;
return tmp;
}
private:
VecIt _vecIt;
VecIt _endIt;
BuckIt _buckIt;
friend class LinearHashTable;
template <class, class> friend class BasicConstIterator;
};
typedef BasicIterator<typename BucketVec::iterator, typename Bucket::iterator> Iterator;
template <class VecIt, class BuckIt>
class BasicConstIterator
{
public:
BasicConstIterator()
{
}
BasicConstIterator(const VecIt& vecIt, const VecIt& endIt, const BuckIt& buckIt):
_vecIt(vecIt),
_endIt(endIt),
_buckIt(buckIt)
{
}
BasicConstIterator(const BasicConstIterator& it):
_vecIt(it._vecIt),
_endIt(it._endIt),
_buckIt(it._buckIt)
{
}
BasicConstIterator(const Iterator& it):
_vecIt(it._vecIt),
_endIt(it._endIt),
_buckIt(it._buckIt)
{
}
BasicConstIterator& operator = (const BasicConstIterator& it)
{
BasicConstIterator tmp(it);
swap(tmp);
return *this;
}
BasicConstIterator& operator = (const Iterator& it)
{
BasicConstIterator tmp(it);
swap(tmp);
return *this;
}
void swap(BasicConstIterator& it)
{
using std::swap;
swap(_vecIt, it._vecIt);
swap(_endIt, it._endIt);
swap(_buckIt, it._buckIt);
}
bool operator == (const BasicConstIterator& it) const
{
return _vecIt == it._vecIt && (_vecIt == _endIt || _buckIt == it._buckIt);
}
bool operator != (const BasicConstIterator& it) const
{
return _vecIt != it._vecIt || (_vecIt != _endIt && _buckIt != it._buckIt);
}
const typename Bucket::value_type& operator * () const
{
return *_buckIt;
}
const typename Bucket::value_type* operator -> () const
{
return &*_buckIt;
}
BasicConstIterator& operator ++ () // prefix
{
if (_vecIt != _endIt)
{
++_buckIt;
while (_vecIt != _endIt && _buckIt == _vecIt->end())
{
++_vecIt;
if (_vecIt != _endIt) _buckIt = _vecIt->begin();
}
}
return *this;
}
BasicConstIterator operator ++ (int) // postfix
{
BasicConstIterator tmp(*this);
++*this;
return tmp;
}
private:
VecIt _vecIt;
VecIt _endIt;
BuckIt _buckIt;
friend class LinearHashTable;
};
typedef BasicConstIterator<typename BucketVec::const_iterator, typename Bucket::const_iterator> ConstIterator;
LinearHashTable(std::size_t initialReserve = 64):
_split(0),
@@ -336,8 +284,8 @@ public:
ConstIterator begin() const
/// Returns an iterator pointing to the first entry, if one exists.
{
typename BucketVec::const_iterator it = _buckets.begin();
typename BucketVec::const_iterator end = _buckets.end();
BucketVecIterator it(_buckets.begin());
BucketVecIterator end(_buckets.end());
while (it != end && it->empty())
{
++it;
@@ -357,8 +305,8 @@ public:
Iterator begin()
/// Returns an iterator pointing to the first entry, if one exists.
{
typename BucketVec::iterator it = _buckets.begin();
typename BucketVec::iterator end = _buckets.end();
BucketVecIterator it(_buckets.begin());
BucketVecIterator end(_buckets.end());
while (it != end && it->empty())
{
++it;
@@ -379,8 +327,8 @@ public:
/// Finds an entry in the table.
{
std::size_t addr = bucketAddress(value);
typename BucketVec::const_iterator it = _buckets.begin() + addr;
typename Bucket::const_iterator buckIt = std::find(it->begin(), it->end(), value);
BucketVecIterator it(_buckets.begin() + addr);
BucketIterator buckIt(std::find(it->begin(), it->end(), value));
if (buckIt != it->end())
return ConstIterator(it, _buckets.end(), buckIt);
else
@@ -391,8 +339,8 @@ public:
/// Finds an entry in the table.
{
std::size_t addr = bucketAddress(value);
typename BucketVec::iterator it = _buckets.begin() + addr;
typename Bucket::iterator buckIt = std::find(it->begin(), it->end(), value);
BucketVecIterator it(_buckets.begin() + addr);
BucketIterator buckIt(std::find(it->begin(), it->end(), value));
if (buckIt != it->end())
return Iterator(it, _buckets.end(), buckIt);
else
@@ -418,8 +366,8 @@ public:
{
split();
std::size_t addr = bucketAddress(value);
typename BucketVec::iterator it = _buckets.begin() + addr;
typename Bucket::iterator buckIt = std::find(it->begin(), it->end(), value);
BucketVecIterator it(_buckets.begin() + addr);
BucketIterator buckIt(std::find(it->begin(), it->end(), value));
if (buckIt == it->end())
{
buckIt = it->insert(buckIt, value);
@@ -491,7 +439,7 @@ protected:
_buckets.push_back(tmp);
_buckets[_split].swap(tmp);
++_split;
for (typename Bucket::iterator it = tmp.begin(); it != tmp.end(); ++it)
for (BucketIterator it = tmp.begin(); it != tmp.end(); ++it)
{
using std::swap;
std::size_t addr = bucketAddress(*it);
@@ -511,7 +459,7 @@ protected:
Bucket tmp;
tmp.swap(_buckets.back());
_buckets.pop_back();
for (typename Bucket::iterator it = tmp.begin(); it != tmp.end(); ++it)
for (BucketIterator it = tmp.begin(); it != tmp.end(); ++it)
{
using std::swap;
std::size_t addr = bucketAddress(*it);
@@ -528,7 +476,9 @@ protected:
}
private:
BucketVec _buckets;
// Evil hack: _buckets must be mutable because both ConstIterator and Iterator hold
// ordinary iterator's (not const_iterator's).
mutable BucketVec _buckets;
std::size_t _split;
std::size_t _front;
std::size_t _size;

View File

@@ -1,7 +1,7 @@
//
// MD2Engine.h
//
// $Id: //poco/Main/Foundation/include/Poco/MD2Engine.h#2 $
// $Id: //poco/Main/Foundation/include/Poco/MD2Engine.h#3 $
//
// Library: Foundation
// Package: Crypt
@@ -100,6 +100,9 @@ private:
Context _context;
DigestEngine::Digest _digest;
MD2Engine(const MD2Engine&);
MD2Engine& operator = (const MD2Engine&);
};

View File

@@ -1,7 +1,7 @@
//
// MD4Engine.h
//
// $Id: //poco/Main/Foundation/include/Poco/MD4Engine.h#2 $
// $Id: //poco/Main/Foundation/include/Poco/MD4Engine.h#3 $
//
// Library: Foundation
// Package: Crypt
@@ -105,6 +105,9 @@ private:
Context _context;
DigestEngine::Digest _digest;
MD4Engine(const MD4Engine&);
MD4Engine& operator = (const MD4Engine&);
};

View File

@@ -1,7 +1,7 @@
//
// MD5Engine.h
//
// $Id: //poco/Main/Foundation/include/Poco/MD5Engine.h#2 $
// $Id: //poco/Main/Foundation/include/Poco/MD5Engine.h#3 $
//
// Library: Foundation
// Package: Crypt
@@ -105,6 +105,9 @@ private:
Context _context;
DigestEngine::Digest _digest;
MD5Engine(const MD5Engine&);
MD5Engine& operator = (const MD5Engine&);
};

View File

@@ -1,7 +1,7 @@
//
// Process_WIN32.h
//
// $Id: //poco/Main/Foundation/include/Poco/Process_WIN32.h#3 $
// $Id: //poco/Main/Foundation/include/Poco/Process_WIN32.h#4 $
//
// Library: Foundation
// Package: Processes
@@ -64,6 +64,9 @@ public:
private:
HANDLE _hProcess;
UInt32 _pid;
ProcessHandleImpl(const ProcessHandleImpl&);
ProcessHandleImpl& operator = (const ProcessHandleImpl&);
};

View File

@@ -1,7 +1,7 @@
//
// Process_WIN32U.h
//
// $Id: //poco/Main/Foundation/include/Poco/Process_WIN32U.h#3 $
// $Id: //poco/Main/Foundation/include/Poco/Process_WIN32U.h#4 $
//
// Library: Foundation
// Package: Processes
@@ -64,6 +64,9 @@ public:
private:
HANDLE _hProcess;
UInt32 _pid;
ProcessHandleImpl(const ProcessHandleImpl&);
ProcessHandleImpl& operator = (const ProcessHandleImpl&);
};

View File

@@ -1,7 +1,7 @@
//
// SHA1Engine.h
//
// $Id: //poco/Main/Foundation/include/Poco/SHA1Engine.h#2 $
// $Id: //poco/Main/Foundation/include/Poco/SHA1Engine.h#3 $
//
// Library: Foundation
// Package: Crypt
@@ -91,6 +91,9 @@ private:
Context _context;
DigestEngine::Digest _digest;
SHA1Engine(const SHA1Engine&);
SHA1Engine& operator = (const SHA1Engine&);
};

View File

@@ -1,7 +1,7 @@
//
// SharedMemory.h
//
// $Id: //poco/Main/Foundation/include/Poco/SharedMemory.h#5 $
// $Id: //poco/Main/Foundation/include/Poco/SharedMemory.h#6 $
//
// Library: Foundation
// Package: Processes
@@ -71,7 +71,7 @@ public:
/// Default constructor creates an unmapped SharedMemory object.
/// No clients can connect to an unmapped SharedMemory object.
SharedMemory(const std::string& name, std::size_t size, AccessMode mode, const void* addrHint = 0);
SharedMemory(const std::string& name, std::size_t size, AccessMode mode, const void* addrHint = 0, bool server = true);
/// Creates or connects to a shared memory object with the given name.
///
/// For maximum portability, name should be a valid Unix filename and not
@@ -81,6 +81,10 @@ public:
/// start address of the shared memory area. Whether the hint
/// is actually honored is, however, up to the system. Windows platform
/// will generally ignore the hint.
///
/// If server is set to false, the shared memory region will be unlinked
/// by calling shm_unlink (on POSIX platforms) when the SharedMemory object is destroyed.
/// The server parameter is ignored on Windows platforms.
SharedMemory(const File& file, AccessMode mode, const void* addrHint = 0);
/// Maps the entire contents of file into a shared memory segment.

View File

@@ -1,7 +1,7 @@
//
// SharedMemoryImpl.h
//
// $Id: //poco/Main/Foundation/include/Poco/SharedMemory_DUMMY.h#4 $
// $Id: //poco/Main/Foundation/include/Poco/SharedMemory_DUMMY.h#5 $
//
// Library: Foundation
// Package: Processes
@@ -53,7 +53,7 @@ class Foundation_API SharedMemoryImpl: public RefCountedObject
/// that do not have shared memory support.
{
public:
SharedMemoryImpl(const std::string& id, std::size_t size, SharedMemory::AccessMode mode, const void* addr);
SharedMemoryImpl(const std::string& id, std::size_t size, SharedMemory::AccessMode mode, const void* addr, bool server);
/// Creates or connects to a shared memory object with the given name.
///
/// For maximum portability, name should be a valid Unix filename and not

View File

@@ -1,7 +1,7 @@
//
// SharedMemoryImpl.h
//
// $Id: //poco/Main/Foundation/include/Poco/SharedMemory_POSIX.h#5 $
// $Id: //poco/Main/Foundation/include/Poco/SharedMemory_POSIX.h#6 $
//
// Library: Foundation
// Package: Processes
@@ -52,7 +52,7 @@ class Foundation_API SharedMemoryImpl: public RefCountedObject
/// Shared memory implementation for POSIX platforms.
{
public:
SharedMemoryImpl(const std::string& name, std::size_t size, SharedMemory::AccessMode mode, const void* addrHint);
SharedMemoryImpl(const std::string& name, std::size_t size, SharedMemory::AccessMode mode, const void* addrHint, bool server);
/// Creates or connects to a shared memory object with the given name.
///
/// For maximum portability, name should be a valid Unix filename and not
@@ -62,6 +62,9 @@ public:
/// start address of the shared memory area. Whether the hint
/// is actually honored is, however, up to the system. Windows platform
/// will generally ignore the hint.
///
/// If server is set to false, the shared memory region will be unlinked
/// by calling shm_unlink when the SharedMemory object is destroyed.
SharedMemoryImpl(const Poco::File& file, SharedMemory::AccessMode mode, const void* addrHint);
/// Maps the entire contents of file into a shared memory segment.
@@ -101,6 +104,7 @@ private:
SharedMemory::AccessMode _access;
std::string _name;
bool _fileMapped;
bool _server;
};

View File

@@ -1,7 +1,7 @@
//
// SharedMemoryImpl.h
//
// $Id: //poco/Main/Foundation/include/Poco/SharedMemory_WIN32.h#4 $
// $Id: //poco/Main/Foundation/include/Poco/SharedMemory_WIN32.h#5 $
//
// Library: Foundation
// Package: Processes
@@ -52,7 +52,7 @@ class Foundation_API SharedMemoryImpl: public RefCountedObject
/// Shared memory implementation for Windows platforms.
{
public:
SharedMemoryImpl(const std::string& name, std::size_t size, SharedMemory::AccessMode mode, const void* addrHint);
SharedMemoryImpl(const std::string& name, std::size_t size, SharedMemory::AccessMode mode, const void* addrHint, bool server);
/// Creates or connects to a shared memory object with the given name.
///
/// For maximum portability, name should be a valid Unix filename and not

View File

@@ -49,7 +49,7 @@ namespace Poco {
class Foundation_API Stopwatch
/// A simple facility to measure time intervals
/// with (theoretical) microsecond resolution.
/// with microsecond resolution.
{
public:
Stopwatch();

View File

@@ -1,7 +1,7 @@
//
// String.h
//
// $Id: //poco/Main/Foundation/include/Poco/String.h#7 $
// $Id: //poco/Main/Foundation/include/Poco/String.h#8 $
//
// Library: Foundation
// Package: Core
@@ -202,8 +202,8 @@ int icompare(
It end1 = str.begin() + pos + n;
while (it1 != end1 && it2 != end2)
{
typename S::value_type c1 = std::tolower(*it1);
typename S::value_type c2 = std::tolower(*it2);
typename S::value_type c1(std::tolower(*it1));
typename S::value_type c2(std::tolower(*it2));
if (c1 < c2)
return -1;
else if (c1 > c2)
@@ -294,8 +294,8 @@ int icompare(
typename S::const_iterator end = str.begin() + pos + n;
while (it != end && *ptr)
{
typename S::value_type c1 = std::tolower(*it);
typename S::value_type c2 = std::tolower(*ptr);
typename S::value_type c1(std::tolower(*it));
typename S::value_type c2(std::tolower(*ptr));
if (c1 < c2)
return -1;
else if (c1 > c2)

View File

@@ -1,7 +1,7 @@
//
// Thread_WIN32.h
//
// $Id: //poco/Main/Foundation/include/Poco/Thread_WIN32.h#4 $
// $Id: //poco/Main/Foundation/include/Poco/Thread_WIN32.h#5 $
//
// Library: Foundation
// Package: Threading
@@ -101,7 +101,7 @@ inline int ThreadImpl::getPriorityImpl() const
inline void ThreadImpl::sleepImpl(long milliseconds)
{
Sleep(milliseconds);
Sleep(DWORD(milliseconds));
}

View File

@@ -1,7 +1,7 @@
//
// Timer.h
//
// $Id: //poco/Main/Foundation/include/Poco/Timer.h#2 $
// $Id: //poco/Main/Foundation/include/Poco/Timer.h#3 $
//
// Library: Foundation
// Package: Threading
@@ -138,6 +138,9 @@ private:
Event _done;
AbstractTimerCallback* _pCallback;
mutable FastMutex _mutex;
Timer(const Timer&);
Timer& operator = (const Timer&);
};

View File

@@ -1,7 +1,7 @@
//
// UnufferedStreamBuf.h
//
// $Id: //poco/Main/Foundation/include/Poco/UnbufferedStreamBuf.h#3 $
// $Id: //poco/Main/Foundation/include/Poco/UnbufferedStreamBuf.h#4 $
//
// Library: Foundation
// Package: Streams
@@ -169,13 +169,16 @@ private:
return char_traits::eof();
}
virtual int_type writeToDevice(char_type c)
virtual int_type writeToDevice(char_type)
{
return char_traits::eof();
}
int_type _pb;
bool _ispb;
BasicUnbufferedStreamBuf(const BasicUnbufferedStreamBuf&);
BasicUnbufferedStreamBuf& operator = (const BasicUnbufferedStreamBuf&);
};