latest changes from main repository

This commit is contained in:
Guenter Obiltschnig
2007-04-27 13:25:16 +00:00
parent 5caf218376
commit 4d80e24d44
28 changed files with 244 additions and 165 deletions

View File

@@ -1,7 +1,7 @@
//
// ClassLibrary.h
//
// $Id: //poco/Main/Foundation/include/Poco/ClassLibrary.h#3 $
// $Id: //poco/Main/Foundation/include/Poco/ClassLibrary.h#4 $
//
// Library: Foundation
// Package: SharedLibrary
@@ -63,6 +63,16 @@ extern "C"
}
//
// additional support for named manifests
//
#define POCO_DECLARE_NAMED_MANIFEST(name) \
extern "C" \
{ \
void POCO_LIBRARY_API POCO_JOIN(pocoBuildManifest, name)(Poco::ManifestBase* pManifest); \
}
//
// Macros to automatically implement pocoBuildManifest
//
@@ -74,8 +84,8 @@ extern "C"
// ...
// POCO_END_MANIFEST
//
#define POCO_BEGIN_MANIFEST(base) \
bool pocoBuildManifest(Poco::ManifestBase* pManifest_) \
#define POCO_BEGIN_MANIFEST_IMPL(fnName, base) \
bool fnName(Poco::ManifestBase* pManifest_) \
{ \
typedef base _Base; \
typedef Poco::Manifest<_Base> _Manifest; \
@@ -86,6 +96,14 @@ extern "C"
Poco::Manifest<_Base>* pManifest = static_cast<_Manifest*>(pManifest_);
#define POCO_BEGIN_MANIFEST(base) \
POCO_BEGIN_MANIFEST_IMPL(pocoBuildManifest, base)
#define POCO_BEGIN_NAMED_MANIFEST(name, base) \
POCO_BEGIN_MANIFEST_IMPL(POCO_JOIN(pocoBuildManifest, name), base)
#define POCO_END_MANIFEST \
return true; \
} \

View File

@@ -1,7 +1,7 @@
//
// ClassLoader.h
//
// $Id: //poco/Main/Foundation/include/Poco/ClassLoader.h#2 $
// $Id: //poco/Main/Foundation/include/Poco/ClassLoader.h#3 $
//
// Library: Foundation
// Package: SharedLibrary
@@ -62,6 +62,15 @@ class ClassLoader
/// The Manifest for a shared library can be easily built
/// with the help of the macros in the header file
/// "Foundation/ClassLibrary.h".
///
/// Starting with POCO release 1.3, a class library can
/// export multiple manifests. In addition to the default
/// (unnamed) manifest, multiple named manifests can
/// be exported, each having a different base class.
///
/// There is one important restriction: one instance of
/// ClassLoader can only load one manifest from a class
/// library.
{
public:
typedef AbstractMetaObject<Base> Meta;
@@ -152,9 +161,9 @@ public:
}
}
void loadLibrary(const std::string& path)
/// Loads a library from the given path. Does nothing
/// if the library is already loaded.
void loadLibrary(const std::string& path, const std::string& manifest)
/// Loads a library from the given path, using the given manifest.
/// Does nothing if the library is already loaded.
/// Throws a LibraryLoadException if the library
/// cannot be loaded or does not have a Manifest.
/// If the library exports a function named "pocoInitializeLibrary",
@@ -174,20 +183,22 @@ public:
li.refCount = 1;
try
{
std::string pocoBuildManifestSymbol("pocoBuildManifest");
pocoBuildManifestSymbol.append(manifest);
if (li.pLibrary->hasSymbol("pocoInitializeLibrary"))
{
InitializeLibraryFunc initializeLibrary = (InitializeLibraryFunc) li.pLibrary->getSymbol("pocoInitializeLibrary");
initializeLibrary();
}
if (li.pLibrary->hasSymbol("pocoBuildManifest"))
if (li.pLibrary->hasSymbol(pocoBuildManifestSymbol))
{
BuildManifestFunc buildManifest = (BuildManifestFunc) li.pLibrary->getSymbol("pocoBuildManifest");
BuildManifestFunc buildManifest = (BuildManifestFunc) li.pLibrary->getSymbol(pocoBuildManifestSymbol);
if (buildManifest(const_cast<Manif*>(li.pManifest)))
_map[path] = li;
else
throw LibraryLoadException(std::string("Manifest class mismatch in ") + path);
throw LibraryLoadException(std::string("Manifest class mismatch in ") + path, manifest);
}
else throw LibraryLoadException(std::string("No manifest in ") + path);
else throw LibraryLoadException(std::string("No manifest in ") + path, manifest);
}
catch (...)
{
@@ -202,6 +213,22 @@ public:
}
}
void loadLibrary(const std::string& path)
/// Loads a library from the given path. Does nothing
/// if the library is already loaded.
/// Throws a LibraryLoadException if the library
/// cannot be loaded or does not have a Manifest.
/// If the library exports a function named "pocoInitializeLibrary",
/// this function is executed.
/// If called multiple times for the same library,
/// the number of calls to unloadLibrary() must be the same
/// for the library to become unloaded.
///
/// Equivalent to loadLibrary(path, "").
{
loadLibrary(path, "");
}
void unloadLibrary(const std::string& path)
/// Unloads the given library.
/// Be extremely cautious when unloading shared libraries.

View File

@@ -1,7 +1,7 @@
//
// DynamicAny.h
//
// $Id: //poco/Main/Foundation/include/Poco/DynamicAny.h#6 $
// $Id: //poco/Main/Foundation/include/Poco/DynamicAny.h#8 $
//
// Library: Foundation
// Package: Core
@@ -175,17 +175,34 @@ public:
bool operator == (const T& other)
/// Equality operator
{
T result;
_pHolder->convert(result);
return result == other;
T value;
_pHolder->convert(value);
return value == other;
}
bool operator == (const char* other)
/// Equality operator
{
std::string result;
_pHolder->convert(result);
return result == other;
std::string value;
_pHolder->convert(value);
return value == other;
}
template <typename T>
bool operator != (const T& other)
/// Inequality operator
{
T value;
_pHolder->convert(value);
return value != other;
}
bool operator != (const char* other)
/// Inequality operator
{
std::string value;
_pHolder->convert(value);
return value != other;
}
const std::type_info& type() const;

View File

@@ -1,7 +1,7 @@
//
// DynamicAnyHolder.h
//
// $Id: //poco/Main/Foundation/include/Poco/DynamicAnyHolder.h#6 $
// $Id: //poco/Main/Foundation/include/Poco/DynamicAnyHolder.h#7 $
//
// Library: Foundation
// Package: Core

View File

@@ -1,7 +1,7 @@
//
// Foundation.h
//
// $Id: //poco/Main/Foundation/include/Poco/Foundation.h#7 $
// $Id: //poco/Main/Foundation/include/Poco/Foundation.h#8 $
//
// Library: Foundation
// Package: Core
@@ -102,8 +102,8 @@
// is that macro expansion of macro arguments does not
// occur in POCO_DO_JOIN2 but does in POCO_DO_JOIN.
//
#define POCO_JOIN(X, Y) POCO_DO_JOIN( X, Y )
#define POCO_DO_JOIN(X, Y) POCO_DO_JOIN2(X,Y)
#define POCO_JOIN(X, Y) POCO_DO_JOIN(X, Y)
#define POCO_DO_JOIN(X, Y) POCO_DO_JOIN2(X, Y)
#define POCO_DO_JOIN2(X, Y) X##Y

View File

@@ -1,7 +1,7 @@
//
// NamedTuple.h
//
// $Id: //poco/Main/Foundation/include/Poco/NamedTuple.h#6 $
// $Id: //poco/Main/Foundation/include/Poco/NamedTuple.h#1 $
//
// Library: Foundation
// Package: Core
@@ -9,7 +9,7 @@
//
// Definition of the NamedTuple class.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization

View File

@@ -1,7 +1,7 @@
//
// Platform_WIN32.h
//
// $Id: //poco/Main/Foundation/include/Poco/Platform_WIN32.h#3 $
// $Id: //poco/Main/Foundation/include/Poco/Platform_WIN32.h#4 $
//
// Library: Foundation
// Package: Core
@@ -69,9 +69,6 @@
#if defined(UNICODE) && !defined(POCO_WIN32_UTF8)
#define POCO_WIN32_UTF8
#endif
#if defined(POCO_WIN32_UTF8) && !defined(UNICODE)
#define UNICODE
#endif
// Turn off some annoying warnings

View File

@@ -1,7 +1,7 @@
//
// RegularExpression.h
//
// $Id: //poco/Main/Foundation/include/Poco/RegularExpression.h#4 $
// $Id: //poco/Main/Foundation/include/Poco/RegularExpression.h#5 $
//
// Library: Foundation
// Package: RegExp
@@ -77,9 +77,9 @@ public:
/// some can be passed only to matching functions, and some can be used
/// everywhere.
///
/// * Options marked [ctor] can be passed to the constructor.
/// * Options marked [match] can be passed to match, extract, split and subst.
/// * Options marked [subst] can be passed to subst.
/// * Options marked [ctor] can be passed to the constructor.
/// * Options marked [match] can be passed to match, extract, split and subst.
/// * Options marked [subst] can be passed to subst.
///
/// See the PCRE documentation for more information.
{