namespace dc {
-class deserializer_impl
+class deserializer::deserializer_impl
{
public:
deserializer_impl(const std::string& filePath, bool comments = false,
void throwError()
{
unsigned char* errorMsg = yajl_get_error(hand, 0, 0, 0);
- deserializer::parser_error error((char*)errorMsg);
+ deserializer::exception problem((char*)errorMsg);
yajl_free_error(hand, errorMsg);
- throw error;
+ throw problem;
}
static int parsedBeginMap(void* ctx)
{
((deserializer_impl*)ctx)->parsed.push(new wrapped_dictionary);
+ return 1;
}
static int parsedMapKey(void* ctx, const unsigned char* value,
unsigned length)
{
+ // same thing as a string
return parsedString(ctx, value, length);
}
private:
void init(std::istream& input, bool deleteIn, bool comments, bool check)
{
- const yajl_callbacks callbacks =
+ // this has to be static because yajl actually does not copy it into its
+ // internal data structures but rather keeps a pointer to this
+ static const yajl_callbacks callbacks =
{
deserializer_impl::parsedNull,
deserializer_impl::parsedBoolean,
deserializer::deserializer(const std::string& filePath, bool comments,
- bool check) : impl(new deserializer_impl(filePath, comments, check)) {}
+ bool check) :
+ // pass through
+ impl(new deserializer::deserializer_impl(filePath, comments, check)) {}
deserializer::deserializer(std::istream& input, bool comments, bool check) :
- impl(new deserializer_impl(input, comments, check)) {}
+ // pass through
+ impl(new deserializer::deserializer_impl(input, comments, check)) {}
serializable_ptr deserializer::deserialize()
void deserializer::pop()
{
+ // pass through
impl->parsed.pop();
}
} // namespace dc
+/** vim: set ts=4 sw=4 tw=80: *************************************************/
+