mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-20 03:35:41 +02:00
tag: rename tag.value() -> tag.as_string()
This commit is contained in:
parent
12e9304612
commit
44a2dbb201
3 changed files with 10 additions and 10 deletions
|
@ -146,7 +146,7 @@ instantiate(const struct particle *particle, const struct tag_set *tags)
|
||||||
sbuf_strncat(&formatted, src, begin - src);
|
sbuf_strncat(&formatted, src, begin - src);
|
||||||
|
|
||||||
/* Copy tag value */
|
/* Copy tag value */
|
||||||
const char *value = tag->value(tag);
|
const char *value = tag->as_string(tag);
|
||||||
sbuf_strcat(&formatted, value);
|
sbuf_strcat(&formatted, value);
|
||||||
|
|
||||||
/* Skip past tag name + closing '}' */
|
/* Skip past tag name + closing '}' */
|
||||||
|
|
16
tag.c
16
tag.c
|
@ -38,7 +38,7 @@ destroy_string(struct tag *tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
value_int(const struct tag *tag)
|
int_as_string(const struct tag *tag)
|
||||||
{
|
{
|
||||||
static char as_string[128];
|
static char as_string[128];
|
||||||
const struct private *priv = tag->private;
|
const struct private *priv = tag->private;
|
||||||
|
@ -48,14 +48,14 @@ value_int(const struct tag *tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
value_bool(const struct tag *tag)
|
bool_as_string(const struct tag *tag)
|
||||||
{
|
{
|
||||||
const struct private *priv = tag->private;
|
const struct private *priv = tag->private;
|
||||||
return priv->value_as_bool ? "true" : "false";
|
return priv->value_as_bool ? "true" : "false";
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
value_float(const struct tag *tag)
|
float_as_string(const struct tag *tag)
|
||||||
{
|
{
|
||||||
static char as_string[128];
|
static char as_string[128];
|
||||||
const struct private *priv = tag->private;
|
const struct private *priv = tag->private;
|
||||||
|
@ -65,7 +65,7 @@ value_float(const struct tag *tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
value_string(const struct tag *tag)
|
string_as_string(const struct tag *tag)
|
||||||
{
|
{
|
||||||
const struct private *priv = tag->private;
|
const struct private *priv = tag->private;
|
||||||
return priv->value_as_string;
|
return priv->value_as_string;
|
||||||
|
@ -82,7 +82,7 @@ tag_new_int(const char *name, long value)
|
||||||
tag->private = priv;
|
tag->private = priv;
|
||||||
tag->destroy = &destroy_int_and_float;
|
tag->destroy = &destroy_int_and_float;
|
||||||
tag->name = &tag_name;
|
tag->name = &tag_name;
|
||||||
tag->value = &value_int;
|
tag->as_string = &int_as_string;
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ tag_new_bool(const char *name, bool value)
|
||||||
tag->private = priv;
|
tag->private = priv;
|
||||||
tag->destroy = &destroy_int_and_float;
|
tag->destroy = &destroy_int_and_float;
|
||||||
tag->name = &tag_name;
|
tag->name = &tag_name;
|
||||||
tag->value = &value_bool;
|
tag->as_string = &bool_as_string;
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ tag_new_float(const char *name, double value)
|
||||||
tag->private = priv;
|
tag->private = priv;
|
||||||
tag->destroy = &destroy_int_and_float;
|
tag->destroy = &destroy_int_and_float;
|
||||||
tag->name = &tag_name;
|
tag->name = &tag_name;
|
||||||
tag->value = &value_float;
|
tag->as_string = &float_as_string;
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ tag_new_string(const char *name, const char *value)
|
||||||
tag->private = priv;
|
tag->private = priv;
|
||||||
tag->destroy = &destroy_string;
|
tag->destroy = &destroy_string;
|
||||||
tag->name = &tag_name;
|
tag->name = &tag_name;
|
||||||
tag->value = &value_string;
|
tag->as_string = &string_as_string;
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
tag.h
2
tag.h
|
@ -9,7 +9,7 @@ struct tag {
|
||||||
|
|
||||||
void (*destroy)(struct tag *tag);
|
void (*destroy)(struct tag *tag);
|
||||||
const char *(*name)(const struct tag *tag);
|
const char *(*name)(const struct tag *tag);
|
||||||
const char *(*value)(const struct tag *tag);
|
const char *(*as_string)(const struct tag *tag);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tag_set {
|
struct tag_set {
|
||||||
|
|
Loading…
Add table
Reference in a new issue