summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-05-26 18:19:20 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-05-26 18:19:20 +0200
commit7dcbdef56dbece79e384823e5452c647f460b006 (patch)
treea2cadca1f3c3eb20e0aa583001212adc123d2773
parentdb1b637faea4dfc2c1acd06f282f26a5d88bdcae (diff)
eolian: add API to query unit version
-rw-r--r--src/lib/eolian/Eolian.h12
-rw-r--r--src/lib/eolian/eolian_database.c7
2 files changed, 19 insertions, 0 deletions
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index e9a9db971d..fdda984aef 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -990,6 +990,18 @@ EAPI const char *eolian_unit_file_get(const Eolian_Unit *unit);
990EAPI const char *eolian_unit_file_path_get(const Eolian_Unit *unit); 990EAPI const char *eolian_unit_file_path_get(const Eolian_Unit *unit);
991 991
992/* 992/*
993 * @brief Get the version of the unit.
994 *
995 * This is 1 by default, unless overridden. Returns 0 when an invalid
996 * unit is passed.
997 *
998 * @param[in] unit The unit.
999 *
1000 * @ingroup Eolian
1001 */
1002EAPI unsigned short eolian_unit_version_get(const Eolian_Unit *unit);
1003
1004/*
993 * @brief Get an object in a unit by name. 1005 * @brief Get an object in a unit by name.
994 * 1006 *
995 * Only objects declared directly within the file can be retrieved, i.e. 1007 * Only objects declared directly within the file can be retrieved, i.e.
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index 0fb5a134f6..40b0ca156f 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -1303,6 +1303,13 @@ eolian_unit_file_path_get(const Eolian_Unit *unit)
1303 : unit->state->filenames_eot, unit->file); 1303 : unit->state->filenames_eot, unit->file);
1304} 1304}
1305 1305
1306EAPI unsigned short
1307eolian_unit_version_get(const Eolian_Unit *unit)
1308{
1309 if (!unit) return 0;
1310 return unit->version;
1311}
1312
1306EAPI const Eolian_Object * 1313EAPI const Eolian_Object *
1307eolian_unit_object_by_name_get(const Eolian_Unit *unit, const char *name) 1314eolian_unit_object_by_name_get(const Eolian_Unit *unit, const char *name)
1308{ 1315{