void ON_3dmObjectAttributes::Dump( ON_TextLog& dump ) const
{
  const wchar_t* wsName = m_name;
  if ( !wsName )
    wsName = L"";
  dump.Print("object name = \"%ls\"\n",wsName);

  dump.Print("object uuid = ");
  dump.Print(m_uuid);
  dump.Print("\n");

  const char* sMode = "unknown";
  switch( Mode() )
  {
  case ON::normal_object:
    sMode = "normal";
    break;
  case ON::hidden_object:
    sMode = "hidden";
    break;
  case ON::locked_object:
    sMode = "locked";
    break;
  default:
    sMode = "unknown";
    break;
  }
  dump.Print("object mode = %s\n",sMode); // sSMode is const char*

  dump.Print("object layer index = %d\n",m_layer_index);
  dump.Print("object material index = %d\n",m_material_index);
  const char* sMaterialSource = "unknown";
  switch(MaterialSource()) {
  case ON::material_from_layer: sMaterialSource = "layer material"; break;
  case ON::material_from_object: sMaterialSource = "object material"; break;
  case ON::material_from_parent: sMaterialSource = "parent material"; break;
  }
  dump.Print("material source = %s\n",sMaterialSource); // sMaterialSource is const char*
  const int group_count = GroupCount();
  if ( group_count > 0 ) {
    const int* group = GroupList();
    dump.Print("groups: ");
    int i;
    for ( i = 0; i < group_count; i++ ) {
      if ( i )
        dump.Print(",%d",group[i]);
      else
        dump.Print("%d",group[i]);
    }
    dump.Print("\n");
  }
}
ON_BOOL32 ON_3dmObjectAttributes::IsInGroups( int group_count, const int* group_list ) const
{
  // returns true if object is in any of the groups in the list
  ON_BOOL32 rc = false;
  if ( group_count > 0 && group_list ) {
    const int obj_group_count  = GroupCount();
    const int* obj_group_list = GroupList();
    // in practice these arrays will be very short and this search will be fast
    int i, j;
    for ( i = 0; i < obj_group_count; i++ ) for ( j = 0; j < group_count; j++ ) {
      if ( obj_group_list[i] == group_list[j] )
        return true;
    }
  }
  return rc;
}
Beispiel #3
0
void TestRunner::runGroups()
{
    if (m_groupStack.empty())
        return;

    auto& groups = m_groupStack.back();
    if (!groups.empty()) {
        for (auto& group : groups) {
            m_callStack.emplace_back(std::move(group.first));
            m_groupStack.emplace_back(GroupList());
            group.second();
            runGroups();
            m_callStack.pop_back();
        }
    }
    m_groupStack.pop_back();
}
Beispiel #4
0
void TestRunner::run(const TestRunner::Function &tests) {
    m_groupStack.emplace_back(GroupList());
    tests();
    runGroups();
}