void print::operator()(object_t const &m) const { using namespace std; if(mode_) { if(depth_) (*os_) << "\n"; PRINT_SPACE(depth_, *os_); } (*os_) << "{"; if(mode_) (*os_) << "\n"; object_t::const_iterator i = m.begin(); object_t::const_iterator j = m.begin(); ++depth_; while(i != m.end()){ if(mode_) PRINT_SPACE(depth_, *os_); (*this)(i->first); (*os_) << " : "; boost::apply_visitor(*this, i->second); if(++i != m.end()) { (*os_) << ","; if(mode_) (*os_) << "\n"; } } depth_--; if(mode_) { (*os_) << "\n"; PRINT_SPACE(depth_, *os_); } (*os_) << "}"; if(mode_ && !depth_) (*os_) << "\n"; }
S32 LLSDJSONParser::parseObject( object_t obj, LLSD& data ) const { S32 object_count = 0; iterator_t iter = obj.begin(); const iterator_t end = obj.end(); // for( ; iter != end; ++iter ) { std::string name = iter->first; variant_t var = iter->second; // if( var->type() == typeid(std::string) ) { data[name] = boost::any_cast<std::string>(*var); object_count++; } else if( var->type() == typeid(bool) ) { data[name] = boost::any_cast<bool>(*var); object_count++; } else if( var->type() == typeid(int) ) { data[name] = boost::any_cast<int>(*var); object_count++; } else if( var->type() == typeid(double) ) { data[name] = boost::any_cast<double>(*var); object_count++; } else if( var->type() == typeid(object_t) ) { object_count += parseObject( boost::any_cast<object_t>(*var), data[name] ); } else { data[name] = "null"; object_count++; } } return object_count; }