Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Work on settings properties on nodes from UI
- Loading branch information
Showing
12 changed files
with
218 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| #include "prop.h" | ||
|
|
||
| #if 0 | ||
| /** | ||
| * | ||
| */ | ||
| void | ||
| prop_write_values(void *ptr, const property_t p[], htsmsg_t *m) | ||
| { | ||
| int i = 0; | ||
| for(;p[i].id; i++) { | ||
| switch(p[i].type) { | ||
| case PT_BOOL: | ||
| htsmsg_add_bool(m, p[i].id, *(int *)(ptr + p[i].off)); | ||
| break; | ||
| case PT_INT: | ||
| htsmsg_add_s32(m, p[i].id, *(int *)(ptr + p[i].off)); | ||
| break; | ||
| case PT_STR: | ||
| htsmsg_add_str(m, p[i].id, (const char *)(ptr + p[i].off)); | ||
| break; | ||
| } | ||
| } | ||
| } | ||
| #endif | ||
|
|
||
|
|
||
| /** | ||
| * | ||
| */ | ||
| void | ||
| prop_read_values(void *ptr, const property_t p[], htsmsg_t *m) | ||
| { | ||
| int i = 0; | ||
| for(;p[i].id; i++) { | ||
| switch(p[i].type) { | ||
| case PT_BOOL: | ||
| htsmsg_add_bool(m, p[i].id, *(int *)(ptr + p[i].off)); | ||
| break; | ||
| case PT_INT: | ||
| htsmsg_add_s32(m, p[i].id, *(int *)(ptr + p[i].off)); | ||
| break; | ||
| case PT_STR: | ||
| htsmsg_add_str(m, p[i].id, (const char *)(ptr + p[i].off)); | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * | ||
| */ | ||
| htsmsg_t * | ||
| prop_get_values(void *ptr, const property_t p[]) | ||
| { | ||
| htsmsg_t *m = htsmsg_create_map(); | ||
| prop_read_values(ptr, p, m); | ||
| return m; | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * | ||
| */ | ||
| void | ||
| prop_read_names(const property_t p[], htsmsg_t *m) | ||
| { | ||
| int i = 0; | ||
| for(;p[i].name; i++) | ||
| htsmsg_add_str(m, p[i].id, p[i].name); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * | ||
| */ | ||
| htsmsg_t * | ||
| prop_get_names(const property_t p[]) | ||
| { | ||
| htsmsg_t *m = htsmsg_create_map(); | ||
| prop_read_names(p, m); | ||
| return m; | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #pragma once | ||
| #include <stddef.h> | ||
|
|
||
| #include "htsmsg.h" | ||
|
|
||
| typedef enum { | ||
| PT_BOOL, | ||
| PT_INT, | ||
| PT_STR, | ||
| } prop_type_t; | ||
|
|
||
| typedef struct property { | ||
| const char *id; | ||
| const char *name; | ||
| prop_type_t type; | ||
| size_t off; | ||
| } property_t; | ||
|
|
||
|
|
||
|
|
||
| void prop_read_values(void *ptr, const property_t p[], htsmsg_t *m); | ||
| htsmsg_t *prop_get_values(void *ptr, const property_t p[]); | ||
| void prop_read_names(const property_t p[], htsmsg_t *m); | ||
| htsmsg_t *prop_get_names(const property_t p[]); |
Oops, something went wrong.