summaryrefslogtreecommitdiffstats
path: root/source/diagram/diagram_io.h
blob: b71eb0303755f73eee7a08222a38ad64da097972 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef DIAGRAM_IO_H
#define DIAGRAM_IO_H

// NOTE: four formats, zero external dependencies:
//   1. .dit      — binary tagged chunks, microsecond save/load
//   2. .dit.txt  — human-readable DSL, live in the Source view, git-diffable
//   3. .svg      — standalone vector SVG matching the active color scheme
//   4. :scan     — C/C++ struct/class/enum/header analyzer -> instant live diagram

internal b32     diagram_save_binary(Diagram *d, const char *path);
internal b32     diagram_load_binary(Diagram *d, const char *path);

internal String8 diagram_to_dsl(Arena *arena, Diagram *d);
internal b32     diagram_from_dsl(Diagram *d, String8 text);
internal b32     diagram_save_file(Diagram *d, const char *path);
internal b32     diagram_load_file(Diagram *d, const char *path);

internal b32     diagram_export_svg(Diagram *d, const char *path, const u32 *theme_colors);
internal u32     diagram_scan_cpp(Diagram *d, const char *path);

typedef struct DiagramTemplate DiagramTemplate;
struct DiagramTemplate {
	const char *name;
	const char *description;
};

internal u32                    diagram_template_count(void);
internal const DiagramTemplate *diagram_template_info(u32 index);
internal b32                    diagram_load_template(Diagram *d, const char *name);

#endif // DIAGRAM_IO_H