-
Notifications
You must be signed in to change notification settings - Fork 807
Allow capitalized Serialize
functions
#60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thinking about this it would be possible to have a trait for both capitalized and non-capitalized. |
I don't like the idea of adding both capitalized and non-capitalized, it seems clunky and heavy-handed. I think defines for the function names as you originally suggest is fine, and allows users to override the default naming convention of cereal in a useful way to avoid potential name clashes (what if save/load are existing methods in some classes and you'd like to rename them all to cereal_load, cereal_save etc? Or CerealLoad, CerealSave, or cerealLoad, cerealSave etc.) |
I agree the define seems to make much more sense now. Do you want me to
|
Discussed this with @randvoorhies and we're fine with patching this in as |
Back from holiday now, so will have a patch ready soon. |
I've patched this up. Created a new file |
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.
This looks pretty good - I'm working on adding a new serialization method, load/save_minimal, and will pull this in when that is getting wrapped up. |
Going to push out 1.0 pretty soon - this and most of the other issues you've brought up will be part of 1.1. After 1.0 goes out I'm going to take a short break before addressing anything else. |
Thanks, good work on getting |
Merged into a new branch here: https://github.com/USCiLab/cereal/tree/mattyclarkson-capitalization. Haven't done minimal functions yet. Wondering if it is worth it to change the error messages to reference the defined names instead of our defaults. |
It would be a good touch, but if you are jumping in deep enough to be
|
We'll see - if it makes the code look cluttered, and it probably would, I'll probably just leave the messages as they are now, given the point you made. |
OK, up to you ;) Thanks for merging this into a working branch.
|
Also added some documentation to macros.hpp relates #60
Currently cereal searches for
serialize
,load
andsave
. If they could be made#define
s, the user of the library could specify the name of the functions that cereal should be looking for.This is because some styling guides require functions that are
Capitalized
and havingSerialize
,Load
,Save
would conform.How do you guys feel about this? Is this something that would be acceptable to create a pull request for?