Set cmake produced shared libraries numbering to standard scheme (trunk = 12)

Sync latest Foundation changes from 1.4.2
This commit is contained in:
Marian Krivos 2011-09-15 08:31:51 +00:00
parent 54a7860bff
commit eb266f8a57
25 changed files with 270 additions and 292 deletions

View File

@ -6,17 +6,11 @@ include_directories( include ${APACHE_INCLUDE_DIR} ${APRUTIL_INCLUDE_DIR} )
aux_source_directory(src SRCS)
add_library( ${LIBNAME} SHARED ${SRCS} )
set_target_properties( ${LIBNAME}
PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS}
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
set_target_properties( ${LIBNAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAME} )
add_library( ${LIBNAMED} SHARED ${SRCS} )
set_target_properties( ${LIBNAMED}
PROPERTIES COMPILE_FLAGS "${DEBUG_CXX_FLAGS}"
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
set_target_properties( ${LIBNAMED} PROPERTIES COMPILE_FLAGS ${DEBUG_CXX_FLAGS} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAMED} )
if (ENABLE_TESTS)

View File

@ -2,6 +2,8 @@ PROJECT(Poco)
cmake_minimum_required(VERSION 2.8.0)
set(SHARED_LIBRARY_VERSION "12")
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "4")
set(CPACK_PACKAGE_VERSION_PATCH "99")

View File

@ -6,13 +6,13 @@ aux_source_directory(src SRCS)
add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAME}
PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS}
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION "1"
SOVERSION "1")
target_link_libraries( ${LIBNAME} )
add_library( ${LIBNAMED} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAMED}
PROPERTIES COMPILE_FLAGS "${DEBUG_CXX_FLAGS}"
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION "1"
SOVERSION "1")
target_link_libraries( ${LIBNAMED} )

View File

@ -6,17 +6,13 @@ aux_source_directory(src SRCS)
include_directories( include)
add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAME}
PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS}
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
set_target_properties( ${LIBNAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAME} PocoNetSSL PocoNet ssl crypto)
add_library( ${LIBNAMED} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAMED}
PROPERTIES COMPILE_FLAGS "${DEBUG_CXX_FLAGS}"
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAMED} PocoNetSSLd PocoNetd ssl crypto)
install(

View File

@ -8,15 +8,13 @@ include_directories( SQLite/include )
add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAME}
PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS}
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAME} PocoFoundation )
add_library( ${LIBNAMED} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAMED}
PROPERTIES COMPILE_FLAGS "${DEBUG_CXX_FLAGS}"
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAMED} PocoFoundationd )
install(

View File

@ -12,15 +12,13 @@ include_directories( include ${MYSQL_INCLUDE_DIR})
add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAME}
PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS}
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAME} PocoData PocoFoundation ${MYSQL_LIB})
add_library( ${LIBNAMED} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAMED}
PROPERTIES COMPILE_FLAGS "${DEBUG_CXX_FLAGS}"
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAMED} PocoDatad PocoFoundationd ${MYSQL_LIB})
install(

View File

@ -25,15 +25,13 @@ include_directories( include )
add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAME}
PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS}
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAME} PocoData PocoFoundation ${ODBC_LINK_FLAGS})
add_library( ${LIBNAMED} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAMED}
PROPERTIES COMPILE_FLAGS "${DEBUG_CXX_FLAGS}"
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAMED} PocoDatad PocoFoundationd ${ODBC_LINK_FLAGS})
install(

View File

@ -11,15 +11,13 @@ add_definitions(-DSQLITE_THREADSAFE=1 -DSQLITE_DISABLE_LFS -DSQLITE_OMIT_UTF16 -
add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAME}
PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS}
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAME} PocoData PocoFoundation)
add_library( ${LIBNAMED} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAMED}
PROPERTIES COMPILE_FLAGS "${DEBUG_CXX_FLAGS}"
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAMED} PocoDatad PocoFoundationd )
install(

View File

@ -30,8 +30,6 @@ set( BASE_SRCS
src/DigestEngine.cpp
src/DigestStream.cpp
src/DirectoryIterator.cpp
# src/DynamicAny.cpp
# src/DynamicAnyHolder.cpp
src/Environment.cpp
src/ErrorHandler.cpp
src/Event.cpp
@ -195,20 +193,14 @@ else (CMAKE_SYSTEM MATCHES "Windows")
endif(CMAKE_SYSTEM MATCHES "Windows")
add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAME}
PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS}
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
set_target_properties( ${LIBNAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
if (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
set_target_properties( ${LIBNAME} PROPERTIES LINK_FLAGS "-library=stlport4")
endif (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
target_link_libraries( ${LIBNAME} ${SYSLIBS})
add_library( ${LIBNAMED} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAMED}
PROPERTIES COMPILE_FLAGS "${DEBUG_CXX_FLAGS}"
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
set_target_properties( ${LIBNAMED} PROPERTIES COMPILE_FLAGS ${DEBUG_CXX_FLAGS} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
if (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
set_target_properties( ${LIBNAMED} PROPERTIES LINK_FLAGS "-library=stlport4")
endif (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")

View File

@ -157,33 +157,33 @@ public:
/// On such platforms, created() returns
/// the time of the last inode modification.
Timestamp getLastModified() const;
/// Returns the modification date of the file.
void setLastModified(const Timestamp& ts);
/// Sets the modification date of the file.
FileSize getSize() const;
/// Returns the size of the file in bytes.
void setSize(FileSize size);
/// Sets the size of the file in bytes. Can be used
/// to truncate a file.
void setWriteable(bool flag = true);
/// Makes the file writeable (if flag is true), or
/// non-writeable (if flag is false) by setting the
/// file's flags in the filesystem accordingly.
void setReadOnly(bool flag = true);
/// Makes the file non-writeable (if flag is true), or
/// writeable (if flag is false) by setting the
/// file's flags in the filesystem accordingly.
void setExecutable(bool flag = true);
/// Makes the file executable (if flag is true), or
/// non-executable (if flag is false) by setting
/// the file's permission bits accordingly.
Timestamp getLastModified() const;
/// Returns the modification date of the file.
File& setLastModified(const Timestamp& ts);
/// Sets the modification date of the file.
FileSize getSize() const;
/// Returns the size of the file in bytes.
File& setSize(FileSize size);
/// Sets the size of the file in bytes. Can be used
/// to truncate a file.
File& setWriteable(bool flag = true);
/// Makes the file writeable (if flag is true), or
/// non-writeable (if flag is false) by setting the
/// file's flags in the filesystem accordingly.
File& setReadOnly(bool flag = true);
/// Makes the file non-writeable (if flag is true), or
/// writeable (if flag is false) by setting the
/// file's flags in the filesystem accordingly.
File& setExecutable(bool flag = true);
/// Makes the file executable (if flag is true), or
/// non-executable (if flag is false) by setting
/// the file's permission bits accordingly.
///
/// Does nothing on Windows and OpenVMS.

View File

@ -36,8 +36,8 @@
//
#ifndef Foundation_LRUCache_INCLUDED
#define Foundation_LRUCache_INCLUDED
#ifndef Foundation_LRUCache_INCLUDED
#define Foundation_LRUCache_INCLUDED
#include "Poco/AbstractCache.h"
@ -51,13 +51,13 @@ template <
class TKey,
class TValue,
class TMutex = FastMutex,
class TEventMutex = FastMutex
class TEventMutex = FastMutex
>
class LRUCache: public AbstractCache<TKey, TValue, LRUStrategy<TKey, TValue>, TMutex, TEventMutex >
/// An LRUCache implements Least Recently Used caching. The default size for a cache is 1024 entries
class LRUCache: public AbstractCache<TKey, TValue, LRUStrategy<TKey, TValue>, TMutex, TEventMutex>
/// An LRUCache implements Least Recently Used caching. The default size for a cache is 1024 entries.
{
public:
LRUCache(long size = 1024):
LRUCache(long size = 1024):
AbstractCache<TKey, TValue, LRUStrategy<TKey, TValue>, TMutex, TEventMutex>(LRUStrategy<TKey, TValue>(size))
{
}
@ -75,4 +75,4 @@ private:
} // namespace Poco
#endif
#endif // Foundation_LRUCache_INCLUDED

View File

@ -206,21 +206,21 @@ public:
/// (the filename part is empty).
bool isFile() const;
/// Returns true iff the path references a file
/// (the filename part is not empty).
void setNode(const std::string& node);
/// Sets the node name.
/// Setting a non-empty node automatically makes
/// the path an absolute one.
/// Returns true iff the path references a file
/// (the filename part is not empty).
Path& setNode(const std::string& node);
/// Sets the node name.
/// Setting a non-empty node automatically makes
/// the path an absolute one.
const std::string& getNode() const;
/// Returns the node name.
void setDevice(const std::string& device);
/// Sets the device name.
/// Setting a non-empty device automatically makes
/// the path an absolute one.
const std::string& getNode() const;
/// Returns the node name.
Path& setDevice(const std::string& device);
/// Sets the device name.
/// Setting a non-empty device automatically makes
/// the path an absolute one.
const std::string& getDevice() const;
/// Returns the device name.
@ -233,45 +233,45 @@ public:
/// If n == depth(), returns the filename.
const std::string& operator [] (int n) const;
/// Returns the n'th directory in the directory list.
/// If n == depth(), returns the filename.
void pushDirectory(const std::string& dir);
/// Adds a directory to the directory list.
void popDirectory();
/// Returns the n'th directory in the directory list.
/// If n == depth(), returns the filename.
Path& pushDirectory(const std::string& dir);
/// Adds a directory to the directory list.
Path& popDirectory();
/// Removes the last directory from the directory list.
void popFrontDirectory();
Path& popFrontDirectory();
/// Removes the first directory from the directory list.
void setFileName(const std::string& name);
Path& setFileName(const std::string& name);
/// Sets the filename.
const std::string& getFileName() const;
/// Returns the filename.
const std::string& getFileName() const;
/// Returns the filename.
void setBaseName(const std::string& name);
/// Sets the basename part of the filename and
/// does not change the extension.
Path& setBaseName(const std::string& name);
/// Sets the basename part of the filename and
/// does not change the extension.
std::string getBaseName() const;
/// Returns the basename (the filename sans
/// extension) of the path.
/// Returns the basename (the filename sans
/// extension) of the path.
void setExtension(const std::string& extension);
/// Sets the filename extension.
std::string getExtension() const;
Path& setExtension(const std::string& extension);
/// Sets the filename extension.
std::string getExtension() const;
/// Returns the filename extension.
const std::string& version() const;
/// Returns the file version. VMS only.
void clear();
/// Clears all components.
const std::string& version() const;
/// Returns the file version. VMS only.
Path& clear();
/// Clears all components.
Path parent() const;
Path parent() const;
/// Returns a path referring to the path's
/// directory.

View File

@ -47,7 +47,7 @@
namespace Poco {
#if defined(POCO_OS_FAMILY_WINDOWS) && !defined(MINGW32)
#if defined(_MSC_VER)
#define POCO_TYPEWRAPPER_DEFAULTVALUE(T) TypeWrapper<T>::TYPE()
#else
#define POCO_TYPEWRAPPER_DEFAULTVALUE(T) typename TypeWrapper<T>::TYPE()

View File

@ -90,4 +90,4 @@ private:
} // namespace Poco
#endif
#endif // Foundation_UniqueAccessExpireLRUCache_INCLUDED

View File

@ -54,7 +54,7 @@
// Ax are alpha releases
// Bx are beta releases
//
#define POCO_VERSION 0x01040101
#define POCO_VERSION 0x010500D0
#endif // Foundation_Version_INCLUDED

View File

@ -189,43 +189,48 @@ Timestamp File::getLastModified() const
return getLastModifiedImpl();
}
void File::setLastModified(const Timestamp& ts)
File& File::setLastModified(const Timestamp& ts)
{
setLastModifiedImpl(ts);
setLastModifiedImpl(ts);
return *this;
}
File::FileSize File::getSize() const
{
return getSizeImpl();
}
void File::setSize(FileSizeImpl size)
File& File::setSize(FileSizeImpl size)
{
setSizeImpl(size);
setSizeImpl(size);
return *this;
}
void File::setWriteable(bool flag)
File& File::setWriteable(bool flag)
{
setWriteableImpl(flag);
setWriteableImpl(flag);
return *this;
}
void File::setReadOnly(bool flag)
File& File::setReadOnly(bool flag)
{
setWriteableImpl(!flag);
setWriteableImpl(!flag);
return *this;
}
void File::setExecutable(bool flag)
File& File::setExecutable(bool flag)
{
setExecutableImpl(flag);
setExecutableImpl(flag);
return *this;
}
void File::copyTo(const std::string& path) const
{
Path src(getPathImpl());

View File

@ -454,20 +454,22 @@ Path& Path::resolve(const Path& path)
}
void Path::setNode(const std::string& node)
Path& Path::setNode(const std::string& node)
{
_node = node;
_absolute = _absolute || !node.empty();
_node = node;
_absolute = _absolute || !node.empty();
return *this;
}
void Path::setDevice(const std::string& device)
Path& Path::setDevice(const std::string& device)
{
_device = device;
_absolute = _absolute || !device.empty();
_device = device;
_absolute = _absolute || !device.empty();
return *this;
}
const std::string& Path::directory(int n) const
{
poco_assert (0 <= n && n <= _dirs.size());
@ -489,11 +491,11 @@ const std::string& Path::operator [] (int n) const
return _name;
}
void Path::pushDirectory(const std::string& dir)
Path& Path::pushDirectory(const std::string& dir)
{
if (!dir.empty() && dir != ".")
{
if (!dir.empty() && dir != ".")
{
#if defined(POCO_OS_FAMILY_VMS)
if (dir == ".." || dir == "-")
{
@ -511,44 +513,49 @@ void Path::pushDirectory(const std::string& dir)
else if (!_absolute)
_dirs.push_back(dir);
}
else _dirs.push_back(dir);
else _dirs.push_back(dir);
#endif
}
}
return *this;
}
void Path::popDirectory()
Path& Path::popDirectory()
{
poco_assert (!_dirs.empty());
_dirs.pop_back();
poco_assert (!_dirs.empty());
_dirs.pop_back();
return *this;
}
void Path::popFrontDirectory()
Path& Path::popFrontDirectory()
{
poco_assert (!_dirs.empty());
StringVec::iterator it = _dirs.begin();
_dirs.erase(it);
return *this;
}
void Path::setFileName(const std::string& name)
Path& Path::setFileName(const std::string& name)
{
_name = name;
return *this;
}
void Path::setBaseName(const std::string& name)
Path& Path::setBaseName(const std::string& name)
{
std::string ext = getExtension();
_name = name;
std::string ext = getExtension();
_name = name;
if (!ext.empty())
{
_name.append(".");
_name.append(ext);
}
_name.append(".");
_name.append(ext);
}
return *this;
}
@ -562,17 +569,18 @@ std::string Path::getBaseName() const
}
void Path::setExtension(const std::string& extension)
Path& Path::setExtension(const std::string& extension)
{
_name = getBaseName();
if (!extension.empty())
_name = getBaseName();
if (!extension.empty())
{
_name.append(".");
_name.append(extension);
}
_name.append(".");
_name.append(extension);
}
return *this;
}
std::string Path::getExtension() const
{
std::string::size_type pos = _name.rfind('.');
@ -583,14 +591,15 @@ std::string Path::getExtension() const
}
void Path::clear()
Path& Path::clear()
{
_node.clear();
_device.clear();
_node.clear();
_device.clear();
_name.clear();
_dirs.clear();
_version.clear();
_absolute = false;
_dirs.clear();
_version.clear();
_absolute = false;
return *this;
}
@ -688,20 +697,20 @@ void Path::parseUnix(const std::string& path)
if (it != end)
{
if (_dirs.empty())
{
if (!name.empty() && *(name.rbegin()) == ':')
{
_absolute = true;
_device.assign(name, 0, name.length() - 1);
}
else
{
pushDirectory(name);
}
}
else pushDirectory(name);
}
else _name = name;
{
if (!name.empty() && *(name.rbegin()) == ':')
{
_absolute = true;
_device.assign(name, 0, name.length() - 1);
}
else
{
pushDirectory(name);
}
}
else pushDirectory(name);
}
else _name = name;
if (it != end) ++it;
}
}
@ -726,17 +735,17 @@ void Path::parseWindows(const std::string& path)
}
else if (it != end)
{
char d = *it++;
if (it != end && *it == ':') // drive letter
{
if (_absolute || !((d >= 'a' && d <= 'z') || (d >= 'A' && d <= 'Z'))) throw PathSyntaxException(path);
_absolute = true;
_device += d;
++it;
if (it == end || (*it != '\\' && *it != '/')) throw PathSyntaxException(path);
++it;
}
else --it;
char d = *it++;
if (it != end && *it == ':') // drive letter
{
if (_absolute || !((d >= 'a' && d <= 'z') || (d >= 'A' && d <= 'Z'))) throw PathSyntaxException(path);
_absolute = true;
_device += d;
++it;
if (it == end || (*it != '\\' && *it != '/')) throw PathSyntaxException(path);
++it;
}
else --it;
}
while (it != end)
{

View File

@ -44,10 +44,10 @@ namespace Poco {
std::string PathImpl::currentImpl()
{
char buffer[MAX_PATH];
DWORD n = GetCurrentDirectoryA(sizeof(buffer), buffer);
if (n > 0 && n < sizeof(buffer))
{
char buffer[MAX_PATH];
DWORD n = GetCurrentDirectoryA(sizeof(buffer), buffer);
if (n > 0 && n < sizeof(buffer))
{
std::string result(buffer, n);
if (result[n - 1] != '\\')
result.append("\\");
@ -70,18 +70,18 @@ std::string PathImpl::homeImpl()
std::string PathImpl::tempImpl()
{
char buffer[MAX_PATH];
char buffer[MAX_PATH];
DWORD n = GetTempPathA(sizeof(buffer), buffer);
if (n > 0 && n < sizeof(buffer))
{
n = GetLongPathNameA(buffer.begin(), buffer.begin(), static_cast<DWORD>(buffer.size()));
n = GetLongPathNameA(buffer, buffer, static_cast<DWORD>(sizeof buffer));
if (n <= 0) throw SystemException("Cannot get temporary directory long path name");
std::string result(buffer, n);
if (result[n - 1] != '\\')
result.append("\\");
return result;
}
else throw SystemException("Cannot get temporary directory");
result.append("\\");
return result;
}
else throw SystemException("Cannot get temporary directory");
}
@ -93,10 +93,10 @@ std::string PathImpl::nullImpl()
std::string PathImpl::expandImpl(const std::string& path)
{
char buffer[MAX_PATH];
DWORD n = ExpandEnvironmentStringsA(path.c_str(), buffer, sizeof(buffer));
if (n > 0 && n < sizeof(buffer))
return std::string(buffer, n - 1);
char buffer[MAX_PATH];
DWORD n = ExpandEnvironmentStringsA(path.c_str(), buffer, sizeof(buffer));
if (n > 0 && n < sizeof(buffer))
return std::string(buffer, n - 1);
else
return path;
}

View File

@ -23,15 +23,13 @@ endif (NOT POCO_STATIC)
add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAME}
PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS}
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAME} PocoFoundation ${SYSLIBS})
add_library( ${LIBNAMED} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAMED}
PROPERTIES COMPILE_FLAGS "${DEBUG_CXX_FLAGS}"
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAMED} PocoFoundationd ${SYSLIBS})
install(

View File

@ -6,15 +6,13 @@ aux_source_directory(src SRCS)
add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAME}
PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS}
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAME} ssl crypto)
add_library( ${LIBNAMED} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAMED}
PROPERTIES COMPILE_FLAGS "${DEBUG_CXX_FLAGS}"
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAMED} ssl crypto)
install(

View File

@ -45,15 +45,13 @@ endif(CMAKE_SYSTEM MATCHES "Windows")
add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAME}
PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS}
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAME} PocoXML PocoFoundation)
add_library( ${LIBNAMED} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAMED}
PROPERTIES COMPILE_FLAGS "${DEBUG_CXX_FLAGS}"
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAMED} PocoXMLd PocoFoundationd )
install(

View File

@ -7,15 +7,13 @@ aux_source_directory(src SRCS)
add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAME}
PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS}
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAME} PocoNet PocoUtil PocoXML PocoFoundation )
add_library( ${LIBNAMED} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAMED}
PROPERTIES COMPILE_FLAGS "${DEBUG_CXX_FLAGS}"
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAMED} PocoNetd PocoUtild PocoXMLd PocoFoundationd )
install(

View File

@ -8,15 +8,13 @@ add_definitions(-DXML_NS -DXML_DTD -DHAVE_EXPAT_CONFIG_H)
add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAME}
PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS}
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAME} PocoFoundation)
add_library( ${LIBNAMED} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAMED}
PROPERTIES COMPILE_FLAGS "${DEBUG_CXX_FLAGS}"
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAMED} PocoFoundationd)
install(

View File

@ -68,20 +68,20 @@ void XMLWriterTest::testTrivial()
void XMLWriterTest::testTrivialCanonical()
{
std::ostringstream str;
XMLWriter writer(str, XMLWriter::CANONICAL_XML);
writer.startDocument();
writer.startElement("", "", "foo");
writer.endElement("", "", "foo");
writer.endDocument();
std::string xml = str.str();
assert (xml == "<foo></foo>");
std::ostringstream str;
XMLWriter writer(str, XMLWriter::CANONICAL_XML);
writer.startDocument();
writer.startElement("", "", "foo");
writer.endElement("", "", "foo");
writer.endDocument();
std::string xml = str.str();
assert (xml == "<foo></foo>");
}
void XMLWriterTest::testTrivialDecl()
{
std::ostringstream str;
std::ostringstream str;
XMLWriter writer(str, XMLWriter::WRITE_XML_DECLARATION);
writer.startDocument();
writer.startElement("", "", "foo");
@ -237,18 +237,18 @@ void XMLWriterTest::testAttributes()
void XMLWriterTest::testAttributesPretty()
{
std::ostringstream str;
XMLWriter writer(str, XMLWriter::PRETTY_PRINT | XMLWriter::PRETTY_PRINT_ATTRIBUTES);
writer.setNewLine(XMLWriter::NEWLINE_LF);
writer.startDocument();
AttributesImpl attrs;
attrs.addAttribute("", "", "a1", "CDATA", "v1");
attrs.addAttribute("", "", "a2", "CDATA", "v2");
writer.startElement("", "", "el", attrs);
writer.endElement("", "", "el");
writer.endDocument();
std::string xml = str.str();
assert (xml == "<el\n\ta1=\"v1\"\n\ta2=\"v2\"/>\n");
std::ostringstream str;
XMLWriter writer(str, XMLWriter::PRETTY_PRINT | XMLWriter::PRETTY_PRINT_ATTRIBUTES);
writer.setNewLine(XMLWriter::NEWLINE_LF);
writer.startDocument();
AttributesImpl attrs;
attrs.addAttribute("", "", "a1", "CDATA", "v1");
attrs.addAttribute("", "", "a2", "CDATA", "v2");
writer.startElement("", "", "el", attrs);
writer.endElement("", "", "el");
writer.endDocument();
std::string xml = str.str();
assert (xml == "<el\n\ta1=\"v1\"\n\ta2=\"v2\"/>\n");
}
@ -402,17 +402,17 @@ void XMLWriterTest::testRawCharacters()
void XMLWriterTest::testAttributeCharacters()
{
std::ostringstream str;
XMLWriter writer(str, 0);
writer.startDocument();
AttributesImpl attrs;
attrs.addAttribute("", "", "a1", "CDATA", "a b c\n\td");
attrs.addAttribute("", "", "a2", "CDATA", "a b c\r\nd");
writer.startElement("", "", "el", attrs);
writer.endElement("", "", "el");
writer.endDocument();
std::string xml = str.str();
assert (xml == "<el a1=\"a b c&#xA;&#x9;d\" a2=\"a b c&#xD;&#xA;d\"/>");
std::ostringstream str;
XMLWriter writer(str, 0);
writer.startDocument();
AttributesImpl attrs;
attrs.addAttribute("", "", "a1", "CDATA", "a b c\n\td");
attrs.addAttribute("", "", "a2", "CDATA", "a b c\r\nd");
writer.startElement("", "", "el", attrs);
writer.endElement("", "", "el");
writer.endDocument();
std::string xml = str.str();
assert (xml == "<el a1=\"a b c&#xA;&#x9;d\" a2=\"a b c&#xD;&#xA;d\"/>");
}
@ -487,7 +487,7 @@ void XMLWriterTest::testAttributeNamespaces()
writer.endElement("urn:ns", "r", "");
writer.endDocument();
std::string xml = str.str();
assert (xml == "<ns1:r myattr2=\"attrValue2\" ns2:myattr=\"attrValue\" xmlns:ns1=\"urn:ns\" xmlns:ns2=\"urn:other\">data</ns1:r>");
assert (xml == "<ns2:r ns1:myattr=\"attrValue\" ns2:myattr2=\"attrValue2\" xmlns:ns1=\"urn:other\" xmlns:ns2=\"urn:ns\">data</ns2:r>");
}
@ -611,34 +611,34 @@ void XMLWriterTest::tearDown()
CppUnit::Test* XMLWriterTest::suite()
{
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("XMLWriterTest");
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("XMLWriterTest");
CppUnit_addTest(pSuite, XMLWriterTest, testTrivial);
CppUnit_addTest(pSuite, XMLWriterTest, testTrivialCanonical);
CppUnit_addTest(pSuite, XMLWriterTest, testTrivialDecl);
CppUnit_addTest(pSuite, XMLWriterTest, testTrivialDeclPretty);
CppUnit_addTest(pSuite, XMLWriterTest, testTrivialFragment);
CppUnit_addTest(pSuite, XMLWriterTest, testTrivial);
CppUnit_addTest(pSuite, XMLWriterTest, testTrivialCanonical);
CppUnit_addTest(pSuite, XMLWriterTest, testTrivialDecl);
CppUnit_addTest(pSuite, XMLWriterTest, testTrivialDeclPretty);
CppUnit_addTest(pSuite, XMLWriterTest, testTrivialFragment);
CppUnit_addTest(pSuite, XMLWriterTest, testTrivialFragmentPretty);
CppUnit_addTest(pSuite, XMLWriterTest, testDTDPretty);
CppUnit_addTest(pSuite, XMLWriterTest, testDTD);
CppUnit_addTest(pSuite, XMLWriterTest, testDTDNotation);
CppUnit_addTest(pSuite, XMLWriterTest, testDTDEntity);
CppUnit_addTest(pSuite, XMLWriterTest, testAttributes);
CppUnit_addTest(pSuite, XMLWriterTest, testAttributesPretty);
CppUnit_addTest(pSuite, XMLWriterTest, testData);
CppUnit_addTest(pSuite, XMLWriterTest, testEmptyData);
CppUnit_addTest(pSuite, XMLWriterTest, testDataPretty);
CppUnit_addTest(pSuite, XMLWriterTest, testDTDNotation);
CppUnit_addTest(pSuite, XMLWriterTest, testDTDEntity);
CppUnit_addTest(pSuite, XMLWriterTest, testAttributes);
CppUnit_addTest(pSuite, XMLWriterTest, testAttributesPretty);
CppUnit_addTest(pSuite, XMLWriterTest, testData);
CppUnit_addTest(pSuite, XMLWriterTest, testEmptyData);
CppUnit_addTest(pSuite, XMLWriterTest, testDataPretty);
CppUnit_addTest(pSuite, XMLWriterTest, testEmptyDataPretty);
CppUnit_addTest(pSuite, XMLWriterTest, testComment);
CppUnit_addTest(pSuite, XMLWriterTest, testPI);
CppUnit_addTest(pSuite, XMLWriterTest, testCharacters);
CppUnit_addTest(pSuite, XMLWriterTest, testEmptyCharacters);
CppUnit_addTest(pSuite, XMLWriterTest, testCDATA);
CppUnit_addTest(pSuite, XMLWriterTest, testRawCharacters);
CppUnit_addTest(pSuite, XMLWriterTest, testAttributeCharacters);
CppUnit_addTest(pSuite, XMLWriterTest, testDefaultNamespace);
CppUnit_addTest(pSuite, XMLWriterTest, testQNamespaces);
CppUnit_addTest(pSuite, XMLWriterTest, testQNamespacesNested);
CppUnit_addTest(pSuite, XMLWriterTest, testEmptyCharacters);
CppUnit_addTest(pSuite, XMLWriterTest, testCDATA);
CppUnit_addTest(pSuite, XMLWriterTest, testRawCharacters);
CppUnit_addTest(pSuite, XMLWriterTest, testAttributeCharacters);
CppUnit_addTest(pSuite, XMLWriterTest, testDefaultNamespace);
CppUnit_addTest(pSuite, XMLWriterTest, testQNamespaces);
CppUnit_addTest(pSuite, XMLWriterTest, testQNamespacesNested);
CppUnit_addTest(pSuite, XMLWriterTest, testNamespaces);
CppUnit_addTest(pSuite, XMLWriterTest, testAttributeNamespaces);
CppUnit_addTest(pSuite, XMLWriterTest, testNamespacesNested);

View File

@ -6,15 +6,13 @@ aux_source_directory(src SRCS)
add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAME}
PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS}
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAME} PocoUtil PocoXML PocoFoundation)
add_library( ${LIBNAMED} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAMED}
PROPERTIES COMPILE_FLAGS "${DEBUG_CXX_FLAGS}"
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
target_link_libraries( ${LIBNAMED} PocoUtild PocoXMLd PocoFoundationd)
install(