480 Commits

Author SHA1 Message Date
Shane Grant
8abfa583b0 Nearly done with #23
Still some kinks to work out in regards to trait checks on a non-member
load_minimal that accepts everything as template parameters and does
enable_if style checks
2014-03-19 22:41:34 -07:00
Shane Grant
0423779b94 minimal serialize functions now take Archive as const ref parameter
Even though there is currently no need to use this archive parameter, it is now
passed to the various minimal serialization functions instead of simply being
a template parameter.

The reason for this was ultimately allow for correct name-lookup of the functions
using ADL when the type was unable to provide this (e.g. a generic serialize function
for enums written in the cereal namespace).

Also fixed some issues with GCC 4.7 and the various traits that warn if the type for the
load isn't passed by const ref.  Had to use a workaround found here:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51213 (=delete instead of private).
2014-03-19 17:55:03 -07:00
Shane Grant
738da2bedb about to make some changes 2014-03-19 14:25:03 -07:00
Shane Grant
267d489a03 doxygen updates 2014-03-18 21:52:11 -07:00
Shane Grant
084532fe53 traits now compiling properly for #23 2014-03-18 17:44:58 -07:00
Shane Grant
b915326877 Another attempt at #72 2014-03-18 12:05:27 -07:00
Shane Grant
12a70b1336 work on traits
revisit the static assert on line 691 of traits firing at the wrong time
2014-03-17 22:51:08 -07:00
Shane Grant
d0d23980d5 adding const check to versioned 2014-03-17 22:24:39 -07:00
Shane Grant
e4429f0df4 Putting in check for invalid load_minmal type parameter 2014-03-17 22:22:52 -07:00
Shane Grant
3a35be8ffc adding traits for load_minimal non member versioned 2014-03-17 21:14:04 -07:00
Shane Grant
e6c3192b18 adding traits for load_minimal versioned member 2014-03-17 21:10:05 -07:00
Shane Grant
e7928a7c8d fairly happy with load_minimal traits 2014-03-17 20:55:57 -07:00
Shane Grant
cda37514d4 tidying up error messages 2014-03-17 19:41:31 -07:00
Shane Grant
6c5e776efb fixing issues with any and noconvert in traits
see #23
2014-03-17 19:33:48 -07:00
Shane Grant
02517c27f9 work on traits
see #23
2014-03-17 18:48:51 -07:00
Matt Clarkson
e7f7692d6a Preprocessor defines for serialization function names
The following preprocessor defines have been added:

 - CEREAL_SERIALIZE_FUNCTION_NAME
 - CEREAL_SAVE_FUNCTION_NAME
 - CEREAL_LOAD_FUNCTION_NAME

These defines specifiy the name of the cereal serialization/deserialization
functions so that they can be customised by users. This is especially useful if
the user would like to have capitialized function names.
2014-03-17 15:56:18 +00:00
Shane Grant
db8b0919a0 traits improvements
see #23
2014-03-16 18:36:28 -07:00
Shane Grant
f51145c906 Cleaning up prior work on traits for load_minimal
writing type traits is a wonderful battle against the compiler

see #23
2014-03-16 17:57:04 -07:00
Shane Grant
5116ced7ba progress on load type traits
see #23
2014-03-16 17:39:27 -07:00
Shane Grant
454d3ca438 update bad serialize static_assert 2014-03-15 21:35:04 -07:00
Shane Grant
dd6cf4c3cf Now emitting errors if mixing versioning on output serialization
If someone attempts to have both a versioned and non-versioned serialization
function, they will get a compile time error.

relates to improvements in #23
2014-03-15 21:21:02 -07:00
Shane Grant
5c87e68cb9 Increasing readability of static_assert on clang and other compilers that don't
actually print newlines
2014-03-15 19:36:59 -07:00
Shane Grant
22f0070a83 making versioned compatible with specialization
Also fixed a bug with some type traits that would erroneously return true if
an odd number of boolean variables were true when the desired behavior was to return
false if more than one boolean variable was true.

Need to revise the no matching serialization to properly fire if a type is specialized
but has both versioned and non-versioned functions of the specialization type.
2014-03-15 19:09:57 -07:00
Shane Grant
2225fcaf91 specialize_serialize now works with versioning
todo: load, save, and non member versions of them all
2014-03-15 18:24:40 -07:00
Shane Grant
be617d0a62 Adding save_minimal to many other traits 2014-03-15 17:51:55 -07:00
Shane Grant
88d76b3866 Detecting invalid return types for save_minimal
both member and non-member, static_asserts look good
2014-03-15 17:42:01 -07:00
Shane Grant
953090e645 Progress on traits for #23
Re-made a repo based on a more recent version of develop.
Syntax for save_minimal looking good so far.
2014-03-15 17:27:51 -07:00
Shane Grant
5f3e9fb9f1 code tidy up 2014-03-15 14:29:37 -07:00
Shane Grant
ab5a89a16f Fixing support for several numeric types in JSON
longs should now properly serialize under 32 or 64 bit machines.

long long, unsigned long long, and long double now serialize as base10
strings instead of base64.

see issue #72
2014-03-14 23:31:25 -07:00
Shane Grant
33180eac14 doc update and fix minor bug with vector test 2014-03-14 00:20:41 -07:00
Shane Grant
fd02187150 Making VS happy with #64 2014-03-13 22:55:43 -07:00
Shane Grant
c8b6e2444a Merge branch 'new_options' into develop 2014-03-13 22:30:10 -07:00
Shane Grant
5a303d33e2 Finishing up options
see #64
2014-03-13 22:28:29 -07:00
Shane Grant
ae3a27510f minor formatting 2014-03-13 12:20:16 -07:00
Shane Grant
2a0510506c No more messing up enable_shared_from_this refcounts
Modified the polymorphic saving of pointers to use a second
shared_ptr to manage the refcount of the wrapper proper polymorphic
shared_ptr (previously we were using an empty deleter).  The result of
this is that the wrapper doesn't actually manage the pointer it holds,
it just allows access to it so long as there is still a refcount in
the second refcount pointer.

Modified the polymorphic wrapper and enable shared from this state
saver to be RAII style.
2014-03-13 11:53:24 -07:00
Shane Grant
b7fd587b9e Befriending cereal::access now works with construct
see #73
2014-03-12 17:01:22 -07:00
Shane Grant
03492153df Merge branch 'develop' of github.com:USCiLab/cereal into develop
Conflicts:
	unittests.cpp
2014-03-11 22:55:14 -07:00
Shane Grant
e68c963f1f formatting 2014-03-11 22:52:03 -07:00
Shane Grant
cf7a106515 doxygen fixes 2014-03-11 17:29:32 -07:00
Randolph Voorhies
ba2ca7c94d Switching to CMake and splitting unittests 2014-03-11 14:50:04 -07:00
Shane Grant
94cb6d3ba8 Merge branch 'develop' of github.com:USCiLab/cereal into develop 2014-03-08 23:26:01 -08:00
Shane Grant
c70f776ee5 Fixing support of final classes in polymorphic pointers
This fixes issue #65, however, this comes at a mild consequence for
anyone wishing to serialize types that inherit from std::enable_shared_from_this.
cereal no longer supports this inheritance if done using the protected access
modifier without befriending cereal::access.

For example, consider all of the following (pretend they are polymorphic)
serialized with some smart pointer:

struct A : std::enable_shared_from_this<A> {}; // OK
struct B final : protected A { friend class cereal::access; }; // OK
struct B2 final : protected A { }; // ERROR: cereal can't access enable_shared_from_this
struct C : A {}; // OK
struct D {}; // OK - a normal class with no enable_shared_from_this
2014-03-08 23:22:45 -08:00
Shane Grant
019d795685 indenting some code 2014-03-08 22:50:49 -08:00
Shane Grant
6b6f1fe383 everyone likes typename except MSVC
Apparently MSVC doesn't want typename where it makes sense to use
typename (dependent type from a template).  Preprocessor verbosely
saves the day, yet again.  Relates #68
2014-03-08 22:47:47 -08:00
Shane Grant
3e1f9cb027 fixing typo for VS compliance (see #68) 2014-03-08 22:42:16 -08:00
Shane Grant
44eb532548 Making cereal play nicely when saving enable_shared_from_this
cereal no longer permanently modifies the state of internal workings of
std::enable_shared_from_this when saving.  cereal *should* be completely
compatible with both saving and loading anything that inherits from this now.
This fixes issue #68 - note that there is still a minor issue regarding
classes declared final that will run into a bug with the way we check for
enable_shared_from_this (see issue #65).

Issue #65 will be addressed in the future by changing the way we check
for derivation from enable_shared_from_this.  In the current scheme, we
can detect this even if you use protected inheritance.  In the future, cereal
will not be able to get around protected inheritance of enable_shared_from without
befriending cereal::access.  This will come at the benefit of allowing classes
declared final to be used with polymorphic serialization.
2014-03-08 22:30:20 -08:00
Shane Grant
22460f6c7f indenting some code 2014-03-05 15:35:51 -08:00
Shane Grant
6b13c93a47 options struct for xml 2014-03-05 15:28:47 -08:00
Shane Grant
a7a8578d51 playing around with new options for JSON
One idea is to put all of the options in a single struct, as seen here
2014-03-05 15:11:50 -08:00
Shane Grant
7cd0c3e565 throw exception instead of assert for rapidjson
cereal will now override RAPIDJSON_ASSERT by default to throw a
runtime exception instead of failing an assertion.  This can always
be overridden by defining your own RAPIDJSON_ASSERT macro

see #67
2014-03-01 23:16:58 -08:00