tmp
This commit is contained in:
parent
25795029a9
commit
1296f15387
@ -82,20 +82,12 @@ void gctl::dsv_io::load_text(std::string filename, std::string file_exten, table
|
|||||||
std::ifstream infile;
|
std::ifstream infile;
|
||||||
open_infile(infile, filename, file_exten);
|
open_infile(infile, filename, file_exten);
|
||||||
|
|
||||||
|
int h = 0;
|
||||||
std::string tmp_line;
|
std::string tmp_line;
|
||||||
std::stringstream tmp_ss;
|
|
||||||
for (int i = 0; i < head_num_; i++) // 跳过前n行 包括空行 但不会保存空行
|
|
||||||
{
|
|
||||||
std::getline(infile, tmp_line);
|
|
||||||
if (!tmp_line.empty()) heads_.push_back(tmp_line);
|
|
||||||
}
|
|
||||||
// 校正头信息行数
|
|
||||||
head_num_ = heads_.size();
|
|
||||||
|
|
||||||
std::vector<std::string> lines;
|
std::vector<std::string> lines;
|
||||||
while (std::getline(infile, tmp_line))
|
while (std::getline(infile, tmp_line))
|
||||||
{
|
{
|
||||||
if (tmp_line.empty()) continue; // 跳过空行
|
if (tmp_line.empty()) continue; // 跳过空行 空行不会并记入头信息计数中
|
||||||
else if (tmp_line[0] == att_sym_) // 注释行或者标记行 # #!
|
else if (tmp_line[0] == att_sym_) // 注释行或者标记行 # #!
|
||||||
{
|
{
|
||||||
if (tmp_line[1] == tag_sym_) // #!
|
if (tmp_line[1] == tag_sym_) // #!
|
||||||
@ -113,6 +105,11 @@ void gctl::dsv_io::load_text(std::string filename, std::string file_exten, table
|
|||||||
tmp_line.erase(tmp_line.find_last_not_of(" \t") + 1);
|
tmp_line.erase(tmp_line.find_last_not_of(" \t") + 1);
|
||||||
annotates_.push_back(tmp_line);
|
annotates_.push_back(tmp_line);
|
||||||
}
|
}
|
||||||
|
else if (h < head_num_) //读入到头信息中
|
||||||
|
{
|
||||||
|
heads_.push_back(tmp_line);
|
||||||
|
h++;
|
||||||
|
}
|
||||||
else lines.push_back(tmp_line);
|
else lines.push_back(tmp_line);
|
||||||
}
|
}
|
||||||
infile.close();
|
infile.close();
|
||||||
|
Loading…
Reference in New Issue
Block a user