Skip to content

Instantly share code, notes, and snippets.

@NickersF
Created February 22, 2016 03:46
Show Gist options
  • Save NickersF/8073dd5b0d6c4e097b65 to your computer and use it in GitHub Desktop.
Save NickersF/8073dd5b0d6c4e097b65 to your computer and use it in GitHub Desktop.
header for the playlist class
// Author: Nicholas Fazzolari
// Project 4 - OOP Playlist (Dynamic Memory)
// Date: 2/16/16
// Sources: Book, cplusplus.com, stackexchange
#ifndef PLAY_LIST
#define PLAY_LIST
#include "songEntry.h"
// maximum capacity for the array of song entries
const int MAX_PLAYLIST_ENTRIES = 100;
const int COL_ARTIST_HEADING_WIDTH = 30;
const int COL_ALBUM_HEADING_WIDTH = 30;
const int COL_SONG_HEADING_WIDTH = 40;
const int COL_DURATION_HEADING_WIDTH = 20;
/* class definition for the playlist
*/
class playList {
public:
// constructors
playList();
playList(int initCapacity, char fileName[]);
// destructor
~playList();
// accesor methods
bool get(int index, songEntry& entry) const;
bool searchByArtist(const char name[], songEntry& artistMatch) const;
bool searchByAlbum(const char name[], songEntry& songMatch) const;
int getSize() const;
void printAll() const;
void savePlayList(const char fileName[]);
// mutator methods
void addEntry(const songEntry& entry);
void removeEntry(const songEntry entry);
void loadPlayList(char filename[]);
private:
songEntry * songList;
int listLength;
int capacity;
// private mutator for dynamic memory allocation
void expandList();
};
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment