adds documentation
This commit is contained in:
parent
fb443c4310
commit
42f2db6295
@ -12,8 +12,7 @@
|
|||||||
#define BOOK_FILENAME "books.csv"
|
#define BOOK_FILENAME "books.csv"
|
||||||
|
|
||||||
std::string book_vec_to_json(std::vector<std::string> headers, std::vector<std::string> book)
|
std::string book_vec_to_json(std::vector<std::string> headers, std::vector<std::string> book)
|
||||||
{
|
{ int i;
|
||||||
int i;
|
|
||||||
std::string out = "{";
|
std::string out = "{";
|
||||||
|
|
||||||
for (i = 0; i < book.size(); i++) {
|
for (i = 0; i < book.size(); i++) {
|
||||||
@ -56,14 +55,13 @@ std::string get_all_books()
|
|||||||
return total_lines + "}";
|
return total_lines + "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string remove_book(int id)
|
std::string remove_book(std::string id)
|
||||||
{
|
{
|
||||||
enum ISBN_EXIT_CODE exec_code;
|
enum ISBN_EXIT_CODE exec_code;
|
||||||
std::string program_name = "./isbn";
|
std::string program_name = "./isbn";
|
||||||
std::string remove = "remove";
|
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) {
|
switch (exec_code) {
|
||||||
case FORK_FAILED:
|
case FORK_FAILED:
|
||||||
|
@ -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 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 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[]);
|
enum ISBN_EXIT_CODE run_isbn_program(char* args[]);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user