本文整理汇总了C++中Table::Tableread方法的典型用法代码示例。如果您正苦于以下问题:C++ Table::Tableread方法的具体用法?C++ Table::Tableread怎么用?C++ Table::Tableread使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table::Tableread方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateNewTable
int updateNewTable(vector<ihead_t> &iheadvec, vector<ohead_t> &oheadvec, Table &itab, Table &otab, int orowoff)
{
unsigned i, row;
char c;
std::stringstream valstream;
if(itab.getNbrofrows()+orowoff>otab.getNbrofrows()) return -1;
for(i=0; i<min(iheadvec.size(),oheadvec.size()); i++) {
// write out tablehead
c = oheadvec[i].oname[0];
if('$'==c || '+'==c || '-'==c || '%'==c || '['==c || ']'==c) {
otab.Tablewrite(0, oheadvec[i].ocol, oheadvec[i].oname.substr(1,std::string::npos));
} else {
otab.Tablewrite(0, oheadvec[i].ocol, oheadvec[i].oname);
}
// process/write table content
for(row=1; row<itab.getNbrofrows(); row++) {
if(1>iheadvec[i].iname.size()) return -4;
if(-2==iheadvec[i].icol) {
otab.Tablewrite(row + orowoff, oheadvec[i].ocol, iheadvec[i].iname.substr(1, std::string::npos));
} else if('$'==oheadvec[i].oname[0]) {
otab.Tablewrite(row + orowoff, oheadvec[i].ocol, "");
valstream.str("");
valstream << std::scientific << norm_value(itab.Tableread(row, iheadvec[i].icol));
otab.Tablewrite(row + orowoff, oheadvec[i].ocol, valstream.str());
} else if('%'==oheadvec[i].oname[0]) {
otab.Tablewrite(row + orowoff, oheadvec[i].ocol, to_string(is_relative(itab.Tableread(row, iheadvec[i].icol))));
} else if('\\'==oheadvec[i].oname[0]) {
otab.Tablewrite(row + orowoff, oheadvec[i].ocol, firstword(itab.Tableread(row, iheadvec[i].icol)));
} else if('+'==oheadvec[i].oname[0]) {
otab.Tablewrite(row + orowoff, oheadvec[i].ocol, "");
valstream.str("");
valstream << std::scientific << tolupp(itab.Tableread(row, iheadvec[i].icol));
otab.Tablewrite(row + orowoff, oheadvec[i].ocol, valstream.str());
} else if('-'==oheadvec[i].oname[0]) {
otab.Tablewrite(row + orowoff, oheadvec[i].ocol, "");
valstream.str("");
valstream << std::scientific << tollow(itab.Tableread(row, iheadvec[i].icol));
otab.Tablewrite(row + orowoff, oheadvec[i].ocol, valstream.str());
} else if('['==oheadvec[i].oname[0]) {
otab.Tablewrite(row + orowoff, oheadvec[i].ocol, "");
valstream.str("");
valstream << std::scientific << vallow(norm_value(itab.Tableread(row, iheadvec[i+1].icol)), tollow(itab.Tableread(row, iheadvec[i].icol)), is_relative(itab.Tableread(row, iheadvec[i].icol)));
otab.Tablewrite(row + orowoff, oheadvec[i].ocol, valstream.str());
} else if(']'==oheadvec[i].oname[0]) {
otab.Tablewrite(row + orowoff, oheadvec[i].ocol, "");
valstream.str("");
valstream << std::scientific << valupp(norm_value(itab.Tableread(row, iheadvec[i-1].icol)), tolupp(itab.Tableread(row, iheadvec[i].icol)), is_relative(itab.Tableread(row, iheadvec[i].icol)));
otab.Tablewrite(row + orowoff, oheadvec[i].ocol, valstream.str());
} else {
otab.Tablewrite(row + orowoff, oheadvec[i].ocol, itab.Tableread(row, iheadvec[i].icol));
}
if(false==otab.OK) return -2;
if(false==itab.OK) return -3;
}
}
return 0;
}
示例2: updateicol
void updateicol(vector<ihead_t> &iheadvec, Table &itab)
{
unsigned i, icol;
string str;
for(i=0; i<iheadvec.size(); i++) {
for(icol=0; icol<itab.getNbrofcols(); icol++) {
str = itab.Tableread(0, icol);
if((iheadvec[i].iname == str) || (iheadvec[i].namecontains && std::string::npos!=str.find(iheadvec[i].iname)) || (iheadvec[i].strcontainsname && (std::string::npos!=iheadvec[i].iname.find(str)))) {
iheadvec[i].icol = icol;
}
if('&'==iheadvec[i].iname[0]) {
iheadvec[i].icol = -2;
}
}
}
}