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


C++ ON_wString::TrimLeftAndRight方法代码示例

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


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

示例1: SetAlternateSourceArchivePath

void ON_InstanceDefinition::SetAlternateSourceArchivePath( 
      const wchar_t* alternate_source_archive_path,
      bool bRelativePath
      )
{
  ON_wString s;
  if ( 0 != alternate_source_archive_path )
  {
    s = alternate_source_archive_path;
    s.TrimLeftAndRight();
    alternate_source_archive_path = s;
    if ( 0 != alternate_source_archive_path && 0 == alternate_source_archive_path[0] )
      alternate_source_archive_path = 0;
  }
  ON__IDefAlternativePathUserData* ud = ON__IDefAlternativePathUserData::FindOrCreate(*this,0!=alternate_source_archive_path);
  if ( 0 != ud )
  {
    if ( 0 == alternate_source_archive_path )
      delete ud;
    else
    {
      ud->m_alternate_path = alternate_source_archive_path;
      ud->m_bRelativePath = bRelativePath;
    }
  }
}
开发者ID:2php,项目名称:pcl,代码行数:26,代码来源:opennurbs_instance.cpp

示例2: RunCommand

CRhinoCommand::result CCommandSampleOpenIges::RunCommand( const CRhinoCommandContext& context )
{
  ON_wString filename;

  if( context.IsInteractive() )
  {
    DWORD dwFlags = OFN_ENABLESIZING | OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
    const wchar_t* szFilter = L"IGES Files (*.igs;*.iges)|*.igs; *.iges||";
    CWnd* pParentWnd = CWnd::FromHandle( RhinoApp().MainWnd() );

#if defined(WIN64)
    CFileDialog dialog( TRUE, L"igs", 0, dwFlags, szFilter, pParentWnd, 0, TRUE );
#else
    CFileDialog dialog( TRUE, L"igs", 0, dwFlags, szFilter, pParentWnd );
#endif
    INT_PTR rc = dialog.DoModal();
    if( rc != IDOK )
      return CRhinoCommand::cancel;

    filename = dialog.GetPathName();
  }
  else
  {
    CRhinoGetString gs;
    gs.SetCommandPrompt( L"IGES file to open" );
    gs.GetString();
    if( gs.CommandResult() != CRhinoCommand::success )
      return gs.CommandResult();

    filename = gs.String();
  }

  filename.TrimLeftAndRight();
  if( filename.IsEmpty() )
    return CRhinoCommand::nothing;

  if( !CRhinoFileUtilities::FileExists(filename) )
  {
    RhinoApp().Print( L"File \"%s\" not found.\n", filename );
    return CRhinoCommand::failure;
  }

  // Note, setting the document modified flag to false will prevent the
  // "Do you want to save this file..." mesasge from displaying when you
  // open a file (if the current document has been modified in any way).
  // But, you will (also) loose any modifications to the current document.
  // So, use the following line of code carefully.
  context.m_doc.SetModifiedFlag( FALSE );

  ON_wString script;
  script.Format( L"_-Open \"%s\" _Enter _Enter _Enter", filename );

  RhinoApp().RunScript( script, 0 );

  return CRhinoCommand::success;
}
开发者ID:619486,项目名称:Rhino5Samples_CPP,代码行数:56,代码来源:cmdSampleOpenIges.cpp

示例3: SetSourceArchive

void ON_InstanceDefinition::SetSourceArchive( const wchar_t* source_archive, 
                                              ON_CheckSum checksum,
                                              ON_InstanceDefinition::IDEF_UPDATE_TYPE idef_update_type)
{
  ON_wString s = source_archive;
  s.TrimLeftAndRight();
  m_source_archive = s;
  m_source_archive_checksum = checksum;
  if ( m_source_archive.IsEmpty() )
    m_idef_update_type = ON_InstanceDefinition::static_def;
  else
    m_idef_update_type = ON_InstanceDefinition::IdefUpdateType(idef_update_type);
}
开发者ID:jl2,项目名称:ONView,代码行数:13,代码来源:opennurbs_instance.cpp

示例4: RunCommand

CRhinoCommand::result CCommandSampleImportMeshes::RunCommand( const CRhinoCommandContext& context )
{
  CWnd* pMainWnd = CWnd::FromHandle(RhinoApp().MainWnd());
  if (0 == pMainWnd)
    return CRhinoCommand::failure;
 
  CRhinoGetFileDialog gf;
  gf.SetScriptMode(context.IsInteractive() ? FALSE : TRUE);
  BOOL rc = gf.DisplayFileDialog(CRhinoGetFileDialog::open_rhino_only_dialog, 0, pMainWnd);
  if (!rc)
    return CRhinoCommand::cancel;
 
  ON_wString filename = gf.FileName();
  filename.TrimLeftAndRight();
  if (filename.IsEmpty())
    return CRhinoCommand::nothing;

  if (!CRhinoFileUtilities::FileExists(filename))
  {
    RhinoApp().Print(L"File not found\n");
    return CRhinoCommand::failure;
  }

  FILE* archive_fp = ON::OpenFile(filename, L"rb");
  if (0 == archive_fp)
  {
    RhinoApp().Print(L"Unable to open file\n");
    return CRhinoCommand::failure;
  }

  ON_BinaryFile archive(ON::read3dm, archive_fp);

  ONX_Model model;
  rc = model.Read(archive) ? TRUE : FALSE;

  ON::CloseFile( archive_fp );

  if (!rc)
  {
    RhinoApp().Print(L"Error reading file\n");
    return CRhinoCommand::failure;
  }

  int num_imported = 0;
  for (int i = 0; i < model.m_object_table.Count(); i++)
  {
    const ONX_Model_Object& model_object = model.m_object_table[i];
    const ON_Mesh* mesh = ON_Mesh::Cast(model_object.m_object);
    if (0 != mesh)
    {
      // CRhinoDoc::AddMeshObject makes a copy of the input mesh
      context.m_doc.AddMeshObject(*mesh);
      num_imported++;
    }
  }

  if (0 == num_imported)
    RhinoApp().Print(L"No meshes imported\n");
  else if (1 == num_imported)
    RhinoApp().Print(L"1 mesh imported\n");
  else
    RhinoApp().Print(L"%d meshes imported\n", num_imported);

  context.m_doc.Redraw();

  return CRhinoCommand::success;
}
开发者ID:mcneel,项目名称:Rhino5Samples_CPP,代码行数:67,代码来源:cmdSampleImportMeshes.cpp


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