basic_path选件类

定义存储模板类型 String 对象将作为文件名的选件类。

template<class String, class Traits>
class basic_path;

备注

库定义此模板的专用化两种类型的。

basic_path<string, path_traits>,并 typedefpath,使用 std::stringpath_traits 结构。

basic_path<wstring, wpath_traits>,并 typedefwpath,使用 std::wstringwpath_traits 结构。

可以使用类型 path 对象,实际上 std::string 类型的参数是接受文件名。

std::tr2::sys::path myfile(“abc.txt”);
std::ofstream ofs(myfile);
ofs << “hello\n”;
ofs.close();

同样,可以使用类型 wpath 对象,实际上 std::wstring 类型的参数是接受文件名。

存储的文件名包含选项标题,后跟选项根,一个选项相对路径。

  • 标题包含导致并包含第一个冒号的所有元素。

  • 根包含一个反斜杠。

  • 相对路径包含反斜杠顺序分隔的一个或多个路径元素。

basic_path::begin 返回的文件名迭代器指定第一个文件名元素。

文件名迭代器 X 意味着下列。

  • X == end() 指示文件名元素序列的末尾。

  • *X 返回与当前元素的字符串。

  • 如果有++X 指定下一个元素。

  • 如果有--X 指定前面的元素。

成员

Hh874769.collapse_all(zh-cn,VS.110).gif公共 Typedefs

名称

描述

basic_path::const_iterator

basic_path::iterator的同义词。

basic_path::external_string_type

Traits::external_string_type的同义词。

basic_path::iterator

描述可充当在存储的文件名的元素双向迭代器的文件名迭代器。

basic_path::path_type

basic_path<String, Traits>的同义词。

basic_path::string_type

String 模板参数的同义词。

basic_path::traits_type

Traits 模板参数的同义词。

basic_path::value_type

String::value_type的同义词。

Hh874769.collapse_all(zh-cn,VS.110).gif公共构造函数

名称

描述

basic_path::basic_path构造函数

构造 basic_path 对象。

Hh874769.collapse_all(zh-cn,VS.110).gif公共方法

名称

描述

basic_path::append方法

追加元素给存储的文件名。

basic_path::assign方法

使用指定的元素替换存储的文件名。

basic_path::basename方法

返回 子字符串相等但不包含最右边的点。

basic_path::begin方法

指定该存储的文件名的第一个元素。

basic_path::branch_path方法

检索 basic_path 对象的父级路径。

basic_path::clear方法

清除存储的文件名字符串。

basic_path::directory_string的方法

返回由存储的文件名。

basic_path::empty方法

指定文件名字符串是否为空。

basic_path::end方法

返回一个 文件名迭代 器在存储的文件名的最后一个元素之外。

basic_path::extension方法

如果它存在,则返回该存储的文件名的扩展。

basic_path::external_directory_string的方法

转换所存储的 directory_stringexternal_string_type

basic_path::external_file_string的方法

转换所存储的 file_stringexternal_string_type

basic_path::file_string的方法

返回由存储的文件名。

basic_path::filename方法

检索该存储的文件名。

basic_path::has_branch_path方法

指定该存储的文件名是否包含分支路径。

basic_path::has_filename方法

指定该存储的字符串是否包含一个文件名。

basic_path::has_leaf方法

指定该存储的文件名是否包含一块叶。

basic_path::has_parent_path方法

指定该存储的文件名是否包含父路径。

basic_path::has_relative_path方法

指定该存储的文件名是否包含相对路径。

basic_path::has_root_directory方法

指定该存储的文件名是否包含根目录。

basic_path::has_root_name方法

指定该存储的文件名是否包含一根名称。

basic_path::has_root_path方法

指定该存储的文件名是否包含根路径。

basic_path::is_complete方法

指定该存储的文件名是否已完成。

basic_path::leaf方法

检索该存储的文件名。

basic_path::parent_path方法

检索 basic_path 对象的父级路径。

basic_path::relative_path方法

检索该存储的文件名的 相对路径。

basic_path::remove_filename方法

如果存在,则相对路径中移除最后一个路径元素。

basic_path::remove_leaf方法

如果存在,则相对路径中移除最后一个路径元素。

basic_path::replace_extension方法

替换存储的文件名的文件扩展名。

basic_path::root_directory方法

如果它存在,则返回 根。

basic_path::root_name方法

如果它存在,则返回 前缀。

basic_path::root_path方法

检索该存储的文件名的 根路径。

basic_path::stem方法

返回 子字符串相等但不包含最右边的点。

basic_path::string的方法

返回由存储的文件名。

basic_path::swap方法

交换在文件名中存储的文件名从指定的 basic_path 对象。

Hh874769.collapse_all(zh-cn,VS.110).gif公共运算符

名称

描述

basic_path::operator string_type运算符

返回由存储的文件名。

basic_path::operator/=运算符

追加一系列组件给存储的文件名。

basic_path::operator=运算符

赋新值设置为存储的文件名。

要求

**标头:**文件系统

**命名空间:**std::tr2::sys

请参见

参考

<filesystem>

其他资源

标头文件