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

56 lines
873 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>
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-15 20:55:21 -05:00
void addRow(string v) {
values.push_back(v);
2015-09-15 23:13:28 -05:00
size++;
2015-09-15 20:17:21 -05:00
}
2015-09-15 23:21:38 -05:00
string getElementAt(int pos)
{
return values[pos];
}
2015-09-15 22:18:19 -05:00
vector<string> getValues() { return values; }
string getName(){ return name; }
string getType(){ return type; }
bool isKey(){ return key; }
int getSize(){ return size; }
2015-09-15 20:17:21 -05:00
void display()
{
2015-09-15 22:08:18 -05:00
cout<<"Attribute name:\t"<< name <<"\n";
2015-09-15 20:17:21 -05:00
cout<<"Elements: ";
2015-09-15 21:31:19 -05:00
2015-09-15 20:17:21 -05:00
for (int i = 0; i < values.size(); ++i)
{
cout<<values[i]<<" ";
}
}
2015-09-15 21:51:50 -05:00
void erase(int position)
{
values.erase(values.begin()+ position);
2015-09-15 22:18:19 -05:00
}
2015-09-15 20:17:21 -05:00
};