Bag
0.91
|
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include "ArrayBag.h"
#include "io_functions.h"
Go to the source code of this file.
Functions | |
int | getBagNum () |
void | processOption (char &c, ArrayBag< string > bags[]) |
void | displayBag (ArrayBag< string > &bag) |
void | restoreBag (ArrayBag< string > &bag) |
void | saveBag (ArrayBag< 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 troughout, bag 0 is extra for testing
Definition in file BagDriver.cpp.
void displayBag | ( | ArrayBag< string > & | bag | ) |
Displays the entire content of the bag
[in] | bag | to display |
Definition at line 101 of file BagDriver.cpp.
References ArrayBag< 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, |
ArrayBag< 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(), ArrayBag< ItemType >::getCurrentSize(), getItem(), printMenu(), and saveBag().
Referenced by main().
void restoreBag | ( | ArrayBag< string > & | bag | ) |
Restore the bag from a user specified file
[in,out] | bag | restored from input file |
Definition at line 188 of file BagDriver.cpp.
References ArrayBag< ItemType >::add(), and ArrayBag< ItemType >::getCurrentSize().
Referenced by main().
void saveBag | ( | ArrayBag< 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().