diff options
author | Thomas White <taw@bitwiz.me.uk> | 2019-04-26 22:26:05 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.me.uk> | 2019-04-26 22:26:05 +0200 |
commit | 18a7cd2f8adb5fd03750e10cb397805f29ed9417 (patch) | |
tree | bf53ad0d4d31077640ba07cf4ec609757dd40ec4 /libstorycode/stylesheet.c | |
parent | 823d0b3160d95b02b5f2d886dd576f0f5e0293d5 (diff) |
Add API for getting style tree
Diffstat (limited to 'libstorycode/stylesheet.c')
-rw-r--r-- | libstorycode/stylesheet.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libstorycode/stylesheet.c b/libstorycode/stylesheet.c index f3fd7e6..f625b19 100644 --- a/libstorycode/stylesheet.c +++ b/libstorycode/stylesheet.c @@ -543,3 +543,20 @@ char *stylesheet_serialise(Stylesheet *s) return text; } + + +int stylesheet_get_num_substyles(Stylesheet *s, const char *stn) +{ + struct style *sty = lookup_style(&s->top, stn); + if ( sty == NULL ) return 0; + return sty->n_substyles; +} + + +const char *stylesheet_get_substyle_name(Stylesheet *s, const char *stn, int i) +{ + struct style *sty = lookup_style(&s->top, stn); + if ( sty == NULL ) return NULL; + if ( i >= sty->n_substyles ) return NULL; + return sty->substyles[i].name; +} |