Blame view

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