Adapt to changes in c++utilities
This commit is contained in:
parent
2194000938
commit
8cac133104
|
@ -9,7 +9,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ApplicationUtilities;
|
using namespace CppUtilities;
|
||||||
|
|
||||||
namespace ReflectiveRapidJSON {
|
namespace ReflectiveRapidJSON {
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,10 @@ public:
|
||||||
struct Options {
|
struct Options {
|
||||||
Options();
|
Options();
|
||||||
Options(const Options &other) = delete;
|
Options(const Options &other) = delete;
|
||||||
void appendTo(ApplicationUtilities::Argument *arg);
|
void appendTo(CppUtilities::Argument *arg);
|
||||||
|
|
||||||
ApplicationUtilities::ConfigValueArgument additionalClassesArg;
|
CppUtilities::ConfigValueArgument additionalClassesArg;
|
||||||
ApplicationUtilities::ConfigValueArgument visibilityArg;
|
CppUtilities::ConfigValueArgument visibilityArg;
|
||||||
};
|
};
|
||||||
|
|
||||||
BinarySerializationCodeGenerator(CodeFactory &factory, const Options &options);
|
BinarySerializationCodeGenerator(CodeFactory &factory, const Options &options);
|
||||||
|
@ -32,7 +32,7 @@ protected:
|
||||||
const Options &m_options;
|
const Options &m_options;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void BinarySerializationCodeGenerator::Options::appendTo(ApplicationUtilities::Argument *arg)
|
inline void BinarySerializationCodeGenerator::Options::appendTo(CppUtilities::Argument *arg)
|
||||||
{
|
{
|
||||||
arg->addSubArgument(&additionalClassesArg);
|
arg->addSubArgument(&additionalClassesArg);
|
||||||
arg->addSubArgument(&visibilityArg);
|
arg->addSubArgument(&visibilityArg);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ApplicationUtilities;
|
using namespace CppUtilities;
|
||||||
|
|
||||||
namespace ReflectiveRapidJSON {
|
namespace ReflectiveRapidJSON {
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,10 @@ public:
|
||||||
struct Options {
|
struct Options {
|
||||||
Options();
|
Options();
|
||||||
Options(const Options &other) = delete;
|
Options(const Options &other) = delete;
|
||||||
void appendTo(ApplicationUtilities::Argument *arg);
|
void appendTo(CppUtilities::Argument *arg);
|
||||||
|
|
||||||
ApplicationUtilities::ConfigValueArgument additionalClassesArg;
|
CppUtilities::ConfigValueArgument additionalClassesArg;
|
||||||
ApplicationUtilities::ConfigValueArgument visibilityArg;
|
CppUtilities::ConfigValueArgument visibilityArg;
|
||||||
};
|
};
|
||||||
|
|
||||||
JsonSerializationCodeGenerator(CodeFactory &factory, const Options &options);
|
JsonSerializationCodeGenerator(CodeFactory &factory, const Options &options);
|
||||||
|
@ -32,7 +32,7 @@ protected:
|
||||||
const Options &m_options;
|
const Options &m_options;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void JsonSerializationCodeGenerator::Options::appendTo(ApplicationUtilities::Argument *arg)
|
inline void JsonSerializationCodeGenerator::Options::appendTo(CppUtilities::Argument *arg)
|
||||||
{
|
{
|
||||||
arg->addSubArgument(&additionalClassesArg);
|
arg->addSubArgument(&additionalClassesArg);
|
||||||
arg->addSubArgument(&visibilityArg);
|
arg->addSubArgument(&visibilityArg);
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include <c++utilities/application/argumentparser.h>
|
#include <c++utilities/application/argumentparser.h>
|
||||||
#include <c++utilities/application/commandlineutils.h>
|
#include <c++utilities/application/commandlineutils.h>
|
||||||
#include <c++utilities/application/failure.h>
|
|
||||||
#include <c++utilities/conversion/stringconversion.h>
|
#include <c++utilities/conversion/stringconversion.h>
|
||||||
#include <c++utilities/io/ansiescapecodes.h>
|
#include <c++utilities/io/ansiescapecodes.h>
|
||||||
#include <c++utilities/io/misc.h>
|
#include <c++utilities/io/misc.h>
|
||||||
|
@ -17,10 +16,8 @@
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ApplicationUtilities;
|
using namespace CppUtilities;
|
||||||
using namespace ConversionUtilities;
|
using namespace CppUtilities::EscapeCodes;
|
||||||
using namespace EscapeCodes;
|
|
||||||
using namespace IoUtilities;
|
|
||||||
using namespace ReflectiveRapidJSON;
|
using namespace ReflectiveRapidJSON;
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
@ -53,7 +50,7 @@ int main(int argc, char *argv[])
|
||||||
parser.setMainArguments({ &generateArg, &noColorArg, &helpArg });
|
parser.setMainArguments({ &generateArg, &noColorArg, &helpArg });
|
||||||
|
|
||||||
// parse arguments
|
// parse arguments
|
||||||
parser.parseArgsOrExit(argc, argv);
|
parser.parseArgs(argc, argv, ParseArgumentBehavior::CheckConstraints | ParseArgumentBehavior::InvokeCallbacks);
|
||||||
if (helpArg.isPresent() || !generateArg.isPresent()) {
|
if (helpArg.isPresent() || !generateArg.isPresent()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,8 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
using namespace CPPUNIT_NS;
|
using namespace CPPUNIT_NS;
|
||||||
using namespace IoUtilities;
|
using namespace CppUtilities;
|
||||||
using namespace TestUtilities;
|
using namespace CppUtilities::Literals;
|
||||||
using namespace TestUtilities::Literals;
|
|
||||||
using namespace ConversionUtilities;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The BinaryGeneratorTests class tests the binary generator.
|
* \brief The BinaryGeneratorTests class tests the binary generator.
|
||||||
|
|
|
@ -6,10 +6,12 @@
|
||||||
#include <c++utilities/tests/testutils.h>
|
#include <c++utilities/tests/testutils.h>
|
||||||
|
|
||||||
// ensure "operator<<" from TestUtilities is visible prior to the call site
|
// ensure "operator<<" from TestUtilities is visible prior to the call site
|
||||||
using TestUtilities::operator<<;
|
using CppUtilities::operator<<;
|
||||||
|
|
||||||
#include <cppunit/extensions/HelperMacros.h>
|
#include <cppunit/extensions/HelperMacros.h>
|
||||||
|
|
||||||
|
namespace Traits = CppUtilities::Traits;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Asserts equality of two iteratables printing the differing indices.
|
* \brief Asserts equality of two iteratables printing the differing indices.
|
||||||
*/
|
*/
|
||||||
|
@ -22,20 +24,20 @@ inline void assertEqualityLinewise(const Iteratable &iteratable1, const Iteratab
|
||||||
for (auto i1 = iteratable1.cbegin(), i2 = iteratable2.cbegin(); i1 != iteratable1.cend() || i2 != iteratable2.cend(); ++currentLine) {
|
for (auto i1 = iteratable1.cbegin(), i2 = iteratable2.cbegin(); i1 != iteratable1.cend() || i2 != iteratable2.cend(); ++currentLine) {
|
||||||
if (i1 != iteratable1.cend() && i2 != iteratable2.cend()) {
|
if (i1 != iteratable1.cend() && i2 != iteratable2.cend()) {
|
||||||
if (*i1 != *i2) {
|
if (*i1 != *i2) {
|
||||||
differentLines.push_back(ConversionUtilities::numberToString(currentLine));
|
differentLines.push_back(CppUtilities::numberToString(currentLine));
|
||||||
}
|
}
|
||||||
++i1, ++i2;
|
++i1, ++i2;
|
||||||
} else if (i1 != iteratable1.cend()) {
|
} else if (i1 != iteratable1.cend()) {
|
||||||
differentLines.push_back(ConversionUtilities::numberToString(currentLine));
|
differentLines.push_back(CppUtilities::numberToString(currentLine));
|
||||||
++i1;
|
++i1;
|
||||||
} else if (i2 != iteratable1.cend()) {
|
} else if (i2 != iteratable1.cend()) {
|
||||||
differentLines.push_back(ConversionUtilities::numberToString(currentLine));
|
differentLines.push_back(CppUtilities::numberToString(currentLine));
|
||||||
++i2;
|
++i2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!differentLines.empty()) {
|
if (!differentLines.empty()) {
|
||||||
CPPUNIT_ASSERT_EQUAL_MESSAGE(
|
CPPUNIT_ASSERT_EQUAL_MESSAGE(
|
||||||
"the following lines differ: " + ConversionUtilities::joinStrings(differentLines, ", "), iteratable1, iteratable2);
|
"the following lines differ: " + CppUtilities::joinStrings(differentLines, ", "), iteratable1, iteratable2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,8 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace CPPUNIT_NS;
|
using namespace CPPUNIT_NS;
|
||||||
using namespace IoUtilities;
|
using namespace CppUtilities;
|
||||||
using namespace TestUtilities;
|
using namespace CppUtilities::Literals;
|
||||||
using namespace TestUtilities::Literals;
|
|
||||||
using namespace ConversionUtilities;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The JsonGeneratorTests class tests the overall functionality of the code generator (CLI and generator itself) and JSON specific parts.
|
* \brief The JsonGeneratorTests class tests the overall functionality of the code generator (CLI and generator itself) and JSON specific parts.
|
||||||
|
|
|
@ -99,8 +99,8 @@ struct MultipleDerivedTestStruct : public TestStruct,
|
||||||
* and toJson() methods. This is asserted in JsonGeneratorTests::testCustomSerialization();
|
* and toJson() methods. This is asserted in JsonGeneratorTests::testCustomSerialization();
|
||||||
*/
|
*/
|
||||||
struct StructWithCustomTypes : public JsonSerializable<StructWithCustomTypes> {
|
struct StructWithCustomTypes : public JsonSerializable<StructWithCustomTypes> {
|
||||||
ChronoUtilities::DateTime dt = ChronoUtilities::DateTime::fromDateAndTime(2017, 4, 2, 15, 31, 21, 165.125);
|
CppUtilities::DateTime dt = CppUtilities::DateTime::fromDateAndTime(2017, 4, 2, 15, 31, 21, 165.125);
|
||||||
ChronoUtilities::TimeSpan ts = ChronoUtilities::TimeSpan::fromHours(3.25) + ChronoUtilities::TimeSpan::fromSeconds(19.125);
|
CppUtilities::TimeSpan ts = CppUtilities::TimeSpan::fromHours(3.25) + CppUtilities::TimeSpan::fromSeconds(19.125);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -16,22 +16,22 @@
|
||||||
namespace ReflectiveRapidJSON {
|
namespace ReflectiveRapidJSON {
|
||||||
namespace BinaryReflector {
|
namespace BinaryReflector {
|
||||||
|
|
||||||
template <> inline void readCustomType<ChronoUtilities::DateTime>(BinaryDeserializer &deserializer, ChronoUtilities::DateTime &dateTime)
|
template <> inline void readCustomType<CppUtilities::DateTime>(BinaryDeserializer &deserializer, CppUtilities::DateTime &dateTime)
|
||||||
{
|
{
|
||||||
deserializer.read(dateTime.ticks());
|
deserializer.read(dateTime.ticks());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <> inline void writeCustomType<ChronoUtilities::DateTime>(BinarySerializer &serializer, const ChronoUtilities::DateTime &dateTime)
|
template <> inline void writeCustomType<CppUtilities::DateTime>(BinarySerializer &serializer, const CppUtilities::DateTime &dateTime)
|
||||||
{
|
{
|
||||||
serializer.write(dateTime.totalTicks());
|
serializer.write(dateTime.totalTicks());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <> inline void readCustomType<ChronoUtilities::TimeSpan>(BinaryDeserializer &deserializer, ChronoUtilities::TimeSpan &timeSpan)
|
template <> inline void readCustomType<CppUtilities::TimeSpan>(BinaryDeserializer &deserializer, CppUtilities::TimeSpan &timeSpan)
|
||||||
{
|
{
|
||||||
deserializer.read(timeSpan.ticks());
|
deserializer.read(timeSpan.ticks());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <> inline void writeCustomType<ChronoUtilities::TimeSpan>(BinarySerializer &serializer, const ChronoUtilities::TimeSpan &timeSpan)
|
template <> inline void writeCustomType<CppUtilities::TimeSpan>(BinarySerializer &serializer, const CppUtilities::TimeSpan &timeSpan)
|
||||||
{
|
{
|
||||||
serializer.write(timeSpan.totalTicks());
|
serializer.write(timeSpan.totalTicks());
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,11 +49,11 @@ class BinarySerializer;
|
||||||
template <typename Type, Traits::EnableIf<IsCustomType<Type>> * = nullptr> void readCustomType(BinaryDeserializer &deserializer, Type &customType);
|
template <typename Type, Traits::EnableIf<IsCustomType<Type>> * = nullptr> void readCustomType(BinaryDeserializer &deserializer, Type &customType);
|
||||||
template <typename Type, Traits::EnableIf<IsCustomType<Type>> * = nullptr> void writeCustomType(BinarySerializer &serializer, const Type &customType);
|
template <typename Type, Traits::EnableIf<IsCustomType<Type>> * = nullptr> void writeCustomType(BinarySerializer &serializer, const Type &customType);
|
||||||
|
|
||||||
class BinaryDeserializer : public IoUtilities::BinaryReader {
|
class BinaryDeserializer : public CppUtilities::BinaryReader {
|
||||||
public:
|
public:
|
||||||
BinaryDeserializer(std::istream *stream);
|
BinaryDeserializer(std::istream *stream);
|
||||||
|
|
||||||
using IoUtilities::BinaryReader::read;
|
using CppUtilities::BinaryReader::read;
|
||||||
template <typename Type, Traits::EnableIf<Traits::IsSpecializationOf<Type, std::pair>> * = nullptr> void read(Type &pair);
|
template <typename Type, Traits::EnableIf<Traits::IsSpecializationOf<Type, std::pair>> * = nullptr> void read(Type &pair);
|
||||||
template <typename Type, Traits::EnableIf<Traits::IsSpecializationOf<Type, std::unique_ptr>> * = nullptr> void read(Type &pair);
|
template <typename Type, Traits::EnableIf<Traits::IsSpecializationOf<Type, std::unique_ptr>> * = nullptr> void read(Type &pair);
|
||||||
template <typename Type, Traits::EnableIf<Traits::IsSpecializationOf<Type, std::shared_ptr>> * = nullptr> void read(Type &pair);
|
template <typename Type, Traits::EnableIf<Traits::IsSpecializationOf<Type, std::shared_ptr>> * = nullptr> void read(Type &pair);
|
||||||
|
@ -69,11 +69,11 @@ public:
|
||||||
std::unordered_map<std::uint64_t, std::any> m_pointer;
|
std::unordered_map<std::uint64_t, std::any> m_pointer;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BinarySerializer : public IoUtilities::BinaryWriter {
|
class BinarySerializer : public CppUtilities::BinaryWriter {
|
||||||
public:
|
public:
|
||||||
BinarySerializer(std::ostream *stream);
|
BinarySerializer(std::ostream *stream);
|
||||||
|
|
||||||
using IoUtilities::BinaryWriter::write;
|
using CppUtilities::BinaryWriter::write;
|
||||||
template <typename Type, Traits::EnableIf<Traits::IsSpecializationOf<Type, std::pair>> * = nullptr> void write(const Type &pair);
|
template <typename Type, Traits::EnableIf<Traits::IsSpecializationOf<Type, std::pair>> * = nullptr> void write(const Type &pair);
|
||||||
template <typename Type, Traits::EnableIf<Traits::IsSpecializingAnyOf<Type, std::unique_ptr>> * = nullptr> void write(const Type &pointer);
|
template <typename Type, Traits::EnableIf<Traits::IsSpecializingAnyOf<Type, std::unique_ptr>> * = nullptr> void write(const Type &pointer);
|
||||||
template <typename Type, Traits::EnableIf<Traits::IsSpecializingAnyOf<Type, std::shared_ptr>> * = nullptr> void write(const Type &pointer);
|
template <typename Type, Traits::EnableIf<Traits::IsSpecializingAnyOf<Type, std::shared_ptr>> * = nullptr> void write(const Type &pointer);
|
||||||
|
@ -85,7 +85,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
inline BinaryDeserializer::BinaryDeserializer(std::istream *stream)
|
inline BinaryDeserializer::BinaryDeserializer(std::istream *stream)
|
||||||
: IoUtilities::BinaryReader(stream)
|
: CppUtilities::BinaryReader(stream)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ template <typename Type, Traits::EnableIf<Traits::IsSpecializationOf<Type, std::
|
||||||
try {
|
try {
|
||||||
pointer = std::any_cast<Type>(m_pointer[id]);
|
pointer = std::any_cast<Type>(m_pointer[id]);
|
||||||
} catch (const std::bad_any_cast &) {
|
} catch (const std::bad_any_cast &) {
|
||||||
throw ConversionUtilities::ConversionException("Referenced pointer type does not match");
|
throw CppUtilities::ConversionException("Referenced pointer type does not match");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ template <typename Type, Traits::EnableIf<IsCustomType<Type>> *> void BinaryDese
|
||||||
}
|
}
|
||||||
|
|
||||||
inline BinarySerializer::BinarySerializer(std::ostream *stream)
|
inline BinarySerializer::BinarySerializer(std::ostream *stream)
|
||||||
: IoUtilities::BinaryWriter(stream)
|
: CppUtilities::BinaryWriter(stream)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,16 +20,16 @@ namespace JsonReflector {
|
||||||
// define functions to "push" values to a RapidJSON array or object
|
// define functions to "push" values to a RapidJSON array or object
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline void push<ChronoUtilities::DateTime>(
|
inline void push<CppUtilities::DateTime>(
|
||||||
const ChronoUtilities::DateTime &reflectable, RAPIDJSON_NAMESPACE::Value &value, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator)
|
const CppUtilities::DateTime &reflectable, RAPIDJSON_NAMESPACE::Value &value, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator)
|
||||||
{
|
{
|
||||||
const std::string str(reflectable.toIsoString());
|
const std::string str(reflectable.toIsoString());
|
||||||
value.SetString(str.data(), rapidJsonSize(str.size()), allocator);
|
value.SetString(str.data(), rapidJsonSize(str.size()), allocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline void push<ChronoUtilities::TimeSpan>(
|
inline void push<CppUtilities::TimeSpan>(
|
||||||
const ChronoUtilities::TimeSpan &reflectable, RAPIDJSON_NAMESPACE::Value &value, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator)
|
const CppUtilities::TimeSpan &reflectable, RAPIDJSON_NAMESPACE::Value &value, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator)
|
||||||
{
|
{
|
||||||
const std::string str(reflectable.toString());
|
const std::string str(reflectable.toString());
|
||||||
value.SetString(str.data(), rapidJsonSize(str.size()), allocator);
|
value.SetString(str.data(), rapidJsonSize(str.size()), allocator);
|
||||||
|
@ -38,14 +38,14 @@ inline void push<ChronoUtilities::TimeSpan>(
|
||||||
// define functions to "pull" values from a RapidJSON array or object
|
// define functions to "pull" values from a RapidJSON array or object
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline void pull<ChronoUtilities::DateTime>(ChronoUtilities::DateTime &reflectable,
|
inline void pull<CppUtilities::DateTime>(CppUtilities::DateTime &reflectable,
|
||||||
const RAPIDJSON_NAMESPACE::GenericValue<RAPIDJSON_NAMESPACE::UTF8<char>> &value, JsonDeserializationErrors *errors)
|
const RAPIDJSON_NAMESPACE::GenericValue<RAPIDJSON_NAMESPACE::UTF8<char>> &value, JsonDeserializationErrors *errors)
|
||||||
{
|
{
|
||||||
std::string str;
|
std::string str;
|
||||||
pull(str, value, errors);
|
pull(str, value, errors);
|
||||||
try {
|
try {
|
||||||
reflectable = ChronoUtilities::DateTime::fromIsoStringGmt(str.data());
|
reflectable = CppUtilities::DateTime::fromIsoStringGmt(str.data());
|
||||||
} catch (const ConversionUtilities::ConversionException &) {
|
} catch (const CppUtilities::ConversionException &) {
|
||||||
if (errors) {
|
if (errors) {
|
||||||
errors->reportConversionError(JsonType::String);
|
errors->reportConversionError(JsonType::String);
|
||||||
}
|
}
|
||||||
|
@ -53,14 +53,14 @@ inline void pull<ChronoUtilities::DateTime>(ChronoUtilities::DateTime &reflectab
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline void pull<ChronoUtilities::TimeSpan>(ChronoUtilities::TimeSpan &reflectable,
|
inline void pull<CppUtilities::TimeSpan>(CppUtilities::TimeSpan &reflectable,
|
||||||
const RAPIDJSON_NAMESPACE::GenericValue<RAPIDJSON_NAMESPACE::UTF8<char>> &value, JsonDeserializationErrors *errors)
|
const RAPIDJSON_NAMESPACE::GenericValue<RAPIDJSON_NAMESPACE::UTF8<char>> &value, JsonDeserializationErrors *errors)
|
||||||
{
|
{
|
||||||
std::string str;
|
std::string str;
|
||||||
pull(str, value, errors);
|
pull(str, value, errors);
|
||||||
try {
|
try {
|
||||||
reflectable = ChronoUtilities::TimeSpan::fromString(str.data());
|
reflectable = CppUtilities::TimeSpan::fromString(str.data());
|
||||||
} catch (const ConversionUtilities::ConversionException &) {
|
} catch (const CppUtilities::ConversionException &) {
|
||||||
if (errors) {
|
if (errors) {
|
||||||
errors->reportConversionError(JsonType::String);
|
errors->reportConversionError(JsonType::String);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <c++utilities/io/misc.h>
|
#include <c++utilities/io/misc.h>
|
||||||
#include <c++utilities/tests/testutils.h>
|
#include <c++utilities/tests/testutils.h>
|
||||||
|
|
||||||
using TestUtilities::operator<<; // must be visible prior to the call site
|
using CppUtilities::operator<<; // must be visible prior to the call site
|
||||||
#include <cppunit/TestFixture.h>
|
#include <cppunit/TestFixture.h>
|
||||||
#include <cppunit/extensions/HelperMacros.h>
|
#include <cppunit/extensions/HelperMacros.h>
|
||||||
|
|
||||||
|
@ -21,10 +21,8 @@ using TestUtilities::operator<<; // must be visible prior to the call site
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace CPPUNIT_NS;
|
using namespace CPPUNIT_NS;
|
||||||
using namespace RAPIDJSON_NAMESPACE;
|
using namespace RAPIDJSON_NAMESPACE;
|
||||||
using namespace IoUtilities;
|
using namespace CppUtilities;
|
||||||
using namespace ConversionUtilities;
|
using namespace CppUtilities::Literals;
|
||||||
using namespace TestUtilities;
|
|
||||||
using namespace TestUtilities::Literals;
|
|
||||||
using namespace ReflectiveRapidJSON;
|
using namespace ReflectiveRapidJSON;
|
||||||
|
|
||||||
/// \cond
|
/// \cond
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include <c++utilities/io/misc.h>
|
#include <c++utilities/io/misc.h>
|
||||||
#include <c++utilities/tests/testutils.h>
|
#include <c++utilities/tests/testutils.h>
|
||||||
|
|
||||||
using TestUtilities::operator<<; // must be visible prior to the call site
|
using CppUtilities::operator<<; // must be visible prior to the call site
|
||||||
#include <cppunit/TestFixture.h>
|
#include <cppunit/TestFixture.h>
|
||||||
#include <cppunit/extensions/HelperMacros.h>
|
#include <cppunit/extensions/HelperMacros.h>
|
||||||
|
|
||||||
|
@ -23,11 +23,8 @@ using TestUtilities::operator<<; // must be visible prior to the call site
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace CPPUNIT_NS;
|
using namespace CPPUNIT_NS;
|
||||||
using namespace IoUtilities;
|
using namespace CppUtilities;
|
||||||
using namespace ChronoUtilities;
|
using namespace CppUtilities::Literals;
|
||||||
using namespace ConversionUtilities;
|
|
||||||
using namespace TestUtilities;
|
|
||||||
using namespace TestUtilities::Literals;
|
|
||||||
using namespace ReflectiveRapidJSON;
|
using namespace ReflectiveRapidJSON;
|
||||||
|
|
||||||
/// \cond
|
/// \cond
|
||||||
|
@ -318,7 +315,7 @@ void BinaryReflectorTests::testSharedPointer(uintptr_t fakePointer)
|
||||||
BinaryReflector::BinaryDeserializer deserializer(&stream);
|
BinaryReflector::BinaryDeserializer deserializer(&stream);
|
||||||
shared_ptr<int> readPtr;
|
shared_ptr<int> readPtr;
|
||||||
deserializer.m_pointer[fakePointer] = "foo";
|
deserializer.m_pointer[fakePointer] = "foo";
|
||||||
CPPUNIT_ASSERT_THROW(deserializer.read(readPtr), ConversionUtilities::ConversionException);
|
CPPUNIT_ASSERT_THROW(deserializer.read(readPtr), CppUtilities::ConversionException);
|
||||||
CPPUNIT_ASSERT(readPtr == nullptr);
|
CPPUNIT_ASSERT(readPtr == nullptr);
|
||||||
|
|
||||||
// deserialize the shared pointer assuming it has already been read and the type matches
|
// deserialize the shared pointer assuming it has already been read and the type matches
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <c++utilities/io/misc.h>
|
#include <c++utilities/io/misc.h>
|
||||||
#include <c++utilities/tests/testutils.h>
|
#include <c++utilities/tests/testutils.h>
|
||||||
|
|
||||||
using TestUtilities::operator<<; // must be visible prior to the call site
|
using CppUtilities::operator<<; // must be visible prior to the call site
|
||||||
#include <cppunit/TestFixture.h>
|
#include <cppunit/TestFixture.h>
|
||||||
#include <cppunit/extensions/HelperMacros.h>
|
#include <cppunit/extensions/HelperMacros.h>
|
||||||
|
|
||||||
|
@ -21,10 +21,8 @@ using TestUtilities::operator<<; // must be visible prior to the call site
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace CPPUNIT_NS;
|
using namespace CPPUNIT_NS;
|
||||||
using namespace RAPIDJSON_NAMESPACE;
|
using namespace RAPIDJSON_NAMESPACE;
|
||||||
using namespace IoUtilities;
|
using namespace CppUtilities;
|
||||||
using namespace ConversionUtilities;
|
using namespace CppUtilities::Literals;
|
||||||
using namespace TestUtilities;
|
|
||||||
using namespace TestUtilities::Literals;
|
|
||||||
using namespace ReflectiveRapidJSON;
|
using namespace ReflectiveRapidJSON;
|
||||||
|
|
||||||
/// \cond
|
/// \cond
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace CPPUNIT_NS;
|
using namespace CPPUNIT_NS;
|
||||||
using namespace RAPIDJSON_NAMESPACE;
|
using namespace RAPIDJSON_NAMESPACE;
|
||||||
using namespace ChronoUtilities;
|
using namespace CppUtilities;
|
||||||
using namespace TestUtilities::Literals;
|
using namespace CppUtilities::Literals;
|
||||||
using namespace ReflectiveRapidJSON;
|
using namespace ReflectiveRapidJSON;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <c++utilities/io/misc.h>
|
#include <c++utilities/io/misc.h>
|
||||||
#include <c++utilities/tests/testutils.h>
|
#include <c++utilities/tests/testutils.h>
|
||||||
|
|
||||||
using TestUtilities::operator<<; // must be visible prior to the call site
|
using CppUtilities::operator<<; // must be visible prior to the call site
|
||||||
#include <cppunit/TestFixture.h>
|
#include <cppunit/TestFixture.h>
|
||||||
#include <cppunit/extensions/HelperMacros.h>
|
#include <cppunit/extensions/HelperMacros.h>
|
||||||
|
|
||||||
|
@ -24,10 +24,8 @@ using TestUtilities::operator<<; // must be visible prior to the call site
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace CPPUNIT_NS;
|
using namespace CPPUNIT_NS;
|
||||||
using namespace RAPIDJSON_NAMESPACE;
|
using namespace RAPIDJSON_NAMESPACE;
|
||||||
using namespace IoUtilities;
|
using namespace CppUtilities;
|
||||||
using namespace ConversionUtilities;
|
using namespace CppUtilities::Literals;
|
||||||
using namespace TestUtilities;
|
|
||||||
using namespace TestUtilities::Literals;
|
|
||||||
using namespace ReflectiveRapidJSON;
|
using namespace ReflectiveRapidJSON;
|
||||||
|
|
||||||
/// \cond
|
/// \cond
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
namespace ReflectiveRapidJSON {
|
namespace ReflectiveRapidJSON {
|
||||||
|
|
||||||
|
namespace Traits = ::CppUtilities::Traits;
|
||||||
|
|
||||||
// define structs and macros to allow treating custom data types as std::map, std::set, ...
|
// define structs and macros to allow treating custom data types as std::map, std::set, ...
|
||||||
/// \brief \brief The TreatAsMapOrHash class allows treating custom classes as std::map or std::unordered_map.
|
/// \brief \brief The TreatAsMapOrHash class allows treating custom classes as std::map or std::unordered_map.
|
||||||
template <typename T> struct TreatAsMapOrHash : public Traits::Bool<false> {
|
template <typename T> struct TreatAsMapOrHash : public Traits::Bool<false> {
|
||||||
|
|
Loading…
Reference in New Issue