common: implement ident and selector manipulation
This commit is contained in:
23
common/include/ivy/ident.h
Normal file
23
common/include/ivy/ident.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef IVY_IDENT_H_
|
||||
#define IVY_IDENT_H_
|
||||
|
||||
#include <blue/core/queue.h>
|
||||
#include <ivy/misc.h>
|
||||
#include <stddef.h>
|
||||
|
||||
struct ivy_ident_part {
|
||||
char *p_str;
|
||||
b_queue_entry p_entry;
|
||||
};
|
||||
|
||||
struct ivy_ident {
|
||||
b_queue id_parts;
|
||||
};
|
||||
|
||||
IVY_API struct ivy_ident *ivy_ident_create(void);
|
||||
IVY_API void ivy_ident_destroy(struct ivy_ident *ident);
|
||||
|
||||
IVY_API void ivy_ident_add_part(struct ivy_ident *ident, const char *s);
|
||||
IVY_API size_t ivy_ident_to_string(const struct ivy_ident *ident, char *out, size_t max);
|
||||
|
||||
#endif
|
||||
@@ -2,6 +2,7 @@
|
||||
#define IVY_SELECTOR_H_
|
||||
|
||||
#include <ivy/status.h>
|
||||
#include <blue/core/queue.h>
|
||||
|
||||
enum ivy_selector_recipient {
|
||||
IVY_SEL_NONE = 0,
|
||||
@@ -9,15 +10,25 @@ enum ivy_selector_recipient {
|
||||
IVY_SEL_OBJECT,
|
||||
};
|
||||
|
||||
struct ivy_selector;
|
||||
struct ivy_selector {
|
||||
enum ivy_selector_recipient sel_recipient;
|
||||
char *sel_name;
|
||||
b_queue sel_args;
|
||||
};
|
||||
|
||||
extern enum ivy_status ivy_selector_create(struct ivy_selector **sel);
|
||||
extern void ivy_selector_destroy(struct ivy_selector *sel);
|
||||
struct ivy_selector_arg {
|
||||
char *arg_label;
|
||||
char *arg_name;
|
||||
b_queue_entry arg_entry;
|
||||
};
|
||||
|
||||
extern void ivy_selector_set_recipient(
|
||||
IVY_API enum ivy_status ivy_selector_create(struct ivy_selector **sel);
|
||||
IVY_API void ivy_selector_destroy(struct ivy_selector *sel);
|
||||
|
||||
IVY_API void ivy_selector_set_recipient(
|
||||
struct ivy_selector *sel, enum ivy_selector_recipient r);
|
||||
extern void ivy_selector_set_name(struct ivy_selector *sel, const char *name);
|
||||
extern void ivy_selector_add_arg(
|
||||
IVY_API enum ivy_status ivy_selector_set_name(struct ivy_selector *sel, const char *name);
|
||||
IVY_API enum ivy_status ivy_selector_add_arg(
|
||||
struct ivy_selector *sel, const char *label, const char *name);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user