-
Notifications
You must be signed in to change notification settings - Fork 780
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
Allow no indentation output of JSON and XML #64
Comments
I'm happy to help with patches/pull request for this. |
I have no problem with this if it is added as a parameter to the constructors of these archives. I assume that both rapidxml and rapidjson can parse either format without being told it has no indentation, right? If you look into this, are there any other parameters for these libraries worth exposing? |
JSONOutputArchive(std::ostream & stream, int precision = 20)
XMLOutputArchive(std::ostream & stream, size_t precision = 20, bool outputType = false ) to enum Flags { // Not sure of your style for enums.
no_flags ///< No special modifiers for the output archive
}
JSONOutputArchive(std::ostream & stream, int precision = 20, size_t indentation = 4, int flags = no_flags)
enum class Flags { // Not sure of your style for enums.
none, ///< No special modifiers for the output archive
addType ///< Adds the object typename to the XML node
}
XMLOutputArchive(std::ostream & stream, int precision = 20, size_t indentation = 4, int flags = no_flags) This breaks the API though 👎 but makes it consistent 👍 |
We're already making some breaking changes for 1.0 so this isn't an issue. |
Hit some pretty bad timing with suggesting this - I'm about to go skiing for two weeks. Might not have a pull request ready until after that, sorry. 😒 |
Debating a few ways of implementing this, all of which come down to pointless style differences. The method I am favoring right now would make the constructors look something like:
Where Ultimately I expect few users to use these options so I want a solution that is as clean as possible without bloating up the code too much. |
Done done done. |
Cool, thanks for implementing this 😄 |
rapidxml
andrapidjson
both support output without any indentation which can save valuable bytes if sending the JSON or XML over the network. It would be create if the XML and JSON archives could support output with no indentation.The text was updated successfully, but these errors were encountered: