This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
dmspine64backup/Attribute.h

49 lines
901 B
C
Raw Normal View History

2015-09-15 20:17:21 -05:00
#include <iostream>
#include <vector>
using namespace std;
//Funtional, might need more functionality
//template<typename T>
2015-09-17 17:14:28 -05:00
class Attribute{
2015-09-15 22:18:19 -05:00
vector<string> values;
2015-09-15 20:17:21 -05:00
string name;
2015-09-15 20:55:21 -05:00
string type;
bool key;
2015-09-15 20:17:21 -05:00
int size;
public:
2015-09-15 20:55:21 -05:00
Attribute(string n, string t, bool k){
2015-09-15 20:17:21 -05:00
name = n;
2015-09-15 20:55:21 -05:00
type = t;
key = k;
size = 0;
2015-09-15 20:17:21 -05:00
}
2015-09-17 17:14:28 -05:00
void addCell(string v){
2015-09-15 20:55:21 -05:00
values.push_back(v);
2015-09-15 23:13:28 -05:00
size++;
2015-09-15 20:17:21 -05:00
}
2015-09-17 17:14:28 -05:00
string operator[](int i){ return values[i]; }
vector<string> getValues(){ return values; }
2015-09-15 22:18:19 -05:00
string getName(){ return name; }
string getType(){ return type; }
bool isKey(){ return key; }
2015-09-17 17:14:28 -05:00
int getSize(){ return size; } //may need to change primary key implementation
2015-09-15 20:17:21 -05:00
2015-09-17 17:14:28 -05:00
void display(){
cout << "-------------\n";
cout << name << "\n" << type << "\n\n";
2015-09-15 21:31:19 -05:00
2015-09-17 17:14:28 -05:00
vector<string>::iterator it = values.begin();
while (it != values.end()){
cout << *it << "\n";
it++;
2015-09-15 20:17:21 -05:00
}
2015-09-17 17:14:28 -05:00
cout << "-------------\n";
2015-09-15 22:18:19 -05:00
}
2015-09-15 20:17:21 -05:00
};