|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r69076 - in trunk: boost/filesystem/v3 libs/filesystem/v3/src
From: bdawes_at_[hidden]
Date: 2011-02-20 08:35:54
Author: bemandawes
Date: 2011-02-20 08:35:53 EST (Sun, 20 Feb 2011)
New Revision: 69076
URL: http://svn.boost.org/trac/boost/changeset/69076
Log:
Cleanup code (pointed out by Denis Shevchenko)
Text files modified:
trunk/boost/filesystem/v3/path.hpp | 1 -
trunk/libs/filesystem/v3/src/path.cpp | 22 ++++------------------
2 files changed, 4 insertions(+), 19 deletions(-)
Modified: trunk/boost/filesystem/v3/path.hpp
==============================================================================
--- trunk/boost/filesystem/v3/path.hpp (original)
+++ trunk/boost/filesystem/v3/path.hpp 2011-02-20 08:35:53 EST (Sun, 20 Feb 2011)
@@ -452,7 +452,6 @@
void m_erase_redundant_separator(string_type::size_type sep_pos);
string_type::size_type m_parent_path_end() const;
- void m_portable();
path& m_normalize();
Modified: trunk/libs/filesystem/v3/src/path.cpp
==============================================================================
--- trunk/libs/filesystem/v3/src/path.cpp (original)
+++ trunk/libs/filesystem/v3/src/path.cpp 2011-02-20 08:35:53 EST (Sun, 20 Feb 2011)
@@ -27,6 +27,7 @@
#include <boost/scoped_array.hpp>
#include <boost/system/error_code.hpp>
#include <boost/assert.hpp>
+#include <algorithm>
#include <cstddef>
#include <cstring>
#include <cassert>
@@ -155,27 +156,17 @@
# ifdef BOOST_WINDOWS_API
- void path::m_portable()
- {
- for (string_type::iterator it = m_pathname.begin();
- it != m_pathname.end(); ++it)
- {
- if (*it == L'\\')
- *it = L'/';
- }
- }
-
const std::string path::generic_string(const codecvt_type& cvt) const
{
path tmp(*this);
- tmp.m_portable();
+ tmp.make_preferred();
return tmp.string(cvt);
}
const std::wstring path::generic_wstring() const
{
path tmp(*this);
- tmp.m_portable();
+ tmp.make_preferred();
return tmp.wstring();
}
@@ -216,12 +207,7 @@
# ifdef BOOST_WINDOWS_API
path & path::make_preferred()
{
- for (string_type::iterator it = m_pathname.begin();
- it != m_pathname.end(); ++it)
- {
- if (*it == L'/')
- *it = L'\\';
- }
+ std::replace(m_pathname.begin(), m_pathname.end(), L'\\', L'/');
return *this;
}
# endif
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