Blame Iex/IexNamespace.h

Packit 8dc392
///////////////////////////////////////////////////////////////////////////
Packit 8dc392
//
Packit 8dc392
// Copyright (c) 2012, Industrial Light & Magic, a division of Lucas
Packit 8dc392
// Digital Ltd. LLC
Packit 8dc392
// 
Packit 8dc392
// All rights reserved.
Packit 8dc392
// 
Packit 8dc392
// Redistribution and use in source and binary forms, with or without
Packit 8dc392
// modification, are permitted provided that the following conditions are
Packit 8dc392
// met:
Packit 8dc392
// *       Redistributions of source code must retain the above copyright
Packit 8dc392
// notice, this list of conditions and the following disclaimer.
Packit 8dc392
// *       Redistributions in binary form must reproduce the above
Packit 8dc392
// copyright notice, this list of conditions and the following disclaimer
Packit 8dc392
// in the documentation and/or other materials provided with the
Packit 8dc392
// distribution.
Packit 8dc392
// *       Neither the name of Industrial Light & Magic nor the names of
Packit 8dc392
// its contributors may be used to endorse or promote products derived
Packit 8dc392
// from this software without specific prior written permission. 
Packit 8dc392
// 
Packit 8dc392
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit 8dc392
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit 8dc392
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Packit 8dc392
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Packit 8dc392
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
Packit 8dc392
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Packit 8dc392
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Packit 8dc392
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Packit 8dc392
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit 8dc392
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit 8dc392
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 8dc392
//
Packit 8dc392
///////////////////////////////////////////////////////////////////////////
Packit 8dc392
Packit 8dc392
#ifndef INCLUDED_IEXNAMESPACE_H
Packit 8dc392
#define INCLUDED_IEXNAMESPACE_H
Packit 8dc392
Packit 8dc392
//
Packit 8dc392
// The purpose of this file is to make it possible to specify an
Packit 8dc392
// IEX_INTERNAL_NAMESPACE as a preprocessor definition and have all of the
Packit 8dc392
// Iex symbols defined within that namespace rather than the standard
Packit 8dc392
// Iex namespace.  Those symbols are made available to client code through
Packit 8dc392
// the IEX_NAMESPACE in addition to the IEX_INTERNAL_NAMESPACE.
Packit 8dc392
//
Packit 8dc392
// To ensure source code compatibility, the IEX_NAMESPACE defaults to Iex
Packit 8dc392
// and then "using namespace IEX_INTERNAL_NAMESPACE;" brings all of the
Packit 8dc392
// declarations from the IEX_INTERNAL_NAMESPACE into the IEX_NAMESPACE.  This
Packit 8dc392
// means that client code can continue to use syntax like Iex::BaseExc, but
Packit 8dc392
// at link time it will resolve to a mangled symbol based on the
Packit 8dc392
// IEX_INTERNAL_NAMESPACE.
Packit 8dc392
//
Packit 8dc392
// As an example, if one needed to build against a newer version of Iex and
Packit 8dc392
// have it run alongside an older version in the same application, it is now
Packit 8dc392
// possible to use an internal namespace to prevent collisions between the
Packit 8dc392
// older versions of Iex symbols and the newer ones.  To do this, the
Packit 8dc392
// following could be defined at build time:
Packit 8dc392
//
Packit 8dc392
// IEX_INTERNAL_NAMESPACE = Iex_v2
Packit 8dc392
//
Packit 8dc392
// This means that declarations inside Iex headers look like this (after the
Packit 8dc392
// preprocessor has done its work):
Packit 8dc392
//
Packit 8dc392
// namespace Iex_v2 {
Packit 8dc392
//     ...
Packit 8dc392
//     class declarations
Packit 8dc392
//     ...
Packit 8dc392
// }
Packit 8dc392
//
Packit 8dc392
// namespace Iex {
Packit 8dc392
//     using namespace Iex_v2;
Packit 8dc392
// }
Packit 8dc392
//
Packit 8dc392
Packit 8dc392
//
Packit 8dc392
// Open Source version of this file pulls in the IlmBaseConfig.h file
Packit 8dc392
// for the configure time options.
Packit 8dc392
//
Packit 8dc392
#include "IlmBaseConfig.h"
Packit 8dc392
Packit 8dc392
#ifndef IEX_NAMESPACE
Packit 8dc392
#define IEX_NAMESPACE Iex
Packit 8dc392
#endif
Packit 8dc392
Packit 8dc392
#ifndef IEX_INTERNAL_NAMESPACE
Packit 8dc392
#define IEX_INTERNAL_NAMESPACE IEX_NAMESPACE
Packit 8dc392
#endif
Packit 8dc392
Packit 8dc392
//
Packit 8dc392
// We need to be sure that we import the internal namespace into the public one.
Packit 8dc392
// To do this, we use the small bit of code below which initially defines
Packit 8dc392
// IEX_INTERNAL_NAMESPACE (so it can be referenced) and then defines
Packit 8dc392
// IEX_NAMESPACE and pulls the internal symbols into the public namespace.
Packit 8dc392
//
Packit 8dc392
Packit 8dc392
namespace IEX_INTERNAL_NAMESPACE {}
Packit 8dc392
namespace IEX_NAMESPACE {
Packit 8dc392
    using namespace IEX_INTERNAL_NAMESPACE;
Packit 8dc392
}
Packit 8dc392
Packit 8dc392
//
Packit 8dc392
// There are identical pairs of HEADER/SOURCE ENTER/EXIT macros so that
Packit 8dc392
// future extension to the namespace mechanism is possible without changing
Packit 8dc392
// project source code.
Packit 8dc392
//
Packit 8dc392
Packit 8dc392
#define IEX_INTERNAL_NAMESPACE_HEADER_ENTER namespace IEX_INTERNAL_NAMESPACE {
Packit 8dc392
#define IEX_INTERNAL_NAMESPACE_HEADER_EXIT }
Packit 8dc392
Packit 8dc392
#define IEX_INTERNAL_NAMESPACE_SOURCE_ENTER namespace IEX_INTERNAL_NAMESPACE {
Packit 8dc392
#define IEX_INTERNAL_NAMESPACE_SOURCE_EXIT }
Packit 8dc392
Packit 8dc392
#endif // INCLUDED_IEXNAMESPACE_H