#include #include #include #include #include using namespace std; /////////////////////////////////////////////////////////////////////////// // Function prototypes void print_instructions(); /////////////////////////////////////////////////////////////////////////// // Image class definition // - Images are records about pictures taken and contain a name and a // string of tags. class Image{ friend ostream &operator<<(ostream &, Image); friend istream &operator>>(istream&, Image &); public: // Default constructor Image(); // Constructor with initial values Image(string, string); // Name observer string get_name(); // Tags observer string get_tags(); //Accesor for the tags. My assumption is that the name is assigned // by the camera, so there won't be any changes made to that void set_tags(string); ~Image(); private: string image_name; string image_tags; }; // Default constructor Image::Image(){ // no need to do anything here, since the strings are empty to start with. } // Initializing Constructor Image::Image(string initial_name, string initial_tags){ // MAKE THIS WORK } // Return the image name string Image::get_name(){ // MAKE THIS WORK } // Return the tags string Image::get_tags(){ // MAKE THIS WORK } // Change the tags void Image::set_tags(string new_tags){ // MAKE THIS WORK } Image::~Image(){ // Nothing to do with the deconstructor this time } ostream &operator<<(ostream & output, Image i){ // MAKE THIS WORK }; istream &operator>>(istream& input, Image & i){ // MAKE THIS WORK }; // /////////////////////////////////////////////////////////////////////////// /* int main(){ // A small main program to test the image class // Create a new image Image test_image("DSCF0020","Bride, groom, close up"); // make sure the observers work cout << "Testing observers:" << endl; cout << "This should say DSCF0020: " << test_image.get_name() << endl; cout << "This should say 'Bride, groom, close up': " << test_image.get_tags() << endl; // make sure the accesor for the tags works: cout << "Testing accessors:" << endl; test_image.set_tags("Bride, groom, close up, pimple"); cout << "This should say 'Bride, groom, close up, pimple': " << test_image.get_tags() << endl; // make sure the friend functions work as well cout << "The next line should say 'DSCF0020 Bride, groom, close up, pimple':" << endl; cout << test_image << endl; // now test the input operator cout << "At the prompt, please type - D01 Bride, groom, family:" << endl; cin >> test_image; cout << "The next line should say 'D01 Bride, groom, family':" << endl; cout << test_image << endl; cout << test_image.get_tags() << endl; } */ /////////////////////////////////////////////////////////////////////////// // Photo Set class // - A photo set is a collection of images. Each set has a name, and a vector // of images in it. class Photo_set{ public: // Default constructor for empty photo set Photo_set(); // Method that loads the Image names and tags from a file void load_set(string source_file); // Show a numbered list of images void display_images(); // return a copy of one of the images in the set Image extract_image(int); // Add an image to the set void add_image(Image); // Return the number of images int number_of_images(); // Return the name of the set string get_name(); // Set the name of the photo set void change_set_name(string); // Save the photo set into a file void save_set(string); // Destroy the photo set ~Photo_set(); private: string set_name; vector images; }; // A default constructor that makes a blank set Photo_set::Photo_set(){ // MAKE THIS WORK } // A method that is given the name of a file and reads // the information from the file. // The file has the format: // One line with the set name // Many lines, each with one image on them void Photo_set::load_set(string filename){ // MAKE THIS WORK } // Display a numbered list of images contained in the photo set // Start with the name, so we know which set it is // Notice that numbering starts at 1, because we don't want to // confuse grandma void Photo_set::display_images(){ // MAKE THIS WORK } // Given an integer that represents a number from the display_images // list, return a copy of that image Image Photo_set::extract_image(int image_number){ // MAKE THIS WORK } // Add an image to the set // Just slap it on the end of the vector void Photo_set::add_image(Image new_image){ // MAKE THIS WORK } // Return the number of images // This is just the size of the vector int Photo_set::number_of_images(){ // MAKE THIS WORK } // Get name simply returns the name of the set string Photo_set::get_name(){ // MAKE THIS WORK } // Set the name of the photo set void Photo_set::change_set_name(string new_name){ // MAKE THIS WORK } // Save the photo set into a file of the specified name void Photo_set::save_set(string filename){ // MAKE THIS WORK } // Destroy the photo set Photo_set::~Photo_set(){ // MAKE THIS WORK } /////////////////////////////////////////////////////////////////////////// // A main function to test that the photo_set class works /* int main(){ string filename = "11-04-2006-wedding.txt"; cout << "starting" << endl; // test the default constructor Photo_set test_set; test_set.display_images(); // test the file loading constructor Photo_set file_set; file_set.load_set(filename.c_str()); file_set.display_images(); // test the extract image cout << endl << endl << "The next line should say: DSCF0364.JPG Bride and groom kneeling, closeup" << endl; cout << endl << file_set.extract_image(5) << endl; // test the add image test_set.add_image(file_set.extract_image(10)); test_set.display_images(); // check the count of images cout << "The next number should be 1: " << test_set.number_of_images() << endl; // Check the set_name cout << "The next line should read: 11-04-2006-wedding" << endl; cout << file_set.get_name() << endl; // Check that we can change the name cout << "The next line should read: Elizabeth and John's wedding" << endl; file_set.change_set_name("Elizabeth and John's wedding"); cout << file_set.get_name() << endl; // Check that we can save a photo set test_set.save_set("test_output"); Photo_set new_set; new_set.load_set("test_output"); cout << "This set:" << endl; test_set.display_images(); cout << endl << "Should be the same as this set:" << endl; new_set.display_images(); cout << "ending" << endl; } */ // Now for the real main This should display a menu and allow the user // to load a file into a photo set, move images from that photo set to // another, give the other a title, and save it to a file. int main(){ // MAKE THIS WORK } void print_instructions(){ cout << endl << endl; cout << "Welcome to the PIC, Co. Photo chooser." << endl; cout << "This program will allow you to choose photos from one set" << endl; cout << "and add them to a second set which can them will be saved" << endl; cout << "so that it can be printed" << endl; cout << " " << endl; cout << "Menu choices:" << endl; cout << left; cout << setw(5) << "L" << setw(45) << "Load from a file into the main set" << endl; cout << setw(5) << "P" << setw(45) << "Pick a picture from the main set to add to the order" << endl; cout << setw(5) << "D" << setw(45) << "Display the photos currently in the order" << endl; cout << setw(5) << "S" << setw(45) << "Save the order for processing" << endl; cout << setw(5) << "Q" << setw(45) << "Quit the program" << endl; cout << endl << endl << "Your choice: "; }