TableRepository.h


Dosyayı İndir
#ifndef TABLEREPOSITORY_H
#define TABLEREPOSITORY_H

#include <string>
#include <vector>
#include <fstream>
#include <sstream>

#include "RepositoryUtilities.h"

using namespace std;


class TableRepository
{
public:
    TableRepository(){
    }
    TableRepository(string &filePath) : _filePath(filePath){
    }
    ~TableRepository(){
        _cellTable.clear();
    }
    string &getFilePath(){
        return _filePath;
    }
    void setFilePath(string &filePath){
        _filePath=filePath;
    }
    string get(int row,int column) const;
    void set(int row,int column,string cell);
    void load();
    void store();
    void print();
private:
    string _filePath;
    vector<vector<string>> _cellTable;
};
string TableRepository::get(int row,int column) const{
    return _cellTable[row][column];
}
void TableRepository::set(int row,int column,string cell){
    _cellTable[row][column]=cell;
}

void TableRepository::load(){
    ifstream ifs(_filePath.c_str());
    read_vector(ifs,_cellTable);
}
void TableRepository::store(){
    ofstream ofs(_filePath.c_str());
    write_vector(ofs,_cellTable);
    ofs.close();
}
void TableRepository::print(){
    write_vector(cout,_cellTable);
}

#endif

				
Dosyayı İndir

Bu Sayfayı Paylaş:




Bu Sayfayı Paylaş:

İletişim Bilgileri

Takip Et

Her Hakkı Saklıdır. Bu sitede yayınlanan tüm bilgi ve fikirlerin kullanımından fibiler.com sorumlu değildir. Bu sitede üretilmiş , derlenmiş içerikleri, fibiler.com'u kaynak göstermek koşuluyla kendi sitenizde kullanılabilirsiniz. Ancak telif hakkı olan içeriklerin hakları sahiplerine aittir