$id frontmatter=
boost.png (6897 bytes) Filesystem Library
Version 3
Filesystem Home    Releases    Reference    Tutorial    FAQ    Portability    V3 Intro    V3 Design    Deprecated   

Reference Documentation

$endid $id wording_prefix=

Introduction

This reference documentation describes components that C++ programs may use to perform operations involving file systems, including paths, regular files, and directories.

C++11 Support

This reference documentation is written as if all compilers supported C++11. Where possible, the implementation falls back to C++03 if a C++11 feature is not available.

C++11 Feature Action if not supported by compiler
noexcept Keyword omitted.
constexpr Keyword omitted.

R-value references

Function signature omitted.
New character types

The boost::filesystem interface doesn't use the new types directly. It does use u16string and u32string in namespace boost. These are typedefs to std::u16string and std::u32string for C++11, or to std::basic_string<boost::u16_t> and std::basic_string<boost::u32_t> for C++03.

Defaulted and deleted functions Workaround replacement functions provided.
Initializer lists Not currently used.
Variadic templates Not currently used.
Range-based for statements Supporting functions always provided; they do no harm even for C++03 compilers.
$endid $id wording_suffix=

File streams - <boost/filesystem/fstream.hpp>

Replacements are provided for the file stream classes from the C++ standard library's <fstream> header. These replacement classes publicly inherit from the standard library classes. In the Boost.Filesystem version, constructors and open functions take const path& arguments instead of const char* arguments. There are no other differences in syntax or semantics.

$NAMESPACE_BEGIN;
    template < class charT, class traits = std::char_traits<charT> >
    class basic_filebuf : public std::basic_filebuf<charT,traits>
    {
    public:
      basic_filebuf<charT,traits>*
        open(const path& p, std::ios_base::openmode mode);
    };

    template < class charT, class traits = std::char_traits<charT> >
    class basic_ifstream : public std::basic_ifstream<charT,traits>
    {
    public:
      explicit basic_ifstream(const path& p, std::ios_base::openmode mode=std::ios_base::in)
      void open(const path& p, std::ios_base::openmode mode=std::ios_base::in);
    };

    template < class charT, class traits = std::char_traits<charT> >
    class basic_ofstream : public std::basic_ofstream<charT,traits>
    {
    public:
      explicit basic_ofstream(const path& p, std::ios_base::openmode mode=std::ios_base::out);
      void open(const path& p, std::ios_base::openmode mode=std::ios_base::out);
    };

    template < class charT, class traits = std::char_traits<charT> >
    class basic_fstream : public std::basic_fstream<charT,traits>
    {
    public:
      explicit basic_fstream(const path& p,
        std::ios_base::openmode mode=std::ios_base::in | std::ios_base::out);
      void open(const path& p,
        std::ios_base::openmode mode=std::ios_base::in | std::ios_base::out);
    };

    typedef basic_filebuf<char> filebuf;
    typedef basic_ifstream<char> ifstream;
    typedef basic_ofstream<char> ofstream;
    typedef basic_fstream<char> fstream;

    typedef basic_filebuf<wchar_t> wfilebuf;
    typedef basic_ifstream<wchar_t> wifstream;
    typedef basic_fstream<wchar_t> wfstream;
    typedef basic_ofstream<wchar_t> wofstream;
    
$NAMESPACE_END;
$endid $id backmatter=>

© Copyright Beman Dawes, 2002, 2006, 2007, 2009, 2010, 2011

Distributed under the Boost Software License, Version 1.0. See www.boost.org/LICENSE_1_0.txt

Revised 16 July 2012

$endid