diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..6cecf1f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,27 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: CyB3RC0nN0R + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..28e971c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: CyB3RC0nN0R + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/README.md b/README.md index bd99476..8855408 100644 --- a/README.md +++ b/README.md @@ -12,42 +12,66 @@ Verweis auf die Bibliothek im Aufruferprojekt anlegen: > Haken bei "MenuLib" setzen. Zusätzliches Includeverzeichnis hinzufügen: -> Rechtsklick auf Aufruferprojekt -> Eigenschaften -> Linked -> Eingabe -> Zusätzliche Abhängigkeiten -> Bearbeiten... +> Rechtsklick auf Aufruferprojekt -> Eigenschaften -> C/C++ -> Allgemein -> Zusätzliche Includeverzeichnisse -> Bearbeiten... + > Ordner, der "menu.h" enthält, auswählen +> Diese Einstellung muss für die Konfiguration erfolgen, die später compiliert werden soll. + Headerdatei einbinden: > Zeile ```#include "menu.h"``` zur Quelldatei hinzufügen ### Anwendungsbeispiel ```C struct MenuItem items[] = { - {"Euklidscher Algorithmus", '1', (void*)&euklid}, // String = Name des Menüpunktes - {"Gerstenkorn", '2', (void*)&gerste}, // Char = Taste zum Aufrufen - {"Osterdatum ausrechnen", '3', (void*)&ostern}, // (void*)&MethodenName = Methode, die aufgerufen wird - {"ASCII Tabelle", '4', (void*)&ascii}, // Methode MUSS nicht vom Typ void sein! - {"DB-Pruefziffer", '5', (void*)&db}, // (void*)& MUSS immer davor stehen! + {"Euklidscher Algorithmus", '1', (void*)&euklid}, // String = Name des Menüpunktes + {"Gerstenkorn", '2', (void*)&gerste}, // Char = Taste zum Aufrufen + {"Osterdatum ausrechnen", '3', (void*)&ostern}, // (void*)&MethodenName = Methode, die aufgerufen wird + {"ASCII Tabelle", '4', (void*)&ascii}, // Methode MUSS nicht vom Typ void sein! + {"DB-Pruefziffer", '5', (void*)&db}, // (void*)& MUSS immer davor stehen! {"Modulo 11", '6', (void*)&mod11}, - {"BLANK", NULL, (void*)NULL}, // Fügt einen leere Zeile hinzu -> Gliederung - {"Namen TEST", 'a', (void*)&namen}, - {"Strings", 'b', (void*)&strHeader}, - {"BLANK", NULL, (void*)NULL}, - {"Exit", 'q', (void*)&exit} // exit beendet das Programm + {"BLANK", NULL, (void*)NULL}, // Fügt einen leere Zeile hinzu -> Gliederung + {"Namen TEST", '7', (void*)&namen}, + {"BLANK", NULL, (void*)NULL}, + {"Exit", 'q', (void*)&exit} // exit beendet das Programm }; -show_menu(sizeof(items) / sizeof(struct MenuItem), items, "Vorlesungsaufgaben", true, true, &NO_BORDER); + +struct MenuItem stringsEX[] = { + {"strcat()", '1', (void*)&strcatEx}, + {"strlen()", '2', (void*)&strlenEx}, + {"strncpy()", '3', (void*)&strncpyEx}, + {"strchr()", '4', (void*)&strchrEx}, + {"strstr()", '5', (void*)&strstrEx}, + {"strtok()", '6', (void*)&strtokEx}, + {"BLANK", NULL, (void*)NULL}, + {"Ersetzen", '7', (void*)&replace} +}; + +struct MenuPage pages[] = { + {items, sizeof(items) / sizeof(struct MenuItem), "Vorlesungsaufgaben", true, true, &SOLID}, + {stringsEX, sizeof(stringsEX) / sizeof(struct MenuItem), "String - Beispiele", true, true, &SOLID} + /* + * 1. Argument: Vorher angelegtes struct; Enthält alle Items der Seite + * 2. Argument: Anzahl der Elemente der Seite; Einfach so lassen + * 3. Argument: Titel der Seite + * 4. Argument: Menü im Loop; Nach beenden der Methode wieder Menü aufrufen + * 5. Argument: Pause nach dem Ausführen der Methode; Ausgaben lesbar + * 6. Argument: Style des Menüs: Standardmäßig wird DEFAULT, MODERN, SOLID und NO_BORDER unterstützt + */ +}; +page(pages, sizeof(pages) / sizeof(struct MenuPage), true); + /* - * 1. Argument: Anzahl der Elemente; Einfach so lassen - * 2. Argument: Vorher angelegtes struct; Einfach so lassen - * 3. Argument: Titel des Menüs - * 4. Argument: Menü im loop; Nach beenden der Methode wieder Menü aufrufen - * 5. Argument: Pause nach dem Ausführen der Methode; Ausgaben lesbar - * 6. Argument: Style des Menüs: Standardmäßig wird DEFAULT, MODERN, SOLID und NO_BORDER unterstützt + * 1. Argument: Vorher angelegtes struct; Enthält alle Seiten des Menüs + * 2. Argument: Anzahl der Seiten; Einfach so lassen + * 3. Argument: Gesamtes Menü in einer unendlich-Schleife */ - ```` -### Style hinzufügen -Eigene Styles können wie folgt hinzugefügt werden: +``` +### Border hinzufügen +Eigene Border-Styles können wie folgt hinzugefügt werden: ```C -const struct MenuBoder NAME = { +const struct MenuBorder NAME = { 'a', // Char für den rechten und linken Rand 'b', // Char für den oberen und unteren Rand 'c', // Char für die linke obere Ecke @@ -59,4 +83,4 @@ const struct MenuBoder NAME = { } ``` -Neue Styles am Besten direkt unter den #include Anweisungen einfügen. Der neue Style kann über den angegebenen Namen verwendet werden. +Neue Border am Besten direkt unter den ```#include``` Anweisungen einfügen. Die neue Border kann über den angegebenen Namen, wie im obigen Beispiel erläutert, verwendet werden. diff --git a/menu.h b/menu.h index a718c6d..496f55f 100644 --- a/menu.h +++ b/menu.h @@ -2,7 +2,6 @@ #include "pch.h" - /// Represents one menu item in a menu. struct MenuItem { char* text; @@ -22,10 +21,10 @@ struct MenuBorder { char title_right; }; +// Default borders initialized in menu.c const extern struct MenuBorder DEFAULT, MODERN, NO_BORDER, SOLID; - -/// Represents a page in the menu. +/// Represents a page containing menu items inside a menu. struct MenuPage { const struct MenuItem* items; const size_t item_count; @@ -34,16 +33,8 @@ struct MenuPage { const struct MenuBorder* border; }; - -/// Constructs a menu with a specific amount of pages +/// Constructs a CUI menu with a specific amount of pages. /// An array of all pages to display. /// The length of the array pages. /// Always display the first page after a loopback=false item finished executing. void show_menu(const struct MenuPage* pages, const size_t page_count, const bool infinite_loop); - -/// Displaces a CUI menu to the user -/// The length of the array itemv of menu items. -/// An array of all menu items to display in the menu. -/// The title of the menu. -/// Specifies the border in which the menu is displayed. -void show_menu(const struct MenuPage* pages, const size_t page_count, const bool infinite_loop);