This commit is contained in:
张壹 2025-02-13 16:41:14 +08:00
parent 014d12cec4
commit 140848e882
3 changed files with 13 additions and 6 deletions

View File

@ -30,7 +30,6 @@
#include "../core.h"
#include "../maths.h"
#include "../io.h"
namespace gctl
{

View File

@ -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]);

View File

@ -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);