Sei sulla pagina 1di 3

#include <iostream>

#include <stdio.h>

#include <list>

#include <vector>

#include <string>

#include <sstream>

#include <algorithm>

#include <map>

using namespace std;

string subStrByDelim(const string &str, char begin, char end){

int sb,eb; // sustrae cadenas, usado para los atributos

sb = str.find(begin);

eb = str.find_last_of(end);

return str.substr(sb+1, eb-sb-1);

string trim(string &str)

str.erase(0, str.find_first_not_of(' ')); // aun no lo analizo bien

str.erase(str.find_last_not_of(' ')+1);

return str;

vector<string> &split(const string &s, char delim, vector<string> &elems) {

stringstream ss(s);

string item;

while(getline(ss, item, delim)) {

item = trim(item);
elems.push_back(item);

return elems;

} // ambas funciones separan atributos para analizarlos,

// si son int, float, not null, primary key , varchar, etc

vector<string> split(const string &s, char delim) {

vector<string> elems;

if( (int)s.find(delim) == -1 ) {

elems.push_back(s); // cuando no hay limites, coloca la s

return elems;

}else {

return split(s, delim, elems);

class Row{ /** ESTA CLASE COLOCA VALORES A LOS ATRIBUTOS **/

public:

// Row(std::string, int, std::string);

string getWishData(const string &colName){

for (map<string,string>::iterator it=mapData.begin() ; it != mapData.end(); it++ ){

if ((*it).first == colName) { return (*it).second;}

return "Error";

};

void addData(const string &colName, const string &data){

mapData.insert(pair<string,string>(colName, data));

void printMapData(){ // mostrando contenido:

cout << "--------------------------------" <<"\n los datos de mapa contienen :\n" << endl;
for ( map<string,string>::iterator it=mapData.begin() ; it != mapData.end(); it++ ){

cout << (*it).first << " => " << (*it).second << " ; " <<endl;

private:

int rowIndex;

map<string,string> mapData;

};

class Column{ /** ESTA CLASE COLOCA LA DESCRIPCION DE LOS ATRIBUTOS **/

public:

Column(string name, string dataType, int dataLength, bool isNotNull, bool isPK){

this->name = name;

this->dataLength = dataLength;

this->dataType = dataType; // le da las caracteristicas al atributo

this->isNotNull = isNotNull;

this->isPK = isPK;

string getName() { return this->name;}

string getDataType();

int getDataLength();

bool getIsNull(){

if (!isNotNull)

return true;

return false;

};