diff options
author | 2023-05-21 22:10:21 +0600 | |
---|---|---|
committer | 2023-05-21 22:43:46 +0600 | |
commit | 5942f6125ea85bc78fc3df7b2f72b41260f4b4a2 (patch) | |
tree | 5311444a5a2ed63468ef0afb837303edba0ff08b /src/teams.h | |
download | c-obp-example-5942f6125ea85bc78fc3df7b2f72b41260f4b4a2.tar.gz c-obp-example-5942f6125ea85bc78fc3df7b2f72b41260f4b4a2.zip |
Initial commit
Signed-off-by: Mubashshir <ahmubashshir@gmail.com>
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__ */ |