Could you please explain some of the benefits of encoding the version number
into the namespace name?

I'm worried that this is going to cause me some of the same problems that
having the version name encoded into the library causes.  I know that
several integrators have complained about that on this list multiple times,
and that many of the developers, myself included, are building the library
to the name libxerces.xxx manually to avoid these problems.  I'm worried
that this is just placing a xerces internal implementation detail into my
software, and I can't figure out what the extra value is.  Certainly I
recognize that namespaces offer some value (tho very limited to be certain),
and with ACE adding XML support, I could see many ACE users needing
namespace support in order to avoid name collisions between ACE and xerces,
but I don't understand why encoding the version into my client software is a
good idea?

Thanks
Brad


-----Original Message-----
From: Tinny Ng [mailto:tng-xml@;ca.ibm.com]
Sent: Friday, November 01, 2002 6:58 PM
To: [EMAIL PROTECTED]
Subject: Proposal Review: Using C++ Namespace


Hi everyone,

Based on many users' request, I've looked into the work of implementing C++
namespace to Xerces-C++.

I've reviewed the design in ICU, and also read suggestions from some old
threads (e.g. http://marc.theaimsgroup.com/?t=98019090000001&r=1&w=2, and
http://marc.theaimsgroup.com/?t=97119438300003&r=1&w=2), here is what I am
proposing:

1. Define the following macro in XercesDefs.hpp:

// -------------------------------------------------------------------------
--
// Define namespace symbols if the compiler supports it.
// -------------------------------------------------------------------------
--
#if defined(XERCES_HAS_CPP_NAMESPACE)
    #define XERCES_CPP_NAMESPACE_BEGIN    namespace XERCES_CPP_NAMESPACE {
    #define XERCES_CPP_NAMESPACE_END    }
    #define XERCES_CPP_NAMESPACE_USE    using namespace
XERCES_CPP_NAMESPACE;
    #define XERCES_CPP_NAMESPACE_QUALIFIER    XERCES_CPP_NAMESPACE::

    namespace XERCES_CPP_NAMESPACE { }
    namespace xercesc = XERCES_CPP_NAMESPACE;
    XERCES_CPP_NAMESPACE_USE
#else
    #define XERCES_CPP_NAMESPACE_BEGIN
    #define XERCES_CPP_NAMESPACE_END
    #define XERCES_CPP_NAMESPACE_USE
    #define XERCES_CPP_NAMESPACE_QUALIFIER
#endif

2. The XERCES_HAS_CPP_NAMESPACE is defined in each Compiler Definition file,
e.g. xercesc/util/Compilers/GCCDefs.hpp

// -------------------------------------------------------------------------
--
// Indicate that we support C++ namespace
// Do not define it if the compile cannot handle C++ namespace
// -------------------------------------------------------------------------
--
//  #define XERCES_HAS_CPP_NAMESPACE

3.  And XERCES_CPP_NAMESPACE is defined in XercesVersion.hpp
    #define XERCES_PRODUCT    xercesc
    #define XERCES_CPP_NAMESPACE
INVK_CAT3_RAW_NUMERIC_SEP_UNDERSCORE(XERCES_PRODUCT,XERCES_VERSION_MAJOR,XER
CES_VERSION_MINOR)

where the INVK_CAT3... is an intermediate macro which will eventually create
the namespace name "xercesc_2_1"

4. Then in each Xerces-C++ file (both .hpp and .cpp), add
    #define XERCES_CPP_NAMESPACE_BEGIN
at the beginning and
     #define XERCES_CPP_NAMESPACE_END
at the end



Note:
1.  "using namespace xercesc_2_1;" is coded in XercesDefs.hpp if
XERCES_HAS_CPP_NAMESPACE is defined.  So users are not required to modify
their application to pick up this support, unless they use forward
declaration which then need to be properly scoped.
2.  The version number is included in the namespace name.   This is to allow
co-existence of different Xerces-C++ releases on the same system.   Such
idea is borrowed from ICU which seems working well.
3.  And the distributed binary packages will then be built with C++
Namespace, wherever applicable


Any comment?

Thanks!

Tinny


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to