adds documentation

This commit is contained in:
SuperNovaa41 2024-01-24 18:40:48 -05:00
parent fb443c4310
commit 42f2db6295
2 changed files with 23 additions and 5 deletions

View File

@ -12,8 +12,7 @@
#define BOOK_FILENAME "books.csv"
std::string book_vec_to_json(std::vector<std::string> headers, std::vector<std::string> book)
{
int i;
{ int i;
std::string out = "{";
for (i = 0; i < book.size(); i++) {
@ -56,14 +55,13 @@ std::string get_all_books()
return total_lines + "}";
}
std::string remove_book(int id)
std::string remove_book(std::string id)
{
enum ISBN_EXIT_CODE exec_code;
std::string program_name = "./isbn";
std::string remove = "remove";
std::string str_id = std::to_string(id);
char* args[] = {(char*) program_name.c_str(), (char*) remove.c_str(), (char*) str_id.c_str(), NULL};
char* args[] = {(char*) program_name.c_str(), (char*) remove.c_str(), (char*) id.c_str(), NULL};
switch (exec_code) {
case FORK_FAILED:

View File

@ -25,8 +25,28 @@ std::string book_vec_to_json(std::vector<std::string> headers, std::vector<std::
*/
std::string get_all_books();
/**
* std::string add_new_book
* std::string isbn - The isbn of the book
*
* Executes the ISBN program using the given ISBN to add a book
*/
std::string add_new_book(std::string isbn);
/**
* std::string remove_book
* std::string id - The book id to remove
*
* Executes the ISBN program using the given ID to remove a book
*/
std::string remove_book(std::string id);
/**
* enum ISBN_EXIT_CODE run_isbn_program
* char* args[] - The char* list of arguments to pass to execvp
*
* Executes the ISBN program with the given arguments, returns the proper exit code
*/
enum ISBN_EXIT_CODE run_isbn_program(char* args[]);