Exemplo n.º 1
0
std::string toStringInfo(ObjectPtr obj) {
    ObjectPtr value = objectGet(obj, Symbols::get()["toString"]);
    if (value == nullptr) {
        return "";
    } else if (std::string* curr = boost::get<std::string>(&value->prim())) {
        return *curr;
    }
    return "";
}
inline bool objectEquals(const JsonObjectData* o1, const JsonObjectData* o2) {
  if (o1 == o2) return true;
  if (!o1 || !o2) return false;

  for (VariantSlot* s = o1->head; s; s = s->next) {
    JsonVariantData* v1 = &s->value;
    JsonVariantData* v2 = objectGet(o2, makeString(slotGetKey(s)));
    if (!variantEquals(v1, v2)) return false;
  }
  return true;
}
Exemplo n.º 3
0
std::ostream& operator <<(std::ostream& out, const DebugDetailObject& obj) {
    if (obj.impl == nullptr) {
        out << "nullptr";
        return out;
    }
    out << DebugObject{obj.impl} << std::endl;
    out << " Direct:" << std::endl;
    for (Symbolic key : obj.impl->directKeys()) {
        out << "  " << Symbols::get()[key] << ": "
            << DebugObject{ (*obj.impl)[key] } << std::endl;
    }
    out << " Indirect:" << std::endl;
    ObjectPtr parent = (*obj.impl)[Symbols::parent()];
    if ((parent != nullptr) && (parent != obj.impl)) {
        for (Symbolic key : keys(parent)) {
            out << "  " << Symbols::get()[key] << ": "
                << DebugObject{ objectGet(obj.impl, key) } << std::endl;
        }
    }
    return out;
}