本文整理汇总了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
}
示例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);
}
}