From 4554155e3dea5e21cb1bc5b9d89f571060e5d33e Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 10 Feb 2014 17:20:30 +0000 Subject: [PATCH] =?UTF-8?q?Made=20Clara=20a=20=E2=80=9CCliche=E2=80=9D=20h?= =?UTF-8?q?eader,=20which=20will=20be=20usable=20independently=20of=20Catc?= =?UTF-8?q?h.=20-=20This=20is=20just=20a=20first=20step.=20It=20still=20ha?= =?UTF-8?q?s=20a=20dependency=20on=20catch=5Ftext.h,=20which=20also=20need?= =?UTF-8?q?s=20to=20be=20made=20a=20Cliche=20header.=20-=20These=20then=20?= =?UTF-8?q?need=20their=20own=20homes=20on=20GitHub.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/internal/catch_clara.h | 16 ++++++++++++++++ include/internal/catch_commandline.hpp | 2 +- include/internal/clara.h | 19 +++++++++++++++++-- projects/SelfTest/TestMain.cpp | 2 +- .../CatchSelfTest.xcodeproj/project.pbxproj | 2 ++ 5 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 include/internal/catch_clara.h diff --git a/include/internal/catch_clara.h b/include/internal/catch_clara.h new file mode 100644 index 00000000..636be471 --- /dev/null +++ b/include/internal/catch_clara.h @@ -0,0 +1,16 @@ +/* + * Created by Phil on 10/2/2014. + * Copyright 2014 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + * + */ +#ifndef TWOBLUECUBES_CATCH_CLARA_H_INCLUDED +#define TWOBLUECUBES_CATCH_CLARA_H_INCLUDED + +#define CLICHE_CLARA_EMBEDDED_NAMESPACE Catch +#include "clara.h" +#undef CLICHE_CLARA_EMBEDDED_NAMESPACE + +#endif // TWOBLUECUBES_CATCH_CLARA_H_INCLUDED diff --git a/include/internal/catch_commandline.hpp b/include/internal/catch_commandline.hpp index 5b80761f..ee19de85 100644 --- a/include/internal/catch_commandline.hpp +++ b/include/internal/catch_commandline.hpp @@ -10,7 +10,7 @@ #include "catch_config.hpp" #include "catch_common.h" -#include "clara.h" +#include "catch_clara.h" #include diff --git a/include/internal/clara.h b/include/internal/clara.h index b44d129a..494b959a 100644 --- a/include/internal/clara.h +++ b/include/internal/clara.h @@ -5,11 +5,22 @@ * Distributed under the Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ -#ifndef TWOBLUECUBES_CLARA_H_INCLUDED +#ifndef CLICHE_CLARA_EMBEDDED_NAMESPACE +#ifdef TWOBLUECUBES_CLARA_H_INCLUDED +#define TWOBLUECUBES_CLARA_H_ALREADY_INCLUDED +#else #define TWOBLUECUBES_CLARA_H_INCLUDED +#endif +#endif + +#ifndef TWOBLUECUBES_CLARA_H_ALREADY_INCLUDED #include "catch_text.h" // This will get moved out too +#ifdef CLICHE_CLARA_EMBEDDED_NAMESPACE +namespace CLICHE_CLARA_EMBEDDED_NAMESPACE { +#endif + namespace Clara { namespace Detail { template struct RemoveConstRef{ typedef T type; }; @@ -582,5 +593,9 @@ namespace Clara { } // end namespace Clara +#ifdef CLICHE_CLARA_EMBEDDED_NAMESPACE +} // end embedded namespace +#endif + +#endif // TWOBLUECUBES_CLARA_H_ALREAD_INCLUDED -#endif // TWOBLUECUBES_CLARA_H_INCLUDED diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp index 575a456a..b1468cbc 100644 --- a/projects/SelfTest/TestMain.cpp +++ b/projects/SelfTest/TestMain.cpp @@ -16,7 +16,7 @@ template void parseIntoConfig( const char * (&argv)[size], Catch::ConfigData& config ) { - Clara::CommandLine parser = Catch::makeCommandLineParser(); + Catch::Clara::CommandLine parser = Catch::makeCommandLineParser(); parser.parseInto( size, argv, config ); } diff --git a/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj b/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj index e61b82de..20d58a9f 100644 --- a/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj +++ b/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj @@ -77,6 +77,7 @@ 26847E5B16BBAB790043B9C1 /* catch_message.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_message.h; sourceTree = ""; }; 26847E5C16BBACB60043B9C1 /* catch_message.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_message.hpp; sourceTree = ""; }; 26847E5D16BBADB40043B9C1 /* catch_message.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_message.cpp; path = ../../../SelfTest/SurrogateCpps/catch_message.cpp; sourceTree = ""; }; + 268F47B018A93F7800D8C14F /* catch_clara.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_clara.h; sourceTree = ""; }; 26948284179A9AB900ED166E /* SectionTrackerTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SectionTrackerTests.cpp; path = ../../../SelfTest/SectionTrackerTests.cpp; sourceTree = ""; }; 26948287179EF7F900ED166E /* catch_test_case_tracker.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_test_case_tracker.hpp; sourceTree = ""; }; 2694A1FB16A0000E004816E3 /* catch_text.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = catch_text.cpp; sourceTree = ""; }; @@ -438,6 +439,7 @@ 26AEAF1617BEA18E009E32C9 /* catch_platform.h */, 262E739A1846759000CAC268 /* catch_common.hpp */, 261488FC184D1DC10041FBEB /* catch_stream.h */, + 268F47B018A93F7800D8C14F /* catch_clara.h */, ); name = Infrastructure; sourceTree = "";