1 typedef int _Atomic_word;
2 typedef long unsigned int size_t;
4 template < typename _Tp > class new_allocator {
5 public:typedef const _Tp *const_pointer;
6 typedef _Tp & reference;
8 static _Atomic_word __exchange_and_add_dispatch(_Atomic_word * __mem,
14 template < typename _CharT > struct char_traits;
16 public:exception() throw() {
17 } virtual ~ exception() throw();
19 class bad_cast:public exception {
21 template < typename _Tp > class allocator:public __gnu_cxx::new_allocator < _Tp >
23 public:template < typename _Tp1 > struct rebind {
24 typedef allocator < _Tp1 > other;
27 template < typename _CharT, typename _Traits =
28 char_traits < _CharT >, typename _Alloc =
29 allocator < _CharT > >class basic_string;
30 typedef basic_string < char >string;
31 template < typename _CharT, typename _Traits,
32 typename _Alloc > class basic_string {
33 typedef typename _Alloc::template rebind <
34 _CharT >::other _CharT_alloc_type;
35 typedef _Alloc allocator_type;
36 typedef typename _CharT_alloc_type::reference reference;
37 private:struct _Rep_base {
38 _Atomic_word _M_refcount;
40 struct _Rep:_Rep_base {
41 _CharT *_M_refdata() throw() {
42 return reinterpret_cast < _CharT * >(this + 1);
43 } void _M_dispose(const _Alloc & __a) {
45 (this != &_S_empty_rep(), false)) {
47 __exchange_and_add_dispatch(&this->
55 void _M_destroy(const _Alloc &) throw();
57 struct _Alloc_hider:_Alloc {
58 _Alloc_hider(_CharT * __dat,
59 const _Alloc & __a):_Alloc(__a),
63 public:static const size_t npos =
64 static_cast < size_t > (-1);
65 private:mutable _Alloc_hider _M_dataplus;
66 _Rep *_M_rep() const {
67 } static _Rep & _S_empty_rep() {
69 public: basic_string():_M_dataplus(_S_empty_rep()._M_refdata(),
73 _M_rep()->_M_dispose(this->get_allocator());
75 size_t length() const {
76 } reference operator[] (size_t __pos) {
78 basic_string & erase(size_t __pos = 0, size_t __n = npos) {
80 allocator_type get_allocator() const {
82 template < typename _Tp, typename _Ref, typename _Ptr > struct _Deque_iterator {
84 template < typename _Tp, typename _Alloc > class _Deque_base {
85 public:typedef _Alloc allocator_type;
86 typedef _Deque_iterator < _Tp, _Tp &, _Tp * >iterator;
87 _Deque_base():_M_impl() {
90 typedef typename _Alloc::template rebind <
91 _Tp >::other _Tp_alloc_type;
92 struct _Deque_impl:public _Tp_alloc_type {
97 _Deque_impl():_Tp_alloc_type(), _M_map(0),
98 _M_map_size(0), _M_start(), _M_finish() {
100 protected:void _M_initialize_map(size_t);
103 template < typename _Tp, typename _Alloc = std::allocator < _Tp > >class deque:protected _Deque_base < _Tp,
108 enum range_check_result {
109 cInRange = 0, cNegOverflow = 1, cPosOverflow = 2
111 class bad_numeric_cast:public std::bad_cast {
113 class negative_overflow:public bad_numeric_cast {
114 void operator() (range_check_result r) {
115 if (r == cNegOverflow)
116 throw negative_overflow();
122 template < class T > class scoped_ptr {
124 public:typedef T element_type;
125 explicit scoped_ptr(T * p = 0):px(p) {
127 template < class T > class intrusive_ptr {
128 private:typedef intrusive_ptr this_type;
129 public:typedef T element_type;
130 intrusive_ptr():px(0) {
132 intrusive_ptr(T * p, bool add_ref = true):px(p) {
136 intrusive_ptr_release(px);
138 T *operator->() const {
140 } typedef T *this_type::*unspecified_bool_type;
141 operator unspecified_bool_type() const {
145 template < typename T > struct intrusive_base {
146 intrusive_base():ref_count_(0) {
147 } ~intrusive_base() {
149 friend void intrusive_ptr_release(T * ptr) {
150 if (--ptr->ref_count_ == 0)
153 private:unsigned ref_count_;
158 0, numbered, generated, generated_heading,
159 generated_section, generated_doc, explicit_id,
160 explicit_section_id, explicit_anchor_id
167 private:boost::scoped_ptr < id_state > state;
169 struct id_placeholder;
173 boost::intrusive_ptr < file_info > current_file;
174 std::deque < id_placeholder > placeholders;
175 private:id_placeholder * add_id_to_section(std::string const &id,
176 id_category category,
177 boost::intrusive_ptr <
181 struct file_info:intrusive_base < file_info > {
182 boost::intrusive_ptr < file_info > parent;
183 boost::intrusive_ptr < doc_info > document;
185 unsigned compatibility_version;
186 boost::intrusive_ptr < section_info > switched_section;
187 id_placeholder *original_placeholder;
188 std::string doc_id_1_1;
189 file_info(boost::intrusive_ptr < file_info > const &parent,
190 unsigned compatibility_version):parent(parent),
191 document(parent->document), document_root(false),
192 compatibility_version(compatibility_version),
193 switched_section(), original_placeholder() {
195 struct doc_info:intrusive_base < doc_info > {
196 boost::intrusive_ptr < section_info > current_section;
197 std::string last_title_1_1;
198 std::string section_id_1_1;
200 struct section_info:intrusive_base < section_info > {
201 boost::intrusive_ptr < section_info > parent;
202 unsigned compatibility_version;
205 id_placeholder *placeholder_1_6;
206 section_info(boost::intrusive_ptr < section_info >
207 const &parent, unsigned compatibility_version,
208 std::string const &id):parent(parent),
209 compatibility_version(compatibility_version),
210 level(parent ? parent->level + 1 : 1), id_1_1(),
213 id_manager::id_manager():state(new id_state) {
216 std::string normalize_id(std::string src_id) {
220 if (src >= id.length()) {
221 if (id[src] == '_') {
227 id_placeholder *id_state::add_id_to_section(std::string const &id,
228 id_category category,
229 boost::intrusive_ptr <
232 std::string id_part = id;
233 if (current_file->compatibility_version >= 106u
234 && category.c < id_category::explicit_id) {
235 id_part = normalize_id(id);
237 boost::intrusive_ptr < section_info > parent =
238 current_file->document->current_section;
239 boost::intrusive_ptr < section_info > new_section =
240 new section_info(parent,
241 current_file->compatibility_version, id);