diff options
Diffstat (limited to 'src/teams.h')
-rw-r--r-- | src/teams.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/teams.h b/src/teams.h new file mode 100644 index 0000000..5672fda --- /dev/null +++ b/src/teams.h @@ -0,0 +1,37 @@ +#ifndef __TEAMS_H__ +# define __TEAMS_H__ +# include <stdint.h> +# include <stdbool.h> +# define GETTER(type, field, ...) type team_get_##field(TEAM team, ## __VA_ARGS__) +# define SETTER(type, field, ...) bool team_set_##field(TEAM team, ## __VA_ARGS__, type field) +# define team_get(team, field, ...) team_get_##field(team, ## __VA_ARGS__) +# define team_set(team, field, ...) team_set_##field(team, ## __VA_ARGS__) +// Type definition +typedef struct team_impl_struct * TEAM; + +// base functions +TEAM team_new(); +void team_del(TEAM team); + +// field getters +SETTER(char *, name); +SETTER(char *, institution); +SETTER(char *, member_name, int); +SETTER(uint8_t, solved); + +// field setters +GETTER(char *, name); +GETTER(char *, member_name, int); +GETTER(char *, institution); +GETTER(uint8_t, solved); + +// helper functions +int team_printf(TEAM); +int team_fprintf(FILE *, TEAM); +TEAM team_find_champion(TEAM teams[], unsigned num); + +# ifndef __IMPL_TEAMS_INTERNAL +# undef GETTER +# undef SETTER +# endif +#endif /* __TEAMS_H__ */ |