]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/spirit/include/boost/spirit/home/support/char_set/range_run.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / spirit / include / boost / spirit / home / support / char_set / range_run.hpp
1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
3
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7 #if !defined(BOOST_SPIRIT_RANGE_RUN_MAY_16_2006_0801_PM)
8 #define BOOST_SPIRIT_RANGE_RUN_MAY_16_2006_0801_PM
9
10 #if defined(_MSC_VER)
11 #pragma once
12 #endif
13
14 #include <boost/spirit/home/support/char_set/range.hpp>
15 #include <vector>
16
17 namespace boost { namespace spirit { namespace support { namespace detail
18 {
19 ///////////////////////////////////////////////////////////////////////////
20 // range_run
21 //
22 // An implementation of a sparse bit (boolean) set. The set uses
23 // a sorted vector of disjoint ranges. This class implements the
24 // bare minimum essentials from which the full range of set
25 // operators can be implemented. The set is constructed from
26 // ranges. Internally, adjacent or overlapping ranges are
27 // coalesced.
28 //
29 // range_runs are very space-economical in situations where there
30 // are lots of ranges and a few individual disjoint values.
31 // Searching is O(log n) where n is the number of ranges.
32 //
33 // { Low level interface }
34 ///////////////////////////////////////////////////////////////////////////
35 template <typename Char>
36 class range_run
37 {
38 public:
39
40 typedef range<Char> range_type;
41 typedef std::vector<range_type> storage_type;
42
43 void swap(range_run& other);
44 bool test(Char v) const;
45 void set(range_type const& range);
46 void clear(range_type const& range);
47 void clear();
48
49 private:
50
51 storage_type run;
52 };
53 }}}}
54
55 #include <boost/spirit/home/support/char_set/range_run_impl.hpp>
56 #endif