From 4333cd2b11cc32fe75fa1ef31627c667bcc71327 Mon Sep 17 00:00:00 2001 From: Louie S Date: Thu, 29 Jun 2023 17:55:31 -0700 Subject: entry boilerplate --- src/Makefile.am | 2 +- src/Makefile.in | 15 ++++++++++----- src/entry.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/entry.h | 25 +++++++++++++++++++++++++ 4 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 src/entry.c create mode 100644 src/entry.h diff --git a/src/Makefile.am b/src/Makefile.am index a9a6138..cbf841f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,2 +1,2 @@ bin_PROGRAMS = assignment-list-tui -assignment_list_tui_SOURCES = main.c group.c group.h +assignment_list_tui_SOURCES = main.c entry.c entry.h group.c group.h diff --git a/src/Makefile.in b/src/Makefile.in index e428f31..ec350d5 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -99,7 +99,8 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) -am_assignment_list_tui_OBJECTS = main.$(OBJEXT) group.$(OBJEXT) +am_assignment_list_tui_OBJECTS = main.$(OBJEXT) entry.$(OBJEXT) \ + group.$(OBJEXT) assignment_list_tui_OBJECTS = $(am_assignment_list_tui_OBJECTS) assignment_list_tui_LDADD = $(LDADD) AM_V_P = $(am__v_P_@AM_V@) @@ -117,7 +118,8 @@ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles -am__depfiles_remade = ./$(DEPDIR)/group.Po ./$(DEPDIR)/main.Po +am__depfiles_remade = ./$(DEPDIR)/entry.Po ./$(DEPDIR)/group.Po \ + ./$(DEPDIR)/main.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -245,7 +247,7 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -assignment_list_tui_SOURCES = main.c group.c group.h +assignment_list_tui_SOURCES = main.c entry.c entry.h group.c group.h all: all-am .SUFFIXES: @@ -332,6 +334,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/entry.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/group.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ # am--include-marker @@ -481,7 +484,8 @@ clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am - -rm -f ./$(DEPDIR)/group.Po + -rm -f ./$(DEPDIR)/entry.Po + -rm -f ./$(DEPDIR)/group.Po -rm -f ./$(DEPDIR)/main.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ @@ -528,7 +532,8 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -f ./$(DEPDIR)/group.Po + -rm -f ./$(DEPDIR)/entry.Po + -rm -f ./$(DEPDIR)/group.Po -rm -f ./$(DEPDIR)/main.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic diff --git a/src/entry.c b/src/entry.c new file mode 100644 index 0000000..086db8c --- /dev/null +++ b/src/entry.c @@ -0,0 +1,46 @@ +#include + +#include "entry.h" + +// getters +char *entry_get_alt_due_date(Entry *e) { + return e->alt_due_date; +} + +char *entry_get_title(Entry *e) { + return e->title; +} + +char *entry_get_color(Entry *e) { + return e->color; +} + +char *entry_get_highlight(Entry *e) { + return e->highlight; +} + +char *entry_get_url(Entry *e) { + return e->url; +} + + +// setters +void entry_set_alt_due_date(Entry *e, char *alt_due_date) { + strcpy(e->alt_due_date, alt_due_date); +} + +void entry_set_title(Entry *e, char *title) { + strcpy(e->title, title); +} + +void entry_set_color(Entry *e, char *color) { + strcpy(e->color, color); +} + +void entry_set_highlight(Entry *e, char *highlight) { + strcpy(e->highlight, highlight); +} + +void entry_set_url(Entry *e, char *url) { + strcpy(e->url, url); +} diff --git a/src/entry.h b/src/entry.h new file mode 100644 index 0000000..eb3d88e --- /dev/null +++ b/src/entry.h @@ -0,0 +1,25 @@ +#include "../config.h" + +// a group/category for entries to be put in +typedef struct { + //TODO due_date + char alt_due_date[BUF_LEN]; + char title[BUF_LEN]; + char color[BUF_LEN]; // TODO consider making an enum + char highlight[BUF_LEN]; // TODO consider making an enum + char url[BUF_LEN]; +} Entry; + +// getters +char *entry_get_alt_due_date(Entry *e); +char *entry_get_title(Entry *e); +char *entry_get_color(Entry *e); +char *entry_get_highlight(Entry *e); +char *entry_get_url(Entry *e); + +// setters +void entry_set_alt_due_date(Entry *e, char *alt_due_date); +void entry_set_title(Entry *e, char *title); +void entry_set_color(Entry *e, char *color); +void entry_set_highlight(Entry *e, char *highlight); +void entry_set_url(Entry *e, char *url); -- cgit