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


C++ Path::RemoveExtension方法代码示例

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


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

示例1: OnOpenTemplate

   /// <summary>Opens a document template.</summary>
   /// <param name="docPath">document path.</param>
   /// <param name="t">template.</param>
   /// <returns></returns>
   BOOL ScriptDocument::OnOpenTemplate(Path docPath, const TemplateFile& t)
   {
      WorkerData data(Operation::LoadSaveDocument);
      
      try
      {
         // Feedback
         Console << Cons::UserAction << "Creating script: " << docPath << " from template: " << Path(t.SubPath) << ENDL;
         data.SendFeedback(ProgressType::Operation, 0, VString(L"Creating %s '%s'", t.Name.c_str(), docPath.c_str()));

         // Read/Parse template script
         AppPath path(t.SubPath);
         Script = ScriptFileReader(XFileInfo(path).OpenRead()).ReadFile(path, false);

         // Set properties
         Script.Name = docPath.RemoveExtension().FileName;
         Script.Game = PrefsLib.GameDataVersion;
         Script.Version = 1;
         Script.Description = L"no description";

         // Populate template
         LineArray lines;
         wstring date = COleDateTime(time(nullptr)).Format(L"%d/%m/%Y");
         for (auto& cmd : Script.Commands.Input)
         {
            cmd.Text = cmd.Text.ReplaceAll(L"$NAME$", Script.Name);
            cmd.Text = cmd.Text.ReplaceAll(L"$DATE$", date);
            cmd.Text = cmd.Text.ReplaceAll(L"$AUTHOR$", L"");
            lines.push_back(cmd.Text);
         }

         // Create temp scriptFile
         ScriptFile tmp(Script);
         tmp.FullPath = docPath;

         // Compile changes into temporary script
         ScriptParser parser(tmp, lines, Script.Game);
         parser.Compile();
         
         // Write to disc
         ScriptFileWriter w(XFileInfo(docPath).OpenWrite());
         w.Write(tmp);
         w.Close();

         // Feedback
         data.SendFeedback(Cons::Success, ProgressType::Succcess, 0, L"Script created successfully");
         return TRUE;
      }
      catch (ExceptionBase&  e)
      {
         // Feedback/Display error
         data.SendFeedback(Cons::Error, ProgressType::Failure, 0, VString(L"Failed to create %s '%s'", t.Name.c_str(), docPath.c_str()));
         theApp.ShowError(HERE, e, VString(L"Failed to create %s '%s'", t.Name.c_str(), docPath.c_str()));
         return FALSE;
      }
   }
开发者ID:CyberSys,项目名称:X-Studio-2,代码行数:60,代码来源:ScriptDocument.cpp

示例2: Matches

 /// <summary>Compares descriptor against the specified path.</summary>
 /// <param name="path">The path to compare against</param>
 /// <param name="checkExtension">Whether the file extension must also match</param>
 /// <returns></returns>
 bool  XFileInfo::Matches(Path path, bool checkExtension) const
 {
    return checkExtension ? FullPath == path : Key == path.RemoveExtension(); 
 }
开发者ID:CyberSys,项目名称:X-Studio-2,代码行数:8,代码来源:XFileInfo.cpp


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