• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Path函数的典型用法代码示例。如果您正苦于以下问题:C++ Path函数的具体用法?C++ Path怎么用?C++ Path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: IsAbsolute

 gcc_pure
 bool IsAbsolute() const {
   return Path(*this).IsAbsolute();
 }
开发者ID:ToninoTarsi,项目名称:XCSoar,代码行数:4,代码来源:Path.hpp


示例2: DebugAssert

//---------------------------------------------------------------------------
bool __fastcall TFileZillaIntf::MakeDir(const wchar_t* APath)
{
  DebugAssert(FFileZillaApi != NULL);
  CServerPath Path(APath);
  return Check(FFileZillaApi->MakeDir(Path), L"makedir");
}
开发者ID:anyue100,项目名称:winscp,代码行数:7,代码来源:FileZillaIntf.cpp


示例3: getpwuid

Path System::GetUserDir()
{
    struct passwd* pw = getpwuid(getuid());
    return Path(pw->pw_dir);
}
开发者ID:septag,项目名称:stcore,代码行数:5,代码来源:System.cpp


示例4: ERR_FAIL_COND

void AnimationCache::_update_cache() {

	cache_valid = false;

	ERR_FAIL_COND(!root);
	ERR_FAIL_COND(!root->is_inside_tree());
	ERR_FAIL_COND(animation.is_null());

	for (int i = 0; i < animation->get_track_count(); i++) {

		NodePath np = animation->track_get_path(i);

		Node *node = root->get_node(np);
		if (!node) {

			path_cache.push_back(Path());
			ERR_EXPLAIN("Invalid Track Path in Animation: " + np);
			ERR_CONTINUE(!node);
		}

		Path path;

		Ref<Resource> res;

		if (animation->track_get_type(i) == Animation::TYPE_TRANSFORM) {

			if (np.get_subname_count() > 1) {
				path_cache.push_back(Path());
				ERR_EXPLAIN("Transform tracks can't have a subpath: " + np);
				ERR_CONTINUE(animation->track_get_type(i) == Animation::TYPE_TRANSFORM);
			}

			Spatial *sp = Object::cast_to<Spatial>(node);

			if (!sp) {

				path_cache.push_back(Path());
				ERR_EXPLAIN("Transform track not of type Spatial: " + np);
				ERR_CONTINUE(!sp);
			}

			if (np.get_subname_count() == 1) {
				StringName property = np.get_subname(0);
				String ps = property;

				Skeleton *sk = Object::cast_to<Skeleton>(node);
				if (!sk) {

					path_cache.push_back(Path());
					ERR_EXPLAIN("Property defined in Transform track, but not a Skeleton!: " + np);
					ERR_CONTINUE(!sk);
				}

				int idx = sk->find_bone(ps);
				if (idx == -1) {
					path_cache.push_back(Path());
					ERR_EXPLAIN("Property defined in Transform track, but not a Skeleton Bone!: " + np);
					ERR_CONTINUE(idx == -1);
				}

				path.bone_idx = idx;
				path.skeleton = sk;
			}

			path.spatial = sp;

		} else {
			if (np.get_subname_count() > 0) {

				RES res2;
				Vector<StringName> leftover_subpath;

				// We don't want to cache the last resource unless it is a method call
				bool is_method = animation->track_get_type(i) == Animation::TYPE_METHOD;
				root->get_node_and_resource(np, res2, leftover_subpath, is_method);

				if (res2.is_valid()) {
					path.resource = res2;
				} else {
					path.node = node;
				}
				path.object = res2.is_valid() ? res2.ptr() : (Object *)node;
				path.subpath = leftover_subpath;

			} else {

				path.node = node;
				path.object = node;
				path.subpath = np.get_subnames();
			}
		}

		if (animation->track_get_type(i) == Animation::TYPE_VALUE) {

			if (np.get_subname_count() == 0) {

				path_cache.push_back(Path());
				ERR_EXPLAIN("Value Track lacks property: " + np);
				ERR_CONTINUE(np.get_subname_count() == 0);
			}
//.........这里部分代码省略.........
开发者ID:Paulloz,项目名称:godot,代码行数:101,代码来源:animation_cache.cpp


示例5: Startup

/**
 * "Boots" up XCSoar
 * @param hInstance Instance handle
 * @param lpCmdLine Command line string
 * @return True if bootup successful, False otherwise
 */
bool
Startup()
{
  VerboseOperationEnvironment operation;

#ifdef HAVE_DOWNLOAD_MANAGER
  Net::DownloadManager::Initialise();
#endif

  LogFormat("Display dpi=%u,%u", Display::GetXDPI(), Display::GetYDPI());

  // Creates the main window

  TopWindowStyle style;
  if (CommandLine::full_screen)
    style.FullScreen();

  style.Resizable();

  MainWindow *const main_window = CommonInterface::main_window =
    new MainWindow();
  main_window->Create(SystemWindowSize(), style);
  if (!main_window->IsDefined())
    return false;

#ifdef ENABLE_OPENGL
  LogFormat("OpenGL: "
#ifdef ANDROID
#ifdef USE_EGL
            "egl=native "
#else
            "egl=no "
#endif
#endif
#ifdef HAVE_OES_DRAW_TEXTURE
            "oesdt=%d "
#endif
#ifdef HAVE_DYNAMIC_MULTI_DRAW_ARRAYS
            "mda=%d "
#endif
            "npot=%d vbo=%d fbo=%d stencil=%#x",
#ifdef HAVE_OES_DRAW_TEXTURE
            OpenGL::oes_draw_texture,
#endif
#ifdef HAVE_DYNAMIC_MULTI_DRAW_ARRAYS
            GLExt::HaveMultiDrawElements(),
#endif
             OpenGL::texture_non_power_of_two,
             OpenGL::vertex_buffer_object,
            OpenGL::frame_buffer_object,
            OpenGL::render_buffer_stencil);
#endif

  CommonInterface::SetUISettings().SetDefaults();
  main_window->Initialise();

#ifdef SIMULATOR_AVAILABLE
  // prompt for simulator if not set by command line argument "-simulator" or "-fly"
  if (!sim_set_in_cmd_line_flag) {
    SimulatorPromptResult result = dlgSimulatorPromptShowModal();
    switch (result) {
    case SPR_QUIT:
      return false;

    case SPR_FLY:
      global_simulator_flag = false;
      break;

    case SPR_SIMULATOR:
      global_simulator_flag = true;
      break;
    }
  }
#endif

  CommonInterface::SetSystemSettings().SetDefaults();
  CommonInterface::SetComputerSettings().SetDefaults();
  CommonInterface::SetUIState().Clear();

  const auto &computer_settings = CommonInterface::GetComputerSettings();
  const auto &ui_settings = CommonInterface::GetUISettings();
  auto &live_blackboard = CommonInterface::GetLiveBlackboard();

  if (!LoadProfile())
    return false;

  operation.SetText(_("Initialising"));

  /* create XCSoarData on the first start */
  CreateDataPath();

  Display::LoadOrientation(operation);
  main_window->CheckResize();

//.........这里部分代码省略.........
开发者ID:nkgautam,项目名称:XCSoar,代码行数:101,代码来源:Startup.cpp


示例6: Path

HRESULT CHdmvClipInfo::ReadPlaylist(CString strPlaylistFile, REFERENCE_TIME& rtDuration, CAtlList<PlaylistItem>& Playlist)
{
    CPath Path(strPlaylistFile);
    rtDuration = 0;

    // Get BDMV folder
    Path.RemoveFileSpec();
    Path.RemoveFileSpec();

    m_hFile = CreateFile(strPlaylistFile, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr,
                         OPEN_EXISTING, FILE_ATTRIBUTE_READONLY | FILE_FLAG_SEQUENTIAL_SCAN, nullptr);

    if (m_hFile != INVALID_HANDLE_VALUE) {
        BYTE Buff[100];
        bool bDuplicate = false;
        ReadBuffer(Buff, 4);
        if (memcmp(Buff, "MPLS", 4)) {
            return CloseFile(VFW_E_INVALID_FILE_FORMAT);
        }

        ReadBuffer(Buff, 4);
        if ((memcmp(Buff, "0200", 4) != 0) && (memcmp(Buff, "0100", 4) != 0)) {
            return CloseFile(VFW_E_INVALID_FILE_FORMAT);
        }

        LARGE_INTEGER Pos;
        unsigned short nPlaylistItems;

        Pos.QuadPart = ReadDword(); // PlayList_start_address
        ReadDword();                // PlayListMark_start_address

        // PlayList()
        SetFilePointerEx(m_hFile, Pos, nullptr, FILE_BEGIN);
        ReadDword();                   // length
        ReadShort();                   // reserved_for_future_use
        nPlaylistItems = ReadShort();  // number_of_PlayItems
        ReadShort();                   // number_of_SubPaths

        Pos.QuadPart += 10;
        for (size_t i = 0; i < nPlaylistItems; i++) {
            DWORD dwTemp;
            PlaylistItem Item;
            SetFilePointerEx(m_hFile, Pos, nullptr, FILE_BEGIN);
            Pos.QuadPart += ReadShort() + 2;
            ReadBuffer(Buff, 5);
            Item.m_strFileName.Format(_T("%s\\STREAM\\%c%c%c%c%c.M2TS"), Path, Buff[0], Buff[1], Buff[2], Buff[3], Buff[4]);

            ReadBuffer(Buff, 4);
            if (memcmp(Buff, "M2TS", 4)) {
                return CloseFile(VFW_E_INVALID_FILE_FORMAT);
            }
            ReadBuffer(Buff, 3);

            dwTemp = ReadDword();
            Item.m_rtIn = 20000i64 * dwTemp / 90; // Carefull : 32->33 bits!

            dwTemp = ReadDword();
            Item.m_rtOut = 20000i64 * dwTemp / 90; // Carefull : 32->33 bits!

            rtDuration += (Item.m_rtOut - Item.m_rtIn);

            if (Playlist.Find(Item) != nullptr) {
                bDuplicate = true;
            }
            Playlist.AddTail(Item);

            //TRACE(_T("File : %s, Duration : %s, Total duration  : %s\n"), strTemp, ReftimeToString (rtOut - rtIn), ReftimeToString (rtDuration));
        }

        CloseFile(S_OK);
        return bDuplicate ? S_FALSE : S_OK;
    }

    return AmHresultFromWin32(GetLastError());
}
开发者ID:JanWillem32,项目名称:mpc-hc,代码行数:75,代码来源:HdmvClipInfo.cpp


示例7: GetExtension

 gcc_pure
 const_pointer GetExtension() const {
   return Path(*this).GetExtension();
 }
开发者ID:ToninoTarsi,项目名称:XCSoar,代码行数:4,代码来源:Path.hpp


示例8: WithExtension

 gcc_pure
 AllocatedPath WithExtension(const_pointer new_extension) const {
   return Path(*this).WithExtension(new_extension);
 }
开发者ID:ToninoTarsi,项目名称:XCSoar,代码行数:4,代码来源:Path.hpp


示例9: RelativeTo

 /**
  * Check if this object is "inside" to the given path, and if yes,
  * return the relative path.
  */
 gcc_pure
 Path RelativeTo(Path parent) const {
   return Path(*this).RelativeTo(parent);
 }
开发者ID:ToninoTarsi,项目名称:XCSoar,代码行数:8,代码来源:Path.hpp


示例10: MatchesExtension

 gcc_pure
 bool MatchesExtension(const_pointer extension) const {
   return Path(*this).MatchesExtension(extension);
 }
开发者ID:ToninoTarsi,项目名称:XCSoar,代码行数:4,代码来源:Path.hpp


示例11: GetBase

 gcc_pure
 Path GetBase() const {
   return Path(*this).GetBase();
 }
开发者ID:ToninoTarsi,项目名称:XCSoar,代码行数:4,代码来源:Path.hpp


示例12: GetParent

 AllocatedPath GetParent() const {
   return Path(*this).GetParent();
 }
开发者ID:ToninoTarsi,项目名称:XCSoar,代码行数:3,代码来源:Path.hpp


示例13: IsBase

 gcc_pure
 bool IsBase() const {
   return Path(*this).IsBase();
 }
开发者ID:ToninoTarsi,项目名称:XCSoar,代码行数:4,代码来源:Path.hpp


示例14: Path

Path DirectoryInfo::GetPath() const
{
    return Path( m_path );
}
开发者ID:darcyg,项目名称:Caramel,代码行数:4,代码来源:FileSystem.cpp


示例15: printf

void Being::adjustCourse(int srcX, int srcY, int dstX, int dstY)
{
    if (debug_movement)
        printf("%p adjustCourse(%d, %d, %d, %d)\n",
                (void*) this, srcX, srcY, dstX, dstY);

    mDest.x = dstX;
    mDest.y = dstY;

    // Find a path to the destination when it is at least a tile away
    if (mMap && fabsf((mDest - mPos).length()) > 32) {
        setPath(mMap->findPath((int) mPos.x / 32, (int) mPos.y / 32,
                               dstX / 32, dstY / 32, getWalkMask()));
    } else {
        setPath(Path());
    }

    // TODO: Evaluate the implementation of this method
    /*
    if (mX / 32 == dstX / 32 && mY / 32 == dstY / 32)
    {
        // The being is already on the last tile of the path.
        Path p;
        p.push_back(Position(dstX, dstY));
        setPath(p);
        return;
    }

    Path p1;
    int p1_size, p1_length;
    Uint16 *p1_dist;
    int onPath = -1;
    if (srcX / 32 == dstX / 32 && srcY / 32 == dstY / 32)
    {
        p1_dist = new Uint16[1];
        p1_size = 1;
        p1_dist[0] = 0;
        p1_length = 0;
    }
    else
    {
        p1 = mMap->findPath(srcX / 32, srcY / 32, dstX / 32, dstY / 32, getWalkMask());
        if (p1.empty())
        {
            // No path, but don't teleport since it could be user input.
            setPath(p1);
            return;
        }
        p1_size = p1.size();
        p1_dist = new Uint16[p1_size];
        int j = 0;
        // Remove last tile so that it can be replaced by the exact destination.
        p1.pop_back();
        for (Path::iterator i = p1.begin(), i_end = p1.end(); i != i_end; ++i)
        {
            // Get distance from source to tile i.
            p1_dist[j] = mMap->getMetaTile(i->x, i->y)->Gcost;
            // Check if the being is already walking on the path.
            if (i->x == mX / 32 && i->y == mY / 32)
            {
                onPath = j;
            }
            // Do not set any offset for intermediate steps.
            i->x = i->x * 32;
            i->y = i->y * 32;
            ++j;
        }
        p1_length = mMap->getMetaTile(dstX / 32, dstY / 32)->Gcost;
        p1_dist[p1_size - 1] = p1_length;
    }
    p1.push_back(Position(dstX, dstY));

    if (mX / 32 == srcX / 32 && mY / 32 == srcY / 32)
    {
        // The being is at the start of the path.
        setPath(p1);
        delete[] p1_dist;
        return;
    }

    if (onPath >= 0)
    {
        // The being is already on the path, but it needs to be slowed down.
        for (int j = onPath; j >= 0; --j)
        {
            p1.pop_front();
        }
        int r = p1_length - p1_dist[onPath];  // remaining length
        assert(r > 0);
        setPath(p1, p1_length * 1024 / r);
        delete[] p1_dist;
        return;
    }

    Path bestPath;
    int bestRating = -1, bestStart = 0, bestLength = 0;
    int j = 0;

    for (Path::iterator i = p1.begin(), i_end = p1.end(); i != i_end; ++i)
    {
//.........这里部分代码省略.........
开发者ID:kai62656,项目名称:manabot,代码行数:101,代码来源:being.cpp


示例16: toPath

	inline Path toPath() const       { check(type_ & StringType, illegalConversion()); return Path(String(*this)); }
开发者ID:corelon,项目名称:paco,代码行数:1,代码来源:Variant.hpp


示例17: location

CmdEdit::editResult CmdEdit::editFile (Task& task)
{
  // Check for file permissions.
  Directory location (context.config.get ("data.location"));
  if (! location.writable ())
    throw std::string (STRING_EDIT_UNWRITABLE);

  // Create a temp file name in data.location.
  std::stringstream file;
  file << "task." << task.get ("uuid").substr (0, 8) << ".task";

  // Determine the output date format, which uses a hierarchy of definitions.
  //   rc.dateformat.edit
  //   rc.dateformat
  std::string dateformat = context.config.get ("dateformat.edit");
  if (dateformat == "")
    dateformat = context.config.get ("dateformat");

  // Change directory for the editor
  std::string current_dir = Directory::cwd ();
  int ignored = chdir (location._data.c_str ());
  ++ignored; // Keep compiler quiet.

  // Check if the file already exists, if so, bail out
  Path filepath = Path (file.str ());
  if (filepath.exists ())
    throw std::string (STRING_EDIT_IN_PROGRESS);

  // Format the contents, T -> text, write to a file.
  std::string before = formatTask (task, dateformat);
  std::string before_orig = before;
  File::write (file.str (), before);

  // Determine correct editor: .taskrc:editor > $VISUAL > $EDITOR > vi
  std::string editor = context.config.get ("editor");
  char* peditor = getenv ("VISUAL");
  if (editor == "" && peditor) editor = std::string (peditor);
  peditor = getenv ("EDITOR");
  if (editor == "" && peditor) editor = std::string (peditor);
  if (editor == "") editor = "vi";

  // Complete the command line.
  editor += " ";
  editor += "\"" + file.str () + "\"";

ARE_THESE_REALLY_HARMFUL:
  bool changes = false; // No changes made.

  // Launch the editor.
  std::cout << format (STRING_EDIT_LAUNCHING, editor) << "\n";
  int exitcode = system (editor.c_str ());
  if (0 == exitcode)
    std::cout << STRING_EDIT_COMPLETE << "\n";
  else
  {
    std::cout << format (STRING_EDIT_FAILED, exitcode) << "\n";
    if (-1 == exitcode)
      std::cout << std::strerror (errno) << "\n";
    return CmdEdit::editResult::error;
  }

  // Slurp file.
  std::string after;
  File::read (file.str (), after);

  // Update task based on what can be parsed back out of the file, but only
  // if changes were made.
  if (before_orig != after)
  {
    std::cout << STRING_EDIT_CHANGES << "\n";
    std::string problem = "";
    bool oops = false;

    try
    {
      parseTask (task, after, dateformat);
    }

    catch (const std::string& e)
    {
      problem = e;
      oops = true;
    }

    if (oops)
    {
      std::cerr << STRING_ERROR_PREFIX << problem << "\n";

      // Preserve the edits.
      before = after;
      File::write (file.str (), before);

      if (confirm (STRING_EDIT_UNPARSEABLE))
        goto ARE_THESE_REALLY_HARMFUL;
    }
    else
      changes = true;
  }
  else
  {
//.........这里部分代码省略.........
开发者ID:austinwagner,项目名称:task,代码行数:101,代码来源:CmdEdit.cpp


示例18: Path

Path MediaConvert::getOutputFilePath(){
	return Path(destination.getPath(), (fileName + "." + getContainerName()));
}
开发者ID:martingt89,项目名称:OniboConverter2,代码行数:3,代码来源:mediaconvert.cpp


示例19: Path

Path System::GetTempDir()
{
    return Path("/tmp");
}
开发者ID:septag,项目名称:stcore,代码行数:4,代码来源:System.cpp


示例20: Path

//XData implementations:
//->export:
FileStatus XData::xport( const std::string& filename, ExporterCommand cmd )
{
	fs::path Path(filename);

	fs::path parent = Path.parent_path();

	// Ensure the parent path exists
	fs::create_directories(parent);

	if (os::fileOrDirExists(Path.string()))
	{
		switch (cmd)
		{
		case Merge:
			{
			//Check if definition already exists and return DefinitionExists. If it does not, append the definition to the file.
				std::fstream file(Path.string(), std::ios_base::in | std::ios_base::out | std::ios_base::app);
				if (!file.is_open())
					return OpenFailed;
				std::stringstream ss;
				ss << file.rdbuf();
				std::string String = ss.str();
				std::size_t DefPos = String.find(_name);
				while (DefPos != std::string::npos)	//A name of a XData could be contained in another XData's name. Check that...
				{
					char before = String[DefPos > 0 ? DefPos-1 : 0];
					char after = String[DefPos+_name.length() < String.size() ? DefPos+_name.length() : 0];
					if ((DefPos == 0 || before == ' ' || before == '\t' || before == '\n') && (DefPos+_name.length() == String.size() || after == ' ' || after == '\t' || after == '\n'))	//other delimiters necessary?
					{
						_definitionStart = 0;
						//Definition found. But we want to have it clean, so let's see how many spaces are before the definition begin.
						while (DefPos > 0)
						{
							if (String[--DefPos] != ' ' && String[DefPos] != '\t' && String[DefPos] != '\n')
							{
								_definitionStart = DefPos+1;
								break;
							}
						}

						file.close();
						return DefinitionExists;
					}
					DefPos = String.find(_name,DefPos+_name.length());
				}
				file << "\n\n\n" << generateXDataDef();
				file.close();
				return AllOk;
			}
		case MergeOverwriteExisting:
			{
			//Find the old definition in the target file and delete it. Append the new definition.
			//_definitionStart has been set in the first iteration of this method.
				std::fstream file(Path.string(), std::ios_base::in);
				if (!file.is_open())
					return OpenFailed;
				std::stringstream ss;
				ss << file.rdbuf();
				std::string OutString = ss.str();
				file.close();
                std::size_t DefLength = getDefLength(OutString.substr(_definitionStart));
				if (DefLength == 0)		//If the definitionlength can't be obtained, the merge fails.
					return MergeFailed;
				OutString.erase(_definitionStart, DefLength);
				std::string insString = std::string( (_definitionStart != 0) ? "\n\n\n" : "" )		//No new lines in the first line
					+ generateXDataDef()
					+ std::string( (_definitionStart == OutString.size()) ? "" : "\n\n\n" );		//No new lines at the end of file
				OutString.insert(_definitionStart, insString);
				file.open(Path.string(), std::ios_base::out | std::ios_base::trunc);
				if (!file.is_open())
					return OpenFailed;
				file << OutString;
				file.close();
				return AllOk;
			}
		case Overwrite:
			{
			//Warn if the target file contains multiple definitions: return MultipleDefinitions.
			//Warn if the definition in the target file does not match the current definition: return DefinitionMisMatch
			//else overwrite existing file.
				std::string DefName;
				std::ifstream file(Path.string(), std::ios_base::in);
				if (!file.is_open())
					return OpenFailed;
				try	{ DefName = getDefinitionNameFromXD(file); }
				catch (...)
				{
                    rConsoleError() << "[XData::xport] Syntax error in file " << filename 
                        << ". Overwriting the file..." << std::endl;
					break;
				}
				if (DefName == _name)	//Definition will be overwritten...
					break;
				else if (DefName == "")	//MultipleDefinitions exist
					return MultipleDefinitions;
				return DefinitionMismatch;
			}
		case OverwriteMultDef:
//.........这里部分代码省略.........
开发者ID:codereader,项目名称:DarkRadiant,代码行数:101,代码来源:XData.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PathAddBackslash函数代码示例发布时间:2022-05-30
下一篇:
C++ PatBlt函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap