tmp
This commit is contained in:
parent
b011a82f64
commit
2215a17d5f
@ -33,7 +33,7 @@ if(GCTL_FFTW3)
|
||||
if(NOT FFTW3_FOUND)
|
||||
find_package(FFTW3 REQUIRED)
|
||||
message(STATUS "Found FFTW3")
|
||||
include_directories(${FFTW3_INC_DIR})
|
||||
include_directories(${FFTW3_INCLUDE_DIRS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -45,7 +45,7 @@ endif()
|
||||
if(@PROJECT_NAME@_FFTW3)
|
||||
if(NOT FFTW3_FOUND)
|
||||
find_package(FFTW3 REQUIRED)
|
||||
include_directories(${FFTW3_INC_DIR})
|
||||
include_directories(${FFTW3_INCLUDE_DIRS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
* Also add information on how to contact you by electronic and paper mail.
|
||||
******************************************************/
|
||||
|
||||
#include "../lib/core.h"
|
||||
#include "../lib/io.h"
|
||||
|
||||
using namespace gctl;
|
||||
@ -34,7 +33,7 @@ int main(int argc, char const *argv[]) try
|
||||
{
|
||||
|
||||
dsv_io tc, tout;
|
||||
tc.set_delimeter('|');
|
||||
tc.delimeter('|');
|
||||
tc.load_text("tmp/world_data", ".txt", BothHead);
|
||||
//tc.info();
|
||||
|
||||
@ -51,7 +50,7 @@ int main(int argc, char const *argv[]) try
|
||||
int lr_id = tout.add_row();
|
||||
tout.fill_row(array<std::string>{"Asia", "China", "14000000", "1949"}, lr_id);
|
||||
|
||||
tout.set_delimeter('|');
|
||||
tout.delimeter('|');
|
||||
tout.save_text("out");
|
||||
|
||||
/*
|
||||
|
@ -51,10 +51,9 @@ endif()
|
||||
|
||||
# 连接动态库与静态库
|
||||
if(GCTL_FFTW3)
|
||||
# 因为是手动设置的动态库地址 使用find_library更保险
|
||||
find_library(LIB_TAR ${FFTW3_LIB} HINTS ${FFTW3_LIB_DIR})
|
||||
target_link_libraries(gctl PUBLIC ${LIB_TAR})
|
||||
target_link_libraries(gctl_static ${LIB_TAR})
|
||||
find_library(FFTW_LIB ${FFTW3_LIBRARIES} HINTS ${FFTW3_LIBRARY_DIRS})
|
||||
target_link_libraries(gctl PUBLIC ${FFTW_LIB})
|
||||
target_link_libraries(gctl_static ${FFTW_LIB})
|
||||
endif()
|
||||
|
||||
if(GCTL_EEMD)
|
||||
|
@ -145,7 +145,7 @@ namespace gctl
|
||||
*
|
||||
* @param init_val Initial values
|
||||
*/
|
||||
array(std::vector<ArrValType> init_val);
|
||||
array(std::initializer_list<ArrValType> init_val);
|
||||
|
||||
/**
|
||||
* @brief Construct a new array object as a sequence
|
||||
@ -394,7 +394,7 @@ namespace gctl
|
||||
*
|
||||
* @param init_val Initial values
|
||||
*/
|
||||
void resize(std::vector<ArrValType> init_val);
|
||||
void resize(std::initializer_list<ArrValType> init_val);
|
||||
|
||||
/**
|
||||
* @brief Resize a new array object as a sequence
|
||||
@ -894,7 +894,7 @@ namespace gctl
|
||||
}
|
||||
|
||||
template <typename ArrValType>
|
||||
array<ArrValType>::array(std::vector<ArrValType> init_val)
|
||||
array<ArrValType>::array(std::initializer_list<ArrValType> init_val)
|
||||
{
|
||||
length_ = 0;
|
||||
val_ = nullptr;
|
||||
@ -1244,12 +1244,15 @@ namespace gctl
|
||||
}
|
||||
|
||||
template <typename ArrValType>
|
||||
void array<ArrValType>::resize(std::vector<ArrValType> init_val)
|
||||
void array<ArrValType>::resize(std::initializer_list<ArrValType> init_val)
|
||||
{
|
||||
resize(init_val.size());
|
||||
|
||||
typename std::initializer_list<ArrValType>::iterator iter = init_val.begin();
|
||||
for (size_t i = 0; i < length_; i++)
|
||||
{
|
||||
val_[i] = init_val[i];
|
||||
val_[i] = *iter;
|
||||
iter++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -74,27 +74,17 @@ void gctl::dsv_io::clear()
|
||||
return;
|
||||
}
|
||||
|
||||
void gctl::dsv_io::get_row_names(std::vector<std::string> &names)
|
||||
std::vector<std::string> gctl::dsv_io::row_names()
|
||||
{
|
||||
names.resize(row_num_);
|
||||
_1s_vector names(row_num_);
|
||||
for (size_t i = 1; i <= row_num_; i++)
|
||||
{
|
||||
names[i - 1] = table_[i][0].str_;
|
||||
}
|
||||
return;
|
||||
return names;
|
||||
}
|
||||
|
||||
void gctl::dsv_io::get_column_names(std::vector<std::string> &names)
|
||||
{
|
||||
names.resize(col_num_);
|
||||
for (size_t i = 1; i <= col_num_; i++)
|
||||
{
|
||||
names[i - 1] = table_[0][i].str_;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void gctl::dsv_io::set_row_names(const std::vector<std::string> &names, const std::vector<int> &idx, std::string corner_name)
|
||||
void gctl::dsv_io::row_names(const std::vector<std::string> &names, const std::vector<int> &idx, std::string corner_name)
|
||||
{
|
||||
if (!idx.empty())
|
||||
{
|
||||
@ -117,7 +107,17 @@ void gctl::dsv_io::set_row_names(const std::vector<std::string> &names, const st
|
||||
return;
|
||||
}
|
||||
|
||||
void gctl::dsv_io::set_column_names(const std::vector<std::string> &names, const std::vector<int> &idx)
|
||||
std::vector<std::string> gctl::dsv_io::column_names()
|
||||
{
|
||||
_1s_vector names(col_num_);
|
||||
for (size_t i = 1; i <= col_num_; i++)
|
||||
{
|
||||
names[i - 1] = table_[0][i].str_;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
void gctl::dsv_io::column_names(const std::vector<std::string> &names, const std::vector<int> &idx)
|
||||
{
|
||||
if (!idx.empty())
|
||||
{
|
||||
@ -138,7 +138,7 @@ void gctl::dsv_io::set_column_names(const std::vector<std::string> &names, const
|
||||
return;
|
||||
}
|
||||
|
||||
void gctl::dsv_io::set_row_type(cell_type_e t, int idx)
|
||||
void gctl::dsv_io::row_type(table_cell_type t, int idx)
|
||||
{
|
||||
if (idx > row_num_ || idx <= 0)
|
||||
{
|
||||
@ -151,12 +151,12 @@ void gctl::dsv_io::set_row_type(cell_type_e t, int idx)
|
||||
}
|
||||
}
|
||||
|
||||
void gctl::dsv_io::set_row_type(cell_type_e t, std::string name)
|
||||
void gctl::dsv_io::row_type(table_cell_type t, std::string name)
|
||||
{
|
||||
set_row_type(t, name_index(name, true));
|
||||
row_type(t, name_index(name, true));
|
||||
}
|
||||
|
||||
void gctl::dsv_io::set_column_type(cell_type_e t, int idx)
|
||||
void gctl::dsv_io::column_type(table_cell_type t, int idx)
|
||||
{
|
||||
if (idx > col_num_ || idx <= 0)
|
||||
{
|
||||
@ -170,9 +170,9 @@ void gctl::dsv_io::set_column_type(cell_type_e t, int idx)
|
||||
return;
|
||||
}
|
||||
|
||||
void gctl::dsv_io::set_column_type(cell_type_e t, std::string name)
|
||||
void gctl::dsv_io::column_type(table_cell_type t, std::string name)
|
||||
{
|
||||
set_column_type(t, name_index(name, false));
|
||||
column_type(t, name_index(name, false));
|
||||
}
|
||||
|
||||
void gctl::dsv_io::load_text(std::string filename, std::string file_exten, table_headtype_e t)
|
||||
@ -225,7 +225,7 @@ void gctl::dsv_io::load_text(std::string filename, std::string file_exten, table
|
||||
|
||||
// 动态调整列数
|
||||
cn = tmp_cols.size();
|
||||
cn_max = std::max(cn, cn_max);
|
||||
cn_max = GCTL_MAX(cn, cn_max);
|
||||
|
||||
table_[i].resize(tmp_cols.size());
|
||||
for (size_t j = 0; j < tmp_cols.size(); j++)
|
||||
@ -292,7 +292,7 @@ void gctl::dsv_io::load_text(std::string filename, std::string file_exten, table
|
||||
|
||||
void gctl::dsv_io::load_csv(std::string filename, table_headtype_e t)
|
||||
{
|
||||
set_delimeter(',');
|
||||
delimeter(',');
|
||||
load_text(filename, ".csv", t);
|
||||
return;
|
||||
}
|
||||
@ -338,59 +338,14 @@ void gctl::dsv_io::save_text(std::string filename, std::string file_exten)
|
||||
}
|
||||
outfile << std::endl;
|
||||
}
|
||||
|
||||
/*
|
||||
// 单独处理第一行 即列头
|
||||
bool line_st = false;
|
||||
if (table_[0][0].out_ok_ && table_[0][0].str_ != "")
|
||||
{
|
||||
outfile << table_[0][0].str_;
|
||||
line_st = true;
|
||||
}
|
||||
|
||||
for (int j = 1; j <= col_num_; j++)
|
||||
{
|
||||
if (line_st && table_[0][j].out_ok_ && table_[0][j].str_ != "") outfile << deli_sym_ << table_[0][j].str_; // line started
|
||||
else if (table_[0][j].out_ok_ && table_[0][j].str_ != "") // line not started
|
||||
{
|
||||
outfile << table_[0][j].str_;
|
||||
line_st = true; // start line
|
||||
}
|
||||
}
|
||||
|
||||
if (line_st) outfile << std::endl;
|
||||
|
||||
// 处理余下的行
|
||||
for (int i = 1; i <= row_num_; i++)
|
||||
{
|
||||
line_st = false;
|
||||
|
||||
// 单独处理第一列 即行头
|
||||
if (table_[i][0].out_ok_ && table_[i][0].str_ != "")
|
||||
{
|
||||
outfile << table_[i][0].str_;
|
||||
line_st = true;
|
||||
}
|
||||
|
||||
for (int j = 1; j <= col_num_; j++)
|
||||
{
|
||||
if (line_st && table_[i][j].out_ok_) outfile << deli_sym_ << table_[i][j].str_; // line started
|
||||
else if (table_[i][j].out_ok_) // line not started
|
||||
{
|
||||
outfile << table_[i][j].str_;
|
||||
line_st = true; // start line
|
||||
}
|
||||
}
|
||||
outfile << std::endl;
|
||||
}
|
||||
*/
|
||||
outfile.close();
|
||||
return;
|
||||
}
|
||||
|
||||
void gctl::dsv_io::save_csv(std::string filename)
|
||||
{
|
||||
set_delimeter(',');
|
||||
delimeter(',');
|
||||
save_text(filename, ".csv");
|
||||
return;
|
||||
}
|
||||
@ -684,7 +639,7 @@ void gctl::dsv_io::filt_column(std::string cnd_str, std::string cnd_col,
|
||||
std::vector<std::string> io_col;
|
||||
if (out_row)
|
||||
{
|
||||
get_column_names(io_col);
|
||||
column_names(io_col);
|
||||
out_table.cell(table_[0][0].str_, 0, 0);
|
||||
}
|
||||
else
|
||||
@ -697,8 +652,8 @@ void gctl::dsv_io::filt_column(std::string cnd_str, std::string cnd_col,
|
||||
}
|
||||
}
|
||||
|
||||
out_table.set_column_names(io_col);
|
||||
out_table.set_row_names(row_names, {}, table_[0][0].str_);
|
||||
out_table.column_names(io_col);
|
||||
out_table.row_names(row_names, {}, table_[0][0].str_);
|
||||
|
||||
destroy_vector(row_names);
|
||||
destroy_vector(io_col);
|
||||
@ -761,7 +716,7 @@ void gctl::dsv_io::filt_column(rowbool_func_t func, const std::vector<std::strin
|
||||
std::vector<std::string> io_col;
|
||||
if (out_row)
|
||||
{
|
||||
get_column_names(io_col);
|
||||
column_names(io_col);
|
||||
out_table.cell(table_[0][0].str_, 0, 0);
|
||||
}
|
||||
else
|
||||
@ -772,8 +727,8 @@ void gctl::dsv_io::filt_column(rowbool_func_t func, const std::vector<std::strin
|
||||
}
|
||||
}
|
||||
|
||||
out_table.set_column_names(io_col);
|
||||
out_table.set_row_names(row_names, {}, table_[0][0].str_);
|
||||
out_table.column_names(io_col);
|
||||
out_table.row_names(row_names, {}, table_[0][0].str_);
|
||||
|
||||
destroy_vector(row_names);
|
||||
destroy_vector(io_col);
|
||||
@ -924,7 +879,7 @@ void gctl::dsv_io::filt_column(std::string cnd_str, const std::vector<std::strin
|
||||
std::vector<std::string> io_col;
|
||||
if (out_row)
|
||||
{
|
||||
get_column_names(io_col);
|
||||
column_names(io_col);
|
||||
out_table.cell(table_[0][0].str_, 0, 0);
|
||||
}
|
||||
else
|
||||
@ -940,8 +895,8 @@ void gctl::dsv_io::filt_column(std::string cnd_str, const std::vector<std::strin
|
||||
}
|
||||
}
|
||||
|
||||
out_table.set_column_names(io_col);
|
||||
out_table.set_row_names(row_names, {}, table_[0][0].str_);
|
||||
out_table.column_names(io_col);
|
||||
out_table.row_names(row_names, {}, table_[0][0].str_);
|
||||
|
||||
destroy_vector(row_names);
|
||||
destroy_vector(io_col);
|
||||
|
190
lib/io/dsv_io.h
190
lib/io/dsv_io.h
@ -29,18 +29,22 @@
|
||||
#define _GCTL_DSV_IO_H
|
||||
|
||||
#include "../gctl_config.h"
|
||||
#include "../core.h"
|
||||
#include "../utility.h"
|
||||
#include "../geometry.h"
|
||||
#include "regex.h"
|
||||
|
||||
#ifdef GCTL_EXPRTK
|
||||
#include "exprtk.hpp"
|
||||
#endif // GCTL_EXPRTK
|
||||
|
||||
#include "regex.h"
|
||||
|
||||
#include "../core.h"
|
||||
#include "../utility/stream.h"
|
||||
#include "../geometry/point2c.h"
|
||||
#include "../geometry/point2p.h"
|
||||
#include "../geometry/point3c.h"
|
||||
#include "../geometry/point3s.h"
|
||||
|
||||
namespace gctl
|
||||
{
|
||||
enum cell_type_e
|
||||
enum table_cell_type
|
||||
{
|
||||
String,
|
||||
Int,
|
||||
@ -50,7 +54,7 @@ namespace gctl
|
||||
struct table_cell
|
||||
{
|
||||
std::string str_; // 单元格的内容 统一保存为字符串
|
||||
cell_type_e type_; // 类型字符串
|
||||
table_cell_type type_; // 类型字符串
|
||||
bool out_ok_; // 是否可输出到文件
|
||||
|
||||
table_cell()
|
||||
@ -165,13 +169,6 @@ namespace gctl
|
||||
*/
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* @brief 返回头信息行数
|
||||
*
|
||||
* @return 行数
|
||||
*/
|
||||
int head_number(){return head_num_;}
|
||||
|
||||
/**
|
||||
* @brief 返回数据行数
|
||||
*
|
||||
@ -187,109 +184,102 @@ namespace gctl
|
||||
int col_number(){return col_num_;}
|
||||
|
||||
/**
|
||||
* @brief 返回头信息
|
||||
* @brief 返回头信息行数
|
||||
*
|
||||
* @return 头信息
|
||||
* @return 行数
|
||||
*/
|
||||
const std::vector<std::string>& get_head_records(){return heads_;}
|
||||
|
||||
/**
|
||||
* @brief 返回注释行
|
||||
*
|
||||
* @return 注释行
|
||||
*/
|
||||
const std::vector<std::string>& get_annotoations(){return annotates_;}
|
||||
|
||||
/**
|
||||
* @brief 返回标记行
|
||||
*
|
||||
* @return 标记
|
||||
*/
|
||||
const std::vector<std::string>& get_tags(){return tags_;}
|
||||
|
||||
/**
|
||||
* @brief 获取行名称
|
||||
*
|
||||
* @param names 名称
|
||||
*/
|
||||
void get_row_names(std::vector<std::string> &names);
|
||||
|
||||
/**
|
||||
* @brief 获取列名称
|
||||
*
|
||||
* @param names 名称
|
||||
*/
|
||||
void get_column_names(std::vector<std::string> &names);
|
||||
|
||||
/**
|
||||
* @brief 设置列分隔符
|
||||
*
|
||||
* @param deli_sym 分隔符
|
||||
*/
|
||||
void set_delimeter(char deli_sym){deli_sym_ = deli_sym;}
|
||||
|
||||
/**
|
||||
* @brief 获取列分隔符
|
||||
*
|
||||
* @return 分隔符
|
||||
*/
|
||||
char get_delimeter(){return deli_sym_;}
|
||||
int head_number(){return head_num_;}
|
||||
|
||||
/**
|
||||
* @brief 设置头信息行数
|
||||
*
|
||||
* @param num 行数
|
||||
*/
|
||||
void set_head_number(char num){head_num_ = num;}
|
||||
void head_number(char num){head_num_ = num;}
|
||||
|
||||
/**
|
||||
* @brief 获取头信息行数
|
||||
*
|
||||
* @return 行数
|
||||
*/
|
||||
int get_head_number(){return head_num_;}
|
||||
|
||||
/**
|
||||
* @brief 设置注释行符号
|
||||
* @brief 返回头信息
|
||||
*
|
||||
* @param att_sym 注释符号
|
||||
* @return 头信息
|
||||
*/
|
||||
void set_annotation_symbol(char att_sym){att_sym_ = att_sym;}
|
||||
|
||||
/**
|
||||
* @brief 获取注释行符号
|
||||
*
|
||||
* @return 注释符号
|
||||
*/
|
||||
char get_annotation_symbol(){return att_sym_;}
|
||||
|
||||
/**
|
||||
* @brief 设置标记行符号
|
||||
*
|
||||
* @param tag_sym 标记符号
|
||||
*/
|
||||
void set_tag_symbol(char tag_sym){tag_sym_ = tag_sym;}
|
||||
const std::vector<std::string> &head_records(){return heads_;}
|
||||
|
||||
/**
|
||||
* @brief 设置头信息
|
||||
*
|
||||
* @param heads 头信息
|
||||
*/
|
||||
void set_head_records(const std::vector<std::string> &heads){heads_ = heads; head_num_ = heads_.size();}
|
||||
void head_records(const std::vector<std::string> &heads){heads_ = heads; head_num_ = heads_.size();}
|
||||
|
||||
/**
|
||||
* @brief 设置列分隔符
|
||||
*
|
||||
* @param deli_sym 分隔符
|
||||
*/
|
||||
void delimeter(char deli_sym){deli_sym_ = deli_sym;}
|
||||
|
||||
/**
|
||||
* @brief 获取列分隔符
|
||||
*
|
||||
* @return 分隔符
|
||||
*/
|
||||
char delimeter(){return deli_sym_;}
|
||||
|
||||
/**
|
||||
* @brief 设置注释行符号
|
||||
*
|
||||
* @param att_sym 注释符号
|
||||
*/
|
||||
void annotation_symbol(char att_sym){att_sym_ = att_sym;}
|
||||
|
||||
/**
|
||||
* @brief 获取注释行符号
|
||||
*
|
||||
* @return 注释符号
|
||||
*/
|
||||
char annotation_symbol(){return att_sym_;}
|
||||
|
||||
/**
|
||||
* @brief 设置注释
|
||||
*
|
||||
* @param att 注释
|
||||
*/
|
||||
void set_annotoations(const std::vector<std::string> &att){annotates_ = att;}
|
||||
void annotoations(const std::vector<std::string> &att){annotates_ = att;}
|
||||
|
||||
/**
|
||||
* @brief 返回注释行
|
||||
*
|
||||
* @return 注释行
|
||||
*/
|
||||
const std::vector<std::string> &annotoations(){return annotates_;}
|
||||
|
||||
/**
|
||||
* @brief 设置标记行符号
|
||||
*
|
||||
* @param tag_sym 标记符号
|
||||
*/
|
||||
void tag_symbol(char tag_sym){tag_sym_ = tag_sym;}
|
||||
|
||||
/**
|
||||
* @brief 获取标记行符号
|
||||
*
|
||||
* @return 标记符号
|
||||
*/
|
||||
char tag_symbol(){return tag_sym_;}
|
||||
|
||||
/**
|
||||
* @brief 设置标记
|
||||
*
|
||||
* @param tags 标记
|
||||
*/
|
||||
void set_tags(const std::vector<std::string> &tags){tags_ = tags;}
|
||||
void tags(const std::vector<std::string> &tags){tags_ = tags;}
|
||||
|
||||
/**
|
||||
* @brief 返回标记行
|
||||
*
|
||||
* @return 标记
|
||||
*/
|
||||
const std::vector<std::string> &tags(){return tags_;}
|
||||
|
||||
/**
|
||||
* @brief 设置行名称
|
||||
@ -298,7 +288,14 @@ namespace gctl
|
||||
* @param idx 索引数组(若为空则依次设置行名称)
|
||||
* @param corner_name 表格左上角位置名称(默认为RowNames)
|
||||
*/
|
||||
void set_row_names(const std::vector<std::string> &names, const std::vector<int> &idx = {}, std::string corner_name = "RowNames");
|
||||
void row_names(const std::vector<std::string> &names, const std::vector<int> &idx = {}, std::string corner_name = "RowNames");
|
||||
|
||||
/**
|
||||
* @brief 获取行名称
|
||||
*
|
||||
* @return 行名称
|
||||
*/
|
||||
std::vector<std::string> row_names();
|
||||
|
||||
/**
|
||||
* @brief 设置列名称
|
||||
@ -306,7 +303,14 @@ namespace gctl
|
||||
* @param names 名称数组
|
||||
* @param idx 索引数组(若为空则依次设置行名称)
|
||||
*/
|
||||
void set_column_names(const std::vector<std::string> &names, const std::vector<int> &idx = {});
|
||||
void column_names(const std::vector<std::string> &names, const std::vector<int> &idx = {});
|
||||
|
||||
/**
|
||||
* @brief 获取列名称
|
||||
*
|
||||
* @return 列名称
|
||||
*/
|
||||
std::vector<std::string> column_names();
|
||||
|
||||
/**
|
||||
* @brief 设置行类型
|
||||
@ -314,7 +318,7 @@ namespace gctl
|
||||
* @param t 类型名称 String|Float|Int
|
||||
* @param idx 行索引
|
||||
*/
|
||||
void set_row_type(cell_type_e t, int idx);
|
||||
void row_type(table_cell_type t, int idx);
|
||||
|
||||
/**
|
||||
* @brief 设置行类型
|
||||
@ -322,7 +326,7 @@ namespace gctl
|
||||
* @param t 类型名称 String|Float|Int
|
||||
* @param name 行名称
|
||||
*/
|
||||
void set_row_type(cell_type_e t, std::string name);
|
||||
void row_type(table_cell_type t, std::string name);
|
||||
|
||||
/**
|
||||
* @brief 设置列类型
|
||||
@ -330,7 +334,7 @@ namespace gctl
|
||||
* @param t 类型名称 String|Float|Int
|
||||
* @param idx 列索引
|
||||
*/
|
||||
void set_column_type(cell_type_e t, int idx);
|
||||
void column_type(table_cell_type t, int idx);
|
||||
|
||||
/**
|
||||
* @brief 设置列类型
|
||||
@ -338,7 +342,7 @@ namespace gctl
|
||||
* @param t 类型名称 String|Float|Int
|
||||
* @param name 列名称
|
||||
*/
|
||||
void set_column_type(cell_type_e t, std::string name);
|
||||
void column_type(table_cell_type t, std::string name);
|
||||
|
||||
/**
|
||||
* @brief 读入文本文件
|
||||
|
@ -238,7 +238,7 @@ void head(const std::vector<std::string> &cmd_units)
|
||||
for (size_t i = 1; i <= h; i++)
|
||||
{
|
||||
tc.get_row(line, i);
|
||||
line.show(std::cout, tc.get_delimeter());
|
||||
line.show(std::cout, tc.delimeter());
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -254,7 +254,7 @@ void tail(const std::vector<std::string> &cmd_units)
|
||||
for (size_t i = tc.row_number() - h + 1; i <= tc.row_number(); i++)
|
||||
{
|
||||
tc.get_row(line, i);
|
||||
line.show(std::cout, tc.get_delimeter());
|
||||
line.show(std::cout, tc.delimeter());
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -328,11 +328,11 @@ void load_file(const std::vector<std::string> &cmd_units)
|
||||
|
||||
int hnum = 0;
|
||||
if (copy_str[1] != "null") hnum = atoi(copy_str[1].c_str());
|
||||
if (hnum != 0) tc.set_head_number(hnum);
|
||||
if (hnum != 0) tc.head_number(hnum);
|
||||
|
||||
if (copy_str[2] != "null") tc.set_delimeter(copy_str[2][0]);
|
||||
if (copy_str[3] != "null") tc.set_annotation_symbol(copy_str[3][0]);
|
||||
if (copy_str[4] != "null") tc.set_tag_symbol(copy_str[4][0]);
|
||||
if (copy_str[2] != "null") tc.delimeter(copy_str[2][0]);
|
||||
if (copy_str[3] != "null") tc.annotation_symbol(copy_str[3][0]);
|
||||
if (copy_str[4] != "null") tc.tag_symbol(copy_str[4][0]);
|
||||
|
||||
std::string naked_name, exten_name;
|
||||
parse_filename(cmd_units[1], naked_name, exten_name);
|
||||
@ -353,9 +353,9 @@ void save_file(const std::vector<std::string> &cmd_units)
|
||||
copy_str[i] = cmd_units[i + 2];
|
||||
}
|
||||
|
||||
if (copy_str[0] != "null") tc.set_delimeter(copy_str[0][0]);
|
||||
if (copy_str[1] != "null") tc.set_annotation_symbol(copy_str[1][0]);
|
||||
if (copy_str[2] != "null") tc.set_tag_symbol(copy_str[2][0]);
|
||||
if (copy_str[0] != "null") tc.delimeter(copy_str[0][0]);
|
||||
if (copy_str[1] != "null") tc.annotation_symbol(copy_str[1][0]);
|
||||
if (copy_str[2] != "null") tc.tag_symbol(copy_str[2][0]);
|
||||
|
||||
std::string naked_name, exten_name;
|
||||
parse_filename(cmd_units[1], naked_name, exten_name);
|
||||
|
Loading…
Reference in New Issue
Block a user