Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50387 - in sandbox/filesystem-v3: boost/filesystem libs/filesystem/doc libs/filesystem/test libs/filesystem/test/msvc libs/filesystem/test/msvc/wide_test
From: bdawes_at_[hidden]
Date: 2008-12-26 09:40:13


Author: bemandawes
Date: 2008-12-26 09:40:12 EST (Fri, 26 Dec 2008)
New Revision: 50387
URL: http://svn.boost.org/trac/boost/changeset/50387

Log:
filesystem-v3: increase nominal line length from 80 to 90 characters, add wide_test.
Added:
   sandbox/filesystem-v3/libs/filesystem/test/msvc/wide_test/
   sandbox/filesystem-v3/libs/filesystem/test/msvc/wide_test/wide_test.vcproj (contents, props changed)
Text files modified:
   sandbox/filesystem-v3/boost/filesystem/exception.hpp | 2
   sandbox/filesystem-v3/boost/filesystem/path.hpp | 31 ++++++++++++++++++++-
   sandbox/filesystem-v3/libs/filesystem/doc/v3_design.html | 58 +++++++++++++++++++++++++++++++++++----
   sandbox/filesystem-v3/libs/filesystem/test/msvc/filesystem-v3-sandbox.sln | 10 ++++++
   sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp | 6 +++
   sandbox/filesystem-v3/libs/filesystem/test/operations_unit_test.cpp | 6 +++
   sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp | 6 ++++
   sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp | 6 +++
   sandbox/filesystem-v3/libs/filesystem/test/wide_test.cpp | 14 ++++++++
   9 files changed, 126 insertions(+), 13 deletions(-)

Modified: sandbox/filesystem-v3/boost/filesystem/exception.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/exception.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/exception.hpp 2008-12-26 09:40:12 EST (Fri, 26 Dec 2008)
@@ -5,5 +5,5 @@
 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-// This header is no long used. The contents have been moved to path.hpp.
+// This header is no longer used. The contents have been moved to path.hpp.
 // It is provided so that user code #includes do not have to be changed.

Modified: sandbox/filesystem-v3/boost/filesystem/path.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/path.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/path.hpp 2008-12-26 09:40:12 EST (Fri, 26 Dec 2008)
@@ -54,7 +54,7 @@
        -- the preferred separator
        -- the generic separator <-- makes it easier to write portable code
    * Should the preferred native separator be available?
- */
+ */
 //--------------------------------------------------------------------------------------//
 
 #ifndef BOOST_FILESYSTEM_PATH_HPP
@@ -684,7 +684,8 @@
 
     // ----- locale -----
 
- static std::locale imbue( const std::locale & loc )
+ static std::locale imbue( const std::locale & loc,
+ system::error_code & ec = system::throws )
     {
       std::locale tmp;
       tmp = *detail::path_locale;
@@ -769,6 +770,32 @@
 
   //------------------------------------------------------------------------------------//
   // //
+ // class scoped_path_locale //
+ // //
+ //------------------------------------------------------------------------------------//
+
+ class scoped_path_locale
+ {
+ public:
+ scoped_path_locale( const std::locale & loc,
+ system::error_code & ec = system::throws )
+ : m_saved_locale(loc)
+ {
+ path::imbue( loc, ec );
+ }
+
+ ~scoped_path_locale() // never throws
+ {
+ system::error_code ec;
+ path::imbue( m_saved_locale, ec );
+ };
+
+ private:
+ std::locale m_saved_locale;
+ };
+
+ //------------------------------------------------------------------------------------//
+ // //
   // non-member functions //
   // //
   //------------------------------------------------------------------------------------//

Modified: sandbox/filesystem-v3/libs/filesystem/doc/v3_design.html
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/doc/v3_design.html (original)
+++ sandbox/filesystem-v3/libs/filesystem/doc/v3_design.html 2008-12-26 09:40:12 EST (Fri, 26 Dec 2008)
@@ -55,12 +55,12 @@
 <p>During the review of Boost.Filesystem V2 (Internationalization), Peter Dimov
 suggested that the class basic_path template was unwieldy, and that a single
 path type that accommodated multiple character types and encodings would be more
-flexible. Although I wasn't willing then to stop development at that time to
+flexible. Although I wasn't willing to stop development at that time to
 explore how this idea might be implemented, or to break from the pattern for
 Internationalization used the C++ standard library, I've often thought about
 Peter's suggestion. With the advent of C++0x char16_t and char32_t character
 types, the basic_path class template approach becomes even more unwieldy, so it
-is time to revisit the problem.</p>
+is time to revisit the problem in light of Peter's suggestion.</p>
 
 <h2><b><a name="Problem">Problem</a></b></h2>
 
@@ -71,22 +71,68 @@
 
 <h2><a name="Solution">Solution</a></h2>
 
-<p>The solution explored here:</p>
 <ul>
   <li>A single class path.</li>
   <li>Conversions from and to applicable character types and encodings.</li>
- <li>Internally, the path is held in a string_type appropriate to the operating
+ <li>Internally, the path is held in an object of a string type appropriate to the operating
   system; std::string for POSIX, std::wstring for Windows.</li>
 </ul>
 
+<p>An object of class <code>path</code> holds its contents as a basic_string of
+the preferred character type used by the operating system for paths, i.e.
+std::string for POSIX-like systems, std::wstring for Windows-like systems.</p>
+<blockquote>
+ <p>Thus a path object's c_str() returns a string of the native character type
+ and encoding that can be passed to operating system API calls without
+ conversion.</p>
+</blockquote>
+<p>Strings representing paths passed as arguments to objects of class path
+undergo no conversion if they are of the native API's preferred character type.</p>
+<blockquote>
+ <p>This mimics native OS API calls; no conversion are performed. For example,
+ POSIX specifies that path strings are passed unchanged by the&nbsp; API. Note
+ that this is different from the POSIX command line utilities, some of which
+ are specified to convert according to a locale.</p>
+</blockquote>
+<p>&nbsp;</p>
+
+<table border="1" cellpadding="4" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
+ <tr>
+ <td width="33%" colspan="3">
+ <p align="center"><i><b>Conversions</b></i></td>
+ </tr>
+ <tr>
+ <td width="33%">
+ <p align="center"><i><b>Host system</b></i></td>
+ <td width="33%">
+ <p align="center"><i><b>char string path arguments</b></i></td>
+ <td width="34%">
+ <p align="center"><i><b>wide string path arguments</b></i></td>
+ </tr>
+ <tr>
+ <td width="33%">Systems with char as the preferred path character type (i.e.
+ POSIX-like systems)</td>
+ <td width="33%">No conversion.</td>
+ <td width="34%">Conversion occurs, performed by the current path locale's
+ codecvt facet.</td>
+ </tr>
+ <tr>
+ <td width="33%">Systems with wchar_t as the preferred path character type
+ (i.e. Windows-like systems).</td>
+ <td width="33%">Conversion occurs, performed by the current path locale's
+ codecvt facet.</td>
+ <td width="34%">No conversion.</td>
+ </tr>
+</table>
+
 <h2><a name="Prototype">Prototype</a></h2>
 
-<p>Windows only. Incomplete. Not thoroughly tested. Should not be used for
+<p>Currently incomplete. Not thoroughly tested. Should not be used for
 production work.</p>
 
 <hr>
 <p>Revised
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->25 September, 2008<!--webbot bot="Timestamp" endspan i-checksum="39353" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->26 December, 2008<!--webbot bot="Timestamp" endspan i-checksum="38522" --></p>
 
 <p>© Copyright Beman Dawes, 2008</p>
 <p> Use, modification, and distribution are subject to the Boost Software

Modified: sandbox/filesystem-v3/libs/filesystem/test/msvc/filesystem-v3-sandbox.sln
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/msvc/filesystem-v3-sandbox.sln (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/msvc/filesystem-v3-sandbox.sln 2008-12-26 09:40:12 EST (Fri, 26 Dec 2008)
@@ -26,6 +26,12 @@
                 {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
         EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wide_test", "wide_test\wide_test.vcproj", "{DE12E87D-87C1-4FF3-AF16-85097F2A5184}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1}
+ {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
+ EndProjectSection
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -68,6 +74,10 @@
                 {54347DE3-6AA2-4466-A2EC-7176E0EC1110}.Debug|Win32.Build.0 = Debug|Win32
                 {54347DE3-6AA2-4466-A2EC-7176E0EC1110}.Release|Win32.ActiveCfg = Release|Win32
                 {54347DE3-6AA2-4466-A2EC-7176E0EC1110}.Release|Win32.Build.0 = Release|Win32
+ {DE12E87D-87C1-4FF3-AF16-85097F2A5184}.Debug|Win32.ActiveCfg = Debug|Win32
+ {DE12E87D-87C1-4FF3-AF16-85097F2A5184}.Debug|Win32.Build.0 = Debug|Win32
+ {DE12E87D-87C1-4FF3-AF16-85097F2A5184}.Release|Win32.ActiveCfg = Release|Win32
+ {DE12E87D-87C1-4FF3-AF16-85097F2A5184}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE

Added: sandbox/filesystem-v3/libs/filesystem/test/msvc/wide_test/wide_test.vcproj
==============================================================================
--- (empty file)
+++ sandbox/filesystem-v3/libs/filesystem/test/msvc/wide_test/wide_test.vcproj 2008-12-26 09:40:12 EST (Fri, 26 Dec 2008)
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="wide_test"
+ ProjectGUID="{DE12E87D-87C1-4FF3-AF16-85097F2A5184}"
+ RootNamespace="wide_test"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\common.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\common.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\wide_test.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Modified: sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp 2008-12-26 09:40:12 EST (Fri, 26 Dec 2008)
@@ -714,7 +714,11 @@
   
 } // unnamed namespace
 
-// test_main ---------------------------------------------------------------//
+ //------------------------------------------------------------------------------------//
+ // //
+ // test_main //
+ // //
+ //------------------------------------------------------------------------------------//
 
 int test_main( int argc, char * argv[] )
 {

Modified: sandbox/filesystem-v3/libs/filesystem/test/operations_unit_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/operations_unit_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/operations_unit_test.cpp 2008-12-26 09:40:12 EST (Fri, 26 Dec 2008)
@@ -127,7 +127,11 @@
 
 } // unnamed namespace
 
-// -------------------------------- main -----------------------------------//
+ //------------------------------------------------------------------------------------//
+ // //
+ // test_main //
+ // //
+ //------------------------------------------------------------------------------------//
 
 int main( int argc, char * argv[] )
 {

Modified: sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp 2008-12-26 09:40:12 EST (Fri, 26 Dec 2008)
@@ -1190,6 +1190,12 @@
 
 } // unnamed namespace
 
+ //------------------------------------------------------------------------------------//
+ // //
+ // test_main //
+ // //
+ //------------------------------------------------------------------------------------//
+
 int test_main( int, char*[] )
 {
   // The choice of platform is make at runtime rather than compile-time

Modified: sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp 2008-12-26 09:40:12 EST (Fri, 26 Dec 2008)
@@ -521,7 +521,11 @@
 
 } // unnamed namespace
 
-// -------------------------------- main ---------------------------------------------//
+ //------------------------------------------------------------------------------------//
+ // //
+ // test_main //
+ // //
+ //------------------------------------------------------------------------------------//
 
 int main( int, char*[] )
 {

Modified: sandbox/filesystem-v3/libs/filesystem/test/wide_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/wide_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/wide_test.cpp 2008-12-26 09:40:12 EST (Fri, 26 Dec 2008)
@@ -8,6 +8,14 @@
 
 // See library home page at http://www.boost.org/libs/filesystem
 
+//--------------------------------------------------------------------------------------//
+/*
+ TO DO
+
+ * Add test for scoped_path_locale.
+ */
+//--------------------------------------------------------------------------------------//
+
 #include <boost/config/warning_disable.hpp>
 
 // See deprecated_test for tests of deprecated features
@@ -118,7 +126,11 @@
 
 } // unnamed namespace
 
-// test_main ---------------------------------------------------------------//
+ //------------------------------------------------------------------------------------//
+ // //
+ // test_main //
+ // //
+ //------------------------------------------------------------------------------------//
 
 int test_main( int argc, char * /*argv*/[] )
 {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk