1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
|
#include <string>
#include <vector>
#include <fstream>
class GSpreadSheet
{
public:
/* Constructor/Destructor Functions */
GSpreadSheet (const char* address);
//Overloaded Constructor - Creates a new google spread sheet based on the web address given
//@param const char* - the website address for the google spread sheet
GSpreadSheet (const std::string& address);
//Overloaded Constructor - Creates a new google spread sheet based on the web address given
//@param const std::string& - the website address for the google spread sheet
//WARNING: Formulas will not be used, only the current values of the cells.
~GSpreadSheet ();
//Default Destructor
/* Utility Functions */
void save (const std::string&);
//save - saves the current spreadsheet as a csv (comma seperated values) spread sheet that can be uploaded to google docs.
//@const std::string& - the file name of the saved file
void save (const char*);
//save - (overloaded) saves the current spread sheet as a csv (comma seperated values) spread sheet that can be uploaded to google docs.
//@const char* - the file name of the saved file
//NOTE: a csv does not save any formatting of data or coloring etc, should be used to copy/paste into the previous page.
//WARNING: Formulas/functions will not be maintained, only the value of the cell at current time.
void reserve (unsigned long, unsigned long);
//reserve - sets the minimum size of the spread sheet
//@param unsigned long - the collumn count
//@param unsigned long - the row count
/* Accessor Functions */
const std::string& operator[] (unsigned long, unsigned long);
//operator[] - used to access the values in the spread sheet
//@param unsigned long - the collumn (IE: A, B, C, etc.)
//@param unsigned long - the row
//@return const std::string& - the value in the given collumn/row
const std::string& operator[] (const std::string&);
//operator[] - (Overloaded) used to access the values in the spread sheet
//@param const std::string& - the collumn/row for the value, ie: (A1, CD91)
//@return const std::string& - the value in the given collumn/row
const std::string& operator[] (const char*);
//operator[] - (Overloaded) used to access the values in the spread sheet
//@param const char* - the collumn/row for the value, ie: (A1, CD91)
//@return const std::string& - the value in the given collumn/row
double number (unsigned long, unsigned long);
//number - used to access the number values in the spread sheet
//@param unsigned long - the collumn (IE: A, B, C, etc.)
//@param unsigned long - the row
//@return double - the number value in the given collumn/row (will return 0 if there is no number value)
double number (const std::string&);
//number - (Overloaded) used to access the number values in the spread sheet
//@param const std::string& - the collumn/row for the value, ie: (A1, CD91)
//@return double - the number value in the given collumn/row (will return 0 if there is no number value)
double number (const char*);
//number - (Overloaded) used to access the number values in the spread sheet
//@param const char* - the collumn/row for the value, ie: (A1, CD91)
//@return double - the number value in the given collumn/row (will return 0 if there is no number value)
unsigned long width ();
//width - gets the width (number of collumns) in the spread sheet
//@return unsigned long - the width of the spread sheet
unsigned long height ();
//height - gets the height (number of rows) in the spread sheet
//@return unsigned long - the height of the spread sheet
/* Mutator Functions */
void set (unsigned long, unsigned long, const std::string&);
//set - sets the given index to the given value
//@param unsigned long - the collumn
//@param unsigned long - the row
//@param const std::string& - the new value
void set (const std::string&, const std::string&);
//set - sets the given index to the given value
//@param const std::string& - the collumn/row of the index (ie: A1)
//@param const std::string& - the new value
void set (const char*, const std::string&);
//set - sets the given index to the given value
//@param const char* - the collumn/row of the index (ie: A1)
//@param const std::string& - the new value
void set (unsigned long, unsigned long, const char*);
//set - sets the given index to the given value
//@param unsigned long - the collumn
//@param unsigned long - the row
//@param const char* - the new value
void set (const std::string&, const char*);
//set - sets the given index to the given value
//@param const std::string& - the collumn/row of the index (ie: A1)
//@param const char* - the new value
void set (const char*, const char*);
//set - sets the given index to the given value
//@param const char* - the collumn/row of the index (ie: A1)
//@param const char* - the new value
void set (unsigned long, unsigned long, double);
//set - sets the given index to the given value
//@param unsigned long - the collumn
//@param unsigned long - the row
//@param double - the new value
void set (const std::string&, double);
//set - sets the given index to the given value
//@param const std::string& - the collumn/row of the index (ie: A1)
//@param double - the new value
void set (const char*, double);
//set - sets the given index to the given value
//@param const char* - the collumn/row of the index (ie: A1)
//@param double - the new value
private:
/* Member variables */
std::vector<std::vector<std::string>> values;
std::vector<std::vector<double>> nvalues;
std::vector<std::vector<bool>> changed;
};
|