当前位置: 首页>>代码示例>>C++>>正文


C++ Dynamic::InsertRow方法代码示例

本文整理汇总了C++中Dynamic::InsertRow方法的典型用法代码示例。如果您正苦于以下问题:C++ Dynamic::InsertRow方法的具体用法?C++ Dynamic::InsertRow怎么用?C++ Dynamic::InsertRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dynamic的用法示例。


在下文中一共展示了Dynamic::InsertRow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DeleteCases

  void DeleteCases()
  {
    std::string error;
    Dynamic table = TABLE;
    nkit::TableIndex::Ptr index;
    nkit::TableIndex::ConstIterator it;

    COMMON_TABLE_INIT(table);

    index = table.CreateIndex("name,name1,name3", &error);

    // Fail cases tests
    NKIT_TEST_ASSERT(index);
    NKIT_TEST_ASSERT(index->GetEqual(Dynamic(3), Dynamic(1)) == index->end());
    NKIT_TEST_ASSERT(index->GetEqual(Dynamic("A3"), Dynamic(3)) == index->end());

    // Good cases tests
    for (size_t ops = 0; ops < TABLE_GROW_SIZE; ++ops)
    {
      DynamicVector vargs;
      vargs.push_back(Dynamic("A3"));
      vargs.push_back(Dynamic(3));
      vargs.push_back(Dynamic(false));
      vargs.push_back(Dynamic(1));
      vargs.push_back(Dynamic(double(2.0 + ops)));
      NKIT_TEST_ASSERT(table.InsertRow(0, vargs));
    }

    for (size_t ops = 0; ops < TABLE_GROW_SIZE; ++ops)
      NKIT_TEST_ASSERT(table.DeleteRow(0));

    it = index->GetEqual(Dynamic("A3"), Dynamic(3), Dynamic(1));
    NKIT_TEST_ASSERT(it != index->end());
    for (; it != index->end(); ++it)
    {
  #if defined(MY_TRACE_)
        print(it[4]);
  #endif // MY_TRACE_
    }

    NKIT_TEST_ASSERT(table == e);
  }
开发者ID:dedok,项目名称:nkit,代码行数:42,代码来源:test_dynamic_table.cpp

示例2: InsertCases

  void InsertCases()
  {
    std::string error;
    Dynamic table = TABLE;
    nkit::TableIndex::Ptr index;
    nkit::TableIndex::ConstIterator it;

    COMMON_TABLE_INIT(table);

    // Fail cases tests
    for (size_t ops = 0; ops < TABLE_GROW_SIZE; ++ops) // wrong type
    {
      DynamicVector vargs;
      vargs.push_back(Dynamic(1));
      vargs.push_back(Dynamic(3));
      vargs.push_back(Dynamic(false));
      vargs.push_back(Dynamic(1));
      vargs.push_back(Dynamic("name"));
      NKIT_TEST_ASSERT(table.InsertRow(0, vargs) == false);
    }
    NKIT_TEST_ASSERT(table == e);

    index = table.CreateIndex("name,name1,name3", &error);
    NKIT_TEST_ASSERT(index);
    NKIT_TEST_ASSERT(index->GetEqual(Dynamic(3), Dynamic(1)) == index->end());
    NKIT_TEST_ASSERT(index->GetEqual(Dynamic("A3"), Dynamic(3)) == index->end());

    // Good cases tests
    for (size_t ops = 0; ops < TABLE_GROW_SIZE; ++ops)
    {
      DynamicVector vargs;
      vargs.push_back(Dynamic("A3"));
      vargs.push_back(Dynamic(3));
      vargs.push_back(Dynamic(false));
      vargs.push_back(Dynamic(1));
      vargs.push_back(Dynamic(double(2.0 + ops)));
      NKIT_TEST_ASSERT(table.InsertRow(0, vargs));
    }
    it = index->GetEqual(Dynamic("A3"), Dynamic(3), Dynamic(1));
    NKIT_TEST_ASSERT(it != index->end());
    for (; it != index->end(); ++it)
    {
  #if defined(MY_TRACE_)
        print(it[4]);
  #endif // MY_TRACE_
    }

    for (size_t ops = 0; ops < TABLE_GROW_SIZE; ++ops)
    {
      DynamicVector vargs;
      vargs.push_back(Dynamic("A10"));
      vargs.push_back(Dynamic(3));
      vargs.push_back(Dynamic(false));
      vargs.push_back(Dynamic(1));
      vargs.push_back(Dynamic(double(1.0 + ops)));
      NKIT_TEST_ASSERT(table.InsertRow(table.height() / 2, vargs));
    }

    it = index->GetEqual(Dynamic("A10"), Dynamic(3), Dynamic(1));
    NKIT_TEST_ASSERT(it != index->end());
    for (; it != index->end(); ++it)
    {
  #if defined(MY_TRACE_)
        print(it[4]);
  #endif // MY_TRACE_
    }

    it = index->GetEqual(Dynamic("A"), Dynamic(1), Dynamic(1));
    NKIT_TEST_ASSERT(it != index->end());
    NKIT_TEST_ASSERT(it[4] == Dynamic(99.0));

    it = index->GetEqual(Dynamic("A2"), Dynamic(2), Dynamic::GetDefault(detail::INTEGER));
    NKIT_TEST_ASSERT(it != index->end());

    it = index->GetEqual(Dynamic("A1"), Dynamic(1), Dynamic::GetDefault(detail::INTEGER));
    NKIT_TEST_ASSERT(it != index->end());
  }
开发者ID:dedok,项目名称:nkit,代码行数:77,代码来源:test_dynamic_table.cpp


注:本文中的Dynamic::InsertRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。