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


C++ FileManager::AddGmatFunctionPath方法代码示例

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


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

示例1: SaveData

//------------------------------------------------------------------------------
// virtual void SaveData()
//------------------------------------------------------------------------------
void SetPathDialog::SaveData()
{
   #ifdef DEBUG_SETPATH_DIALOG_SAVE
   MessageInterface::ShowMessage(wxT("SetPathDialog::SaveData() entered.\n"));
   #endif
   
   canClose = true;
   
   FileManager *fm = FileManager::Instance();
   wxArrayString pathNames;
   
   // Gmat Function paths
   if (mGmatFunPathPanel->HasDataChanged())
   {
      #ifdef DEBUG_SETPATH_DIALOG_SAVE
      MessageInterface::ShowMessage(wxT("   Saving GmatFunction paths...\n"));
      #endif
      
      pathNames = mGmatFunPathPanel->GetPathNames();
      
      #ifdef DEBUG_SETPATH_DIALOG_SAVE
      MessageInterface::ShowMessage(wxT("   ...Adding %d paths\n"), pathNames.GetCount());
      #endif
      
      fm->ClearGmatFunctionPath();
      for (UnsignedInt i=0; i<pathNames.GetCount(); i++)
      {
         #ifdef DEBUG_SETPATH_DIALOG_SAVE
         MessageInterface::ShowMessage(wxT("   ...Adding '%s'\n"), pathNames[i].c_str());
         #endif
         
         fm->AddGmatFunctionPath(pathNames[i].c_str(), false);
      }
   }
   
   // Matlab Function paths
   if (mMatlabPathPanel->HasDataChanged())
   {
      #ifdef DEBUG_SETPATH_DIALOG_SAVE
      MessageInterface::ShowMessage(wxT("   Saving MatlabFunction paths...\n"));
      #endif
      
      pathNames = mMatlabPathPanel->GetPathNames();
      fm->ClearMatlabFunctionPath();
      for (UnsignedInt i=0; i<pathNames.GetCount(); i++)
         fm->AddMatlabFunctionPath(pathNames[i].c_str(), false);
   }
   
   // Log file path
   if (mOutputPathPanel->HasDataChanged())
   {
      wxString pathName = mOutputPathPanel->GetFullPathName().c_str();
      if (wxDir::Exists(pathName.c_str()))
      {
         #ifdef DEBUG_SETPATH_DIALOG_SAVE
         MessageInterface::ShowMessage(wxT("   Saving Log path to '%s'\n"), pathName.c_str());
         #endif
         
         fm->SetAbsPathname(wxT("OUTPUT_PATH"), pathName);
         MessageInterface::SetLogPath(pathName);
      }
      else
      {
         wxString str;
         str.Printf(wxT("The directory \" %s \" does not exist.\n"), pathName.c_str());
         wxMessageBox(str,
                      wxT("Directory Error"));
         
         // find page
         int numPage = mPathNotebook->GetPageCount();
         for (int i=0; i<numPage; i++)
         {
            if (mPathNotebook->GetPageText(i) == wxT("Output"))
            {
               mPathNotebook->SetSelection(i);
               break;
            }
         }
         canClose = false;
      }
   }
   
   #ifdef DEBUG_SETPATH_DIALOG_SAVE
   MessageInterface::ShowMessage(wxT("SetPathDialog::SaveData() exiting.\n"));
   #endif
}
开发者ID:,项目名称:,代码行数:89,代码来源:

示例2: SetStringParameter

//------------------------------------------------------------------------------
bool GmatFunction::SetStringParameter(const Integer id, const wxString &value)
{
   #ifdef DEBUG_FUNCTION_SET
   MessageInterface::ShowMessage
      (wxT("GmatFunction::SetStringParameter() entered, id=%d, value=%s\n"), id, value.c_str());
   #endif
   
   switch (id)
   {
   case FUNCTION_PATH:
      {
         FileManager *fm = FileManager::Instance();
         
         // Compose full path if it has relative path.
         // Assuming if first char has '.', it has relative path.
         wxString temp = GmatStringUtil::Trim(value);
         if (temp[0] == wxT('.'))
         {
            wxString currPath = fm->GetCurrentPath();
            
            #ifdef DEBUG_FUNCTION_SET
            MessageInterface::ShowMessage(wxT("   currPath=%s\n"), currPath.c_str());
            #endif
            
            functionPath = currPath + temp.substr(1);
         }
         else
         {
            functionPath = value;
         }
         
         // Add to GmatFunction path
         fm->AddGmatFunctionPath(functionPath);
         
         // Remove path
         functionName = GmatFileUtil::ParseFileName(functionPath);
         
         // Remove .gmf if GmatGmatFunction
         wxString::size_type dotIndex = functionName.find(wxT(".gmf"));
         functionName = functionName.substr(0, dotIndex);
         
         #ifdef DEBUG_FUNCTION_SET
         MessageInterface::ShowMessage
            (wxT("   functionPath=<%s>\n"), functionPath.c_str());
         MessageInterface::ShowMessage
            (wxT("   functionName=<%s>\n"), functionName.c_str());
         #endif
         
         return true;
      }
   case FUNCTION_NAME:
      {
         // Remove path if it has one
         functionName = GmatFileUtil::ParseFileName(functionPath);
         
         // Remove .gmf if GmatGmatFunction
         wxString::size_type dotIndex = functionName.find(wxT(".gmf"));
         functionName = functionName.substr(0, dotIndex);
         
         return true;
      }
   default:
      return Function::SetStringParameter(id, value);
   }
}
开发者ID:,项目名称:,代码行数:66,代码来源:


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