Skip to content

Commit 4291427

Browse files
committed
P2319R5 Prevent path presentation problems
Fixes #7967 Fixes cplusplus/papers#1987
1 parent 4726d67 commit 4291427

File tree

3 files changed

+77
-7
lines changed

3 files changed

+77
-7
lines changed

source/future.tex

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,45 @@
841841
\end{note}
842842
\end{itemdescr}
843843

844+
\rSec1[depr.fs.path.obs]{Deprecated filesystem path format observers}
845+
846+
\indexlibraryglobal{path}%
847+
\pnum
848+
The following members are declared in addition to those members specified in
849+
\iref{fs.path.member}:
850+
851+
\begin{codeblock}
852+
namespace std::filesystem {
853+
class path {
854+
public:
855+
std::string string() const;
856+
std::string generic_string() const;
857+
};
858+
}
859+
\end{codeblock}
860+
861+
\indexlibrarymember{string}{path}%
862+
\begin{itemdecl}
863+
std::string string() const;
864+
\end{itemdecl}
865+
866+
\begin{itemdescr}
867+
\pnum
868+
\returns
869+
\tcode{system_encoded_string()}.
870+
\end{itemdescr}
871+
872+
\indexlibrarymember{generic_string}{path}%
873+
\begin{itemdecl}
874+
std::string generic_string() const;
875+
\end{itemdecl}
876+
877+
\begin{itemdescr}
878+
\pnum
879+
\returns
880+
\tcode{generic_system_encoded_string()}.
881+
\end{itemdescr}
882+
844883
\rSec1[depr.atomics]{Deprecated atomic operations}
845884

846885
\rSec2[depr.atomics.general]{General}

source/iostreams.tex

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13707,7 +13707,8 @@
1370713707
class Allocator = allocator<EcharT>>
1370813708
basic_string<EcharT, traits, Allocator>
1370913709
string(const Allocator& a = Allocator()) const;
13710-
std::string string() const;
13710+
std::string display_string() const;
13711+
std::string system_encoded_string() const;
1371113712
std::wstring wstring() const;
1371213713
std::u8string u8string() const;
1371313714
std::u16string u16string() const;
@@ -13718,7 +13719,8 @@
1371813719
class Allocator = allocator<EcharT>>
1371913720
basic_string<EcharT, traits, Allocator>
1372013721
generic_string(const Allocator& a = Allocator()) const;
13721-
std::string generic_string() const;
13722+
std::string generic_display_string() const;
13723+
std::string generic_system_encoded_string() const;
1372213724
std::wstring generic_wstring() const;
1372313725
std::u8string generic_u8string() const;
1372413726
std::u16string generic_u16string() const;
@@ -14689,13 +14691,13 @@
1468914691
\ref{fs.path.cvt}.
1469014692
\end{itemdescr}
1469114693

14692-
\indexlibrarymember{string}{path}%
14694+
\indexlibrarymember{system_encoded_string}{path}%
1469314695
\indexlibrarymember{wstring}{path}%
1469414696
\indexlibrarymember{u8string}{path}%
1469514697
\indexlibrarymember{u16string}{path}%
1469614698
\indexlibrarymember{u32string}{path}%
1469714699
\begin{itemdecl}
14698-
std::string string() const;
14700+
std::string system_encoded_string() const;
1469914701
std::wstring wstring() const;
1470014702
std::u8string u8string() const;
1470114703
std::u16string u16string() const;
@@ -14713,6 +14715,20 @@
1471314715
by \ref{fs.path.cvt}.
1471414716
\end{itemdescr}
1471514717

14718+
\indexlibrarymember{display_string}{path}%
14719+
\begin{itemdecl}
14720+
std::string display_string() const;
14721+
\end{itemdecl}
14722+
14723+
\begin{itemdescr}
14724+
\pnum
14725+
\returns
14726+
\tcode{format("{}", *this)}.
14727+
\begin{note}
14728+
The returned string is suitable for use with formatting \iref{format.functions}
14729+
and print functions \iref{print.fun}.
14730+
\end{note}
14731+
\end{itemdescr}
1471614732

1471714733
\rSec4[fs.path.generic.obs]{Generic format observers}
1471814734

@@ -14752,13 +14768,13 @@
1475214768
\ref{fs.path.cvt}.
1475314769
\end{itemdescr}
1475414770

14755-
\indexlibrarymember{generic_string}{path}%
14771+
\indexlibrarymember{generic_system_encoded_string}{path}%
1475614772
\indexlibrarymember{generic_wstring}{path}%
1475714773
\indexlibrarymember{generic_u8string}{path}%
1475814774
\indexlibrarymember{generic_u16string}{path}%
1475914775
\indexlibrarymember{generic_u32string}{path}%
1476014776
\begin{itemdecl}
14761-
std::string generic_string() const;
14777+
std::string generic_system_encoded_string() const;
1476214778
std::wstring generic_wstring() const;
1476314779
std::u8string generic_u8string() const;
1476414780
std::u16string generic_u16string() const;
@@ -14775,6 +14791,21 @@
1477514791
Conversion, if any, is specified by~\ref{fs.path.cvt}.
1477614792
\end{itemdescr}
1477714793

14794+
\indexlibrarymember{generic_display_string}{path}%
14795+
\begin{itemdecl}
14796+
std::string generic_display_string() const;
14797+
\end{itemdecl}
14798+
14799+
\begin{itemdescr}
14800+
\pnum
14801+
\returns
14802+
\tcode{format("{:g}", *this)}.
14803+
\begin{note}
14804+
The returned string is suitable for use with formatting \iref{format.functions}
14805+
and print functions \iref{print.fun}.
14806+
\end{note}
14807+
\end{itemdescr}
14808+
1477814809
\rSec4[fs.path.compare]{Compare}
1477914810

1478014811
\indexlibrarymember{compare}{path}%

source/support.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@
660660
#define @\defnlibxname{cpp_lib_flat_set}@ 202207L // also in \libheader{flat_set}
661661
#define @\defnlibxname{cpp_lib_format}@ 202311L // also in \libheader{format}
662662
#define @\defnlibxname{cpp_lib_format_ranges}@ 202207L // also in \libheader{format}
663-
#define @\defnlibxname{cpp_lib_format_path}@ 202403L // also in \libheader{filesystem}
663+
#define @\defnlibxname{cpp_lib_format_path}@ 202506L // also in \libheader{filesystem}
664664
#define @\defnlibxname{cpp_lib_format_uchar}@ 202311L // also in \libheader{format}
665665
#define @\defnlibxname{cpp_lib_formatters}@ 202302L // also in \libheader{stacktrace}, \libheader{thread}
666666
#define @\defnlibxname{cpp_lib_forward_like}@ 202207L // freestanding, also in \libheader{utility}

0 commit comments

Comments
 (0)