You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
975 B
C
48 lines
975 B
C
#include "Emoji.h"
|
|
|
|
#include "json/json.h"
|
|
#include "json/layout.h"
|
|
|
|
#include "model/emoji.h"
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
|
|
#define OBJ_TYPE struct emoji
|
|
struct json_object_field api_Emoji_layout[] = {
|
|
JSON_FIELD_FIXED_STRING( category, "", false ),
|
|
JSON_FIELD_STRING( shortcode, true ),
|
|
JSON_FIELD_STRING( url, true ),
|
|
{
|
|
.key = "static_url",
|
|
.offset = offsetof( OBJ_TYPE, url ),
|
|
.type = &json_field_string,
|
|
},
|
|
JSON_FIELD_FIXED_BOOL( visible_in_picker, true ),
|
|
JSON_FIELD_END,
|
|
};
|
|
#undef OBJ_TYPE
|
|
|
|
void api_Emoji_write( struct emoji* e, FILE* f, int indent )
|
|
{
|
|
struct json_writer jw = {
|
|
.f = f,
|
|
.indentation = "\t",
|
|
.indent = indent,
|
|
};
|
|
|
|
if( !e ) {
|
|
fprintf( f, "null" );
|
|
return;
|
|
}
|
|
|
|
json_write_pretty_object_layout( &jw, api_Emoji_layout, e );
|
|
}
|
|
|
|
struct json_field_type api_Emoji_type = {
|
|
.reader = json_field_object_type_reader,
|
|
.writer = json_field_object_type_writer,
|
|
.size = sizeof(struct emoji*),
|
|
.layout = api_Emoji_layout,
|
|
};
|
|
|