object node::search_namespace_by_prefix(value const &prefix_) { local_root_scope scope; xmlChar const *prefix = 0; if (!prefix_.is_string() && !prefix_.is_undefined() && !prefix_.is_null()) throw exception("Could not search for non-string namespace prefix"); if (prefix_.is_string()) prefix = (xmlChar const *) prefix_.get_string().c_str(); xmlNsPtr ns = xmlSearchNs(ptr->doc, ptr, prefix); return namespace_::create(ns); }
virtual TPointer create(const extraction_context& context, const value& from) const override { using std::begin; using std::end; if (_check_null_input && from.is_null()) return TPointer(); auto iter = std::find_if(begin(_subtype_ctors), end(_subtype_ctors), [&] (const std::pair<match_predicate, create_function>& pair) { return pair.first(context, from); } ); if (iter != end(_subtype_ctors)) return iter->second(context, from); else throw extraction_error(context, std::string("No discriminators matched JSON value: ") + to_string(from) ); }
boost::optional<T> perform(value const &v) { if (v.is_undefined() || v.is_null()) return boost::optional<T>(); return base.perform(v); }