static HostSpec parseHostSpec( JSON::Entity const &entity ) { HostSpec result; if ( entity.isString() ) result.push_back( entity.stringToStdString() ); else if ( entity.isArray() ) { JSON::ArrayDecoder arrayDecoder( entity ); JSON::Entity elementEntity; while ( arrayDecoder.getNext( elementEntity ) ) { try { elementEntity.requireString(); result.push_back( elementEntity.stringToStdString() ); } catch ( Exception e ) { arrayDecoder.rethrow( e ); } } } else throw Exception( "must be a string or an array" ); return result; }
void ResourceLoadNode::jsonExecCreate( JSON::Entity const &arg, RC::Handle<Context> const &context, JSON::ArrayEncoder &resultArrayEncoder ) { arg.requireString(); Create( arg.stringToStdString(), context ); }
void parseMethods( JSON::Entity const &methodsArray, std::vector<std::string> &methods ) { JSON::ArrayDecoder methodArrayDecoder( methodsArray ); JSON::Entity methodEntity; while ( methodArrayDecoder.getNext( methodEntity ) ) { try { methodEntity.requireString(); methods.push_back( methodEntity.stringToStdString() ); } catch ( Exception e ) { methodArrayDecoder.rethrow( e ); } } }
void StringImpl::decodeJSON( JSON::Entity const &entity, void *dst ) const { entity.requireString(); entity.stringGetData( GetMutableValueData( dst, entity.stringLength() ) ); }