Bag
0.9
|
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include "Bag.h"
#include "io_functions.h"
Go to the source code of this file.
Functions | |
int | getBagNum () |
void | processOption (char &c, Bag< string > bags[]) |
void | displayBag (Bag< string > &bag) |
void | restoreBag (Bag< string > &bag) |
void | saveBag (Bag< string > &bag) |
int | main () |
Bag Driver - use to test Bag class methods and functions that are independent from the Bag class. Bags 1 & 2 are used trough, bag 0 is extra for testing
Definition in file BagDriver.cpp.
void displayBag | ( | Bag< string > & | bag | ) |
Displays the entire content of the bag
[in] | bag | to display |
Definition at line 101 of file BagDriver.cpp.
References Bag< ItemType >::toVector().
Referenced by processOption().
int getBagNum | ( | ) |
Reads, validates, and returns a 1 or 2
Definition at line 85 of file BagDriver.cpp.
References getInt().
Referenced by main(), and processOption().
int main | ( | ) |
Bag Driver - use to test Bag class methods and bag functions that are independent from the Bag class.
Definition at line 42 of file BagDriver.cpp.
References getBagNum(), printMenu(), processOption(), and restoreBag().
void processOption | ( | char & | menuChar, |
Bag< string > | bag[] | ||
) |
Process input menu option character from user.
[in] | menuChar | menu option character |
[in,out] | bag | the bag to be modified |
Definition at line 126 of file BagDriver.cpp.
References displayBag(), getBagNum(), Bag< ItemType >::getCurrentSize(), getItem(), printMenu(), and saveBag().
Referenced by main().
void restoreBag | ( | Bag< string > & | bag | ) |
Restore the bag from a user specified file
inout] | bag restored from input file |
Definition at line 188 of file BagDriver.cpp.
References Bag< ItemType >::add(), and Bag< ItemType >::getCurrentSize().
Referenced by main().
void saveBag | ( | Bag< string > & | bag | ) |
Prompts the user for the filename to store the bag in.
[in] | bag | to be saved to a user specified file |
Definition at line 219 of file BagDriver.cpp.
Referenced by processOption().