1 | /* |
---|---|
2 | * |
3 | * Copyright (c) 2003 Dr John Maddock |
4 | * Use, modification and distribution is subject to the |
5 | * Boost Software License, Version 1.0. (See accompanying file |
6 | * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
7 | * |
8 | */ |
9 | |
10 | #if defined(BOOST_FILESYSTEM_VERSION) && (BOOST_FILESYSTEM_VERSION != 3) |
11 | # error "This library must be built with Boost.Filesystem version 3" |
12 | #else |
13 | #define BOOST_FILESYSTEM_VERSION 3 |
14 | #endif |
15 | |
16 | #include <boost/shared_ptr.hpp> |
17 | #include <boost/filesystem/path.hpp> |
18 | |
19 | class fileview |
20 | { |
21 | public: |
22 | // types: |
23 | typedef const char& reference; |
24 | typedef reference const_reference; |
25 | typedef const char* iterator; // See _lib.container.requirements_ |
26 | typedef iterator const_iterator; // See _lib.container.requirements_ |
27 | typedef std::size_t size_type; |
28 | typedef std::ptrdiff_t difference_type; |
29 | typedef char value_type; |
30 | typedef const char* pointer; |
31 | typedef pointer const_pointer; |
32 | #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION |
33 | typedef std::reverse_iterator<iterator> reverse_iterator; |
34 | typedef std::reverse_iterator<const_iterator> const_reverse_iterator; |
35 | #endif |
36 | |
37 | // construct: |
38 | fileview(); |
39 | fileview(const boost::filesystem::path& p); |
40 | ~fileview(); |
41 | fileview(const fileview& that); |
42 | fileview& operator=(const fileview& that); |
43 | void close(); |
44 | void open(const boost::filesystem::path& p); |
45 | |
46 | // iterators: |
47 | const_iterator begin() const; |
48 | const_iterator end() const; |
49 | #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION |
50 | const_reverse_iterator rbegin() const; |
51 | const_reverse_iterator rend() const; |
52 | #endif |
53 | |
54 | // capacity: |
55 | size_type size() const; |
56 | size_type max_size() const; |
57 | bool empty() const; |
58 | |
59 | // element access: |
60 | const_reference operator[](size_type n) const; |
61 | const_reference at(size_type n) const; |
62 | const_reference front() const; |
63 | const_reference back() const; |
64 | void swap(fileview& that); |
65 | |
66 | private: |
67 | void cow(); |
68 | struct implementation; |
69 | boost::shared_ptr<implementation> pimpl; |
70 | }; |
71 | |
72 | |
73 |