42 namespace fs = std::filesystem;
Class that defines a "deck" of flashcards.
Definition: deck.h:113
void printDeck()
Prints flashcard deck information and then each card.
Definition: deck.cpp:85
void printDeckAsTemplate()
Prints flashcard deck name and then each card as template for a deck file.
Definition: deck.cpp:97
std::string name
Definition: deck.h:116
std::vector< FlashCard > cards
Definition: deck.h:120
std::filesystem::path filename
Definition: deck.h:118
This structure holds the information for each flashcard.
Definition: deck.h:72
void printCardAsTemplate()
Used to.
Definition: deck.cpp:68
std::string answer
Definition: deck.h:80
std::string stringCardAsTemplate()
Returns the card in template form as a string.
Definition: deck.cpp:75
CardDifficulty difficulty
Definition: deck.h:83
void printCard()
Prints the card question and answer.
Definition: deck.cpp:61
int n_times_answered
Definition: deck.h:86
std::string question
Definition: deck.h:77
bool writeFlashCardDeck(const FlashCardDeck &deck, std::filesystem::path filename)
Write a deck of flashcards to disk.
FlashCardDeck readFlashCardDeck(std::filesystem::path deck_file)
For a given deck file, read the contents in to create all the cards.
CardDifficulty strToCardDifficulty(const std::string &difficultyStr)
Converts a string into the CardDifficulty enum.
Definition: deck.cpp:15
std::vector< FlashCardDeck > loadFlashCardDecks(std::filesystem::path deck_dir_path)
Load the decks from files stored with the ".deck" extension inside decks/.
std::string cardDifficultyToStr(const CardDifficulty &difficulty)
Converts the card difficulty from enum to a string.
Definition: deck.cpp:35
std::filesystem::path createDeckFilename(std::filesystem::path deck_dir)
Prompt the user for name of the file to save the deckfile to.
Definition: deck.cpp:306
bool updateDeckFile(FlashCardDeck &deck_to_update)
Updates an existing FlashCardDeck on file.
Definition: deck.cpp:331
CardDifficulty
The possible difficulties for a flashcard.
Definition: deck.h:35
std::vector< FlashCardDeck > createExampleDecks()
Create example deck files.
Definition: deck.cpp:292
bool writeFlashCardDeckWithChecks(const FlashCardDeck &deck, std::filesystem::path filename, bool force_overwrite)
Write a deck of flashcards to disk.
Contains useful helper functions.