mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-04 01:15:41 +02:00
JSON can be written to either a FILE or a string
This commit is contained in:
+11
-1
@@ -18,7 +18,8 @@ struct json_writer {
|
||||
std::vector<json_write_tok> state;
|
||||
bool nospace = false;
|
||||
bool wantnl = false;
|
||||
FILE *f;
|
||||
FILE *f = NULL;
|
||||
std::string *s = NULL;
|
||||
|
||||
~json_writer() {
|
||||
if (state.size() > 0) {
|
||||
@@ -33,6 +34,10 @@ struct json_writer {
|
||||
f = fp;
|
||||
}
|
||||
|
||||
json_writer(std::string *out) {
|
||||
s = out;
|
||||
}
|
||||
|
||||
void json_write_array();
|
||||
void json_end_array();
|
||||
void json_write_hash();
|
||||
@@ -47,7 +52,12 @@ struct json_writer {
|
||||
void json_write_null();
|
||||
void json_write_newline();
|
||||
void json_comma_newline();
|
||||
|
||||
private:
|
||||
void json_adjust();
|
||||
void aprintf(const char *format, ...);
|
||||
void addc(char c);
|
||||
void adds(std::string const &s);
|
||||
};
|
||||
|
||||
void layer_to_geojson(mvt_layer const &layer, unsigned z, unsigned x, unsigned y, bool comma, bool name, bool zoom, bool dropped, unsigned long long index, long long sequence, long long extent, bool complain, json_writer &state);
|
||||
|
||||
Reference in New Issue
Block a user