mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Place all choc types inside an anonymous namespace
This is to allow users to include choc in a JUCE project and not have symbol collisions with our internally included copy of choc.
This commit is contained in:
parent
7c2a5fc758
commit
dbd3b4f34b
46 changed files with 115 additions and 3 deletions
12
modules/juce_core/javascript/choc/JUCE_CHANGES.txt
Normal file
12
modules/juce_core/javascript/choc/JUCE_CHANGES.txt
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
The files in this directory were downloaded from the choc repository at
|
||||
https://github.com/Tracktion/choc.
|
||||
|
||||
In order to avoid exposing any symbols in the choc implementation, the files were modified by
|
||||
prepending all `namespace choc...` lines with `namespace {`, and by adding corresponding closing
|
||||
brackets as well.
|
||||
|
||||
Enclosing all choc definitions in an anonymous namespace allows JUCE based projects to use an
|
||||
external copy of choc without running into multiply defined symbol compilation errors.
|
||||
|
||||
By placing the anonymous namespace encapsulation inside the choc header files we avoid the issue of
|
||||
including the system headers in the namespace as well.
|
||||
|
|
@ -27,6 +27,8 @@
|
|||
#include <exception>
|
||||
#include "../platform/choc_Assert.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace choc::value
|
||||
{
|
||||
|
||||
|
|
@ -3236,5 +3238,6 @@ inline std::string_view SimpleStringDictionary::getStringForHandle (Handle handl
|
|||
inline void SimpleStringDictionary::clear() { strings.clear(); }
|
||||
|
||||
} // namespace choc::value
|
||||
} // anonymous namespace
|
||||
|
||||
#endif // CHOC_VALUE_POOL_HEADER_INCLUDED
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
choc::javascript::createQuickJSContext() to create a context for running
|
||||
javascript code.
|
||||
*/
|
||||
namespace
|
||||
{
|
||||
namespace choc::javascript
|
||||
{
|
||||
/// This is thrown by any javascript functions that need to report an error
|
||||
|
|
@ -171,6 +173,7 @@ namespace choc::javascript
|
|||
/// search path, and that you statically link the appropriate V8 libs.
|
||||
Context createV8Context();
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -184,6 +187,8 @@ namespace choc::javascript
|
|||
//
|
||||
//==============================================================================
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace choc::javascript
|
||||
{
|
||||
|
||||
|
|
@ -290,6 +295,7 @@ Context::Pimpl* Context::getPimpl() const
|
|||
}
|
||||
|
||||
} // namespace choc::javascript
|
||||
} // anonymous namespace
|
||||
|
||||
#endif // CHOC_JAVASCRIPT_HEADER_INCLUDED
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,8 @@
|
|||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace choc::javascript
|
||||
{
|
||||
|
||||
|
|
@ -64343,5 +64345,6 @@ Context createQuickJSContext()
|
|||
}
|
||||
|
||||
} // namespace choc::javascript
|
||||
} // anonymous namespace
|
||||
|
||||
#endif // CHOC_JAVASCRIPT_QUICKJS_HEADER_INCLUDED
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace choc::math
|
||||
{
|
||||
|
||||
|
|
@ -114,5 +116,6 @@ inline Int128 multiply128 (uint64_t a, uint64_t b)
|
|||
|
||||
|
||||
} // namespace choc::math
|
||||
} // anonymous namespace
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@
|
|||
#include <string>
|
||||
#include "../math/choc_MathHelpers.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace choc::text
|
||||
{
|
||||
|
||||
|
|
@ -393,5 +395,6 @@ inline std::string floatToString (float value, int maxDecimals, bool omitPointIf
|
|||
inline std::string floatToString (double value, int maxDecimals, bool omitPointIfPossible) { return FloatToStringBuffer<double> (value, maxDecimals, omitPointIfPossible).toString(); }
|
||||
|
||||
} // namespace choc::text
|
||||
} // anonymous namespace
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@
|
|||
#undef max // It's never a smart idea to include any C headers before your C++ ones, as it
|
||||
#undef min // risks polluting your namespace with all kinds of dangerous macros like these ones.
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace choc::json
|
||||
{
|
||||
|
||||
|
|
@ -557,5 +559,6 @@ value::Value create (Properties&&... properties)
|
|||
|
||||
|
||||
} // namespace choc::json
|
||||
} // anonymous namespace
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@
|
|||
#include <cwctype>
|
||||
#include "../platform/choc_Assert.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace choc::text
|
||||
{
|
||||
|
||||
|
|
@ -593,5 +595,6 @@ inline std::string percentEncodeURI (std::string_view text)
|
|||
|
||||
|
||||
} // namespace choc::text
|
||||
} // anonymous namespace
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
#include <cstddef>
|
||||
#include "choc_StringUtilities.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace choc::text
|
||||
{
|
||||
|
||||
|
|
@ -651,5 +653,6 @@ inline std::string convertUTF8ToCESU8 (UTF8Pointer utf8)
|
|||
|
||||
|
||||
} // namespace choc::text
|
||||
} // anonymous namespace
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -34,10 +34,11 @@
|
|||
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-copy-with-dtor",
|
||||
"-Wunused-but-set-variable",
|
||||
"-Wdeprecated")
|
||||
"-Wdeprecated",
|
||||
"-Wunused-function")
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_MSVC (6011 6246 6255 6262 6297 6308 6323 6340 6385 6386 28182)
|
||||
#include "choc/javascript/choc_javascript_QuickJS.h"
|
||||
#include "choc/javascript/choc_javascript.h"
|
||||
#include <juce_core/javascript/choc/javascript/choc_javascript_QuickJS.h>
|
||||
#include <juce_core/javascript/choc/javascript/choc_javascript.h>
|
||||
JUCE_END_IGNORE_WARNINGS_MSVC
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue