tmp
This commit is contained in:
parent
014d12cec4
commit
140848e882
@ -30,7 +30,6 @@
|
||||
|
||||
#include "../core.h"
|
||||
#include "../maths.h"
|
||||
#include "../io.h"
|
||||
|
||||
namespace gctl
|
||||
{
|
||||
|
@ -538,7 +538,7 @@ int gctl::dsv_io::name_index(std::string name, bool iter_row)
|
||||
{
|
||||
int r = atoi(std::string(ret[1]).c_str());
|
||||
if (r >= 1 && r <= row_num_) return r;
|
||||
else return -1;
|
||||
else return -2;
|
||||
}
|
||||
|
||||
return -1;
|
||||
@ -554,7 +554,7 @@ int gctl::dsv_io::name_index(std::string name, bool iter_row)
|
||||
{
|
||||
int c = atoi(std::string(ret[1]).c_str());
|
||||
if (c >= 1 && c <= col_num_) return c;
|
||||
else return -1;
|
||||
else return -2;
|
||||
}
|
||||
|
||||
return -1;
|
||||
@ -745,7 +745,15 @@ void gctl::dsv_io::filter(linebool_func_t func, table_headtype_e thead)
|
||||
void gctl::dsv_io::cal_column(std::string expr_str, const std::vector<std::string> &col_list, int p)
|
||||
{
|
||||
array<int> idx(col_list.size());
|
||||
for (size_t i = 0; i < col_list.size(); i++)
|
||||
idx[0] = name_index(col_list[0]);
|
||||
if (idx[0] < 0)
|
||||
{
|
||||
if (idx[0] == -1) add_column(col_list[0]);
|
||||
else add_column();
|
||||
column_type(Float, col_list[0]);
|
||||
}
|
||||
|
||||
for (size_t i = 1; i < col_list.size(); i++)
|
||||
{
|
||||
idx[i] = name_index(col_list[i]);
|
||||
|
||||
|
@ -441,8 +441,8 @@ namespace gctl
|
||||
* @brief 返回名称为name和R<id>和C<id>的行或列的索引
|
||||
*
|
||||
* @param name 名称 可以是具体的名称(如有),或者是R<id>和C<id>
|
||||
* @param iter_row 搜索行名称(默认为搜索列名称),如果name参数为R<id>和C<id>则此参数无效
|
||||
* @return 索引 返回的索引(大于等于1 小于等于行数或列数)失败则返回-1
|
||||
* @param iter_row 搜索行名称(默认为搜索列名称)
|
||||
* @return 索引 返回的索引(大于等于1 小于等于行数或列数)失败则返回-1表示匹配失败-2表示匹配成功但超过有效范围
|
||||
*/
|
||||
int name_index(std::string name, bool iter_row = false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user