]>
Commit | Line | Data |
---|---|---|
bd3239d2 MF |
1 | int __exchange_and_add_dispatch(int * __mem); |
2 | ||
3 | template < typename _Tp > class new_allocator { | |
4 | public: | |
5 | typedef _Tp & reference; | |
6 | }; | |
7 | ||
8 | namespace std { | |
9 | template < typename _CharT > struct char_traits; | |
10 | class exception {}; | |
11 | class bad_cast: | |
12 | public | |
13 | exception {} | |
14 | ; | |
15 | template < typename _Tp > class allocator:public new_allocator < _Tp > | |
16 | { | |
17 | public:template < typename _Tp1 > struct rebind { | |
18 | typedef allocator < _Tp1 > other; | |
19 | }; | |
20 | }; | |
21 | template < typename _CharT, typename _Traits = | |
22 | char_traits < _CharT >, typename _Alloc = | |
23 | allocator < _CharT > >class basic_string; | |
24 | typedef basic_string < char >string; | |
25 | template < typename _CharT, typename _Traits, | |
26 | typename _Alloc > class basic_string { | |
27 | typedef typename _Alloc::template rebind < | |
28 | _CharT >::other _CharT_alloc_type; | |
29 | typedef _Alloc allocator_type; | |
30 | typedef typename _CharT_alloc_type::reference reference; | |
31 | private:struct _Rep_base { | |
32 | int _M_refcount; | |
33 | }; | |
34 | struct _Rep:_Rep_base { | |
35 | _CharT *_M_refdata() throw() { | |
36 | return 0; | |
37 | } | |
38 | void _M_dispose(const _Alloc & __a) { | |
39 | if (this != &_S_empty_rep()) | |
40 | { | |
41 | if ( __exchange_and_add_dispatch(&this-> _M_refcount)) | |
42 | { | |
43 | _M_destroy(__a); | |
44 | } | |
45 | } | |
46 | } | |
47 | void _M_destroy(const _Alloc &) throw(); | |
48 | }; | |
49 | struct _Alloc_hider:_Alloc { | |
50 | _Alloc_hider(_CharT * __dat, | |
51 | const _Alloc & __a):_Alloc(__a), | |
52 | _M_p(__dat) { | |
53 | } _CharT *_M_p; | |
54 | }; | |
55 | public: | |
56 | private:mutable _Alloc_hider _M_dataplus; | |
57 | _Rep *_M_rep() const { | |
58 | } static _Rep & _S_empty_rep() { | |
59 | } | |
60 | public: basic_string(): | |
61 | _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) { } | |
62 | ~basic_string() { | |
63 | _M_rep()->_M_dispose(this->get_allocator()); | |
64 | } | |
65 | basic_string & erase() {} | |
66 | allocator_type get_allocator() const { | |
67 | }}; | |
68 | template < typename _Tp, typename _Ref, typename _Ptr > struct _Deque_iterator { | |
69 | }; | |
70 | template < typename _Tp, typename _Alloc > class _Deque_base { | |
71 | public:typedef _Alloc allocator_type; | |
72 | typedef _Deque_iterator < _Tp, _Tp &, _Tp * >iterator; | |
73 | _Deque_base():_M_impl() { | |
74 | _M_initialize_map(0); | |
75 | } | |
76 | typedef typename _Alloc::template rebind < | |
77 | _Tp >::other _Tp_alloc_type; | |
78 | struct _Deque_impl:public _Tp_alloc_type { | |
79 | _Tp **_M_map; | |
80 | long unsigned int _M_map_size; | |
81 | iterator _M_start; | |
82 | iterator _M_finish; | |
83 | _Deque_impl():_Tp_alloc_type(), _M_map(0), | |
84 | _M_map_size(0), _M_start(), _M_finish() { | |
85 | }}; | |
86 | protected:void _M_initialize_map(long unsigned int); | |
87 | _Deque_impl _M_impl; | |
88 | }; | |
89 | template < typename _Tp, typename _Alloc = std::allocator < _Tp > >class deque:protected _Deque_base < _Tp, | |
90 | _Alloc > | |
91 | { | |
92 | }; | |
93 | namespace numeric { | |
94 | class bad_numeric_cast: | |
95 | public std::bad_cast { }; | |
96 | class negative_overflow: | |
97 | public bad_numeric_cast { | |
98 | void operator() (int) { throw negative_overflow(); } | |
99 | }; | |
100 | } | |
101 | } | |
102 | ||
103 | namespace boost { | |
104 | template < class T > class scoped_ptr { | |
105 | private:T * px; | |
106 | public:typedef T element_type; | |
107 | explicit scoped_ptr(T * p = 0):px(p) { | |
108 | }}; | |
109 | template < class T > class intrusive_ptr { | |
110 | private:typedef intrusive_ptr this_type; | |
111 | public:typedef T element_type; | |
112 | intrusive_ptr():px(0) { | |
113 | } | |
114 | intrusive_ptr(T * p, bool add_ref = true):px(p) { | |
115 | } | |
116 | ~intrusive_ptr() { | |
117 | intrusive_ptr_release(px); | |
118 | } | |
119 | T *operator->() const { | |
120 | return px; | |
121 | } typedef T *this_type::*unspecified_bool_type; | |
122 | operator unspecified_bool_type() const { | |
123 | } private: T * px; | |
124 | }; | |
125 | struct section_info; | |
126 | template < typename T > struct intrusive_base { | |
127 | intrusive_base():ref_count_(0) { | |
128 | } ~intrusive_base() { | |
129 | } | |
130 | friend void intrusive_ptr_release(T * ptr) { | |
131 | delete ptr; | |
132 | } | |
133 | private: | |
134 | unsigned ref_count_; | |
135 | }; | |
136 | struct id_category { | |
137 | enum categories { | |
138 | default_category = | |
139 | 0, numbered, generated, generated_heading, | |
140 | generated_section, generated_doc, explicit_id, | |
141 | explicit_section_id, explicit_anchor_id | |
142 | }; | |
143 | categories c; | |
144 | }; | |
145 | struct id_placeholder; | |
146 | struct file_info; | |
147 | struct doc_info; | |
148 | struct id_state { | |
149 | boost::intrusive_ptr < file_info > current_file; | |
150 | std::deque < id_placeholder > placeholders; | |
151 | private:id_placeholder * add_id_to_section(std::string const &id, | |
152 | id_category category, | |
153 | boost::intrusive_ptr < | |
154 | section_info > | |
155 | const §ion); | |
156 | }; | |
157 | struct id_manager { | |
158 | id_manager(); | |
159 | private:boost::scoped_ptr < id_state > state; | |
160 | }; | |
161 | struct file_info:intrusive_base < file_info > { | |
162 | boost::intrusive_ptr < file_info > parent; | |
163 | boost::intrusive_ptr < doc_info > document; | |
164 | bool document_root; | |
165 | unsigned compatibility_version; | |
166 | boost::intrusive_ptr < section_info > switched_section; | |
167 | id_placeholder *original_placeholder; | |
168 | file_info(boost::intrusive_ptr < file_info > const &parent, | |
169 | unsigned compatibility_version):parent(parent), | |
170 | document(parent->document), document_root(false), | |
171 | compatibility_version(compatibility_version), | |
172 | switched_section(), original_placeholder() { | |
173 | }}; | |
174 | struct doc_info:intrusive_base < doc_info > { | |
175 | boost::intrusive_ptr < section_info > current_section; | |
176 | }; | |
177 | struct section_info:intrusive_base < section_info > { | |
178 | boost::intrusive_ptr < section_info > parent; | |
179 | unsigned compatibility_version; | |
180 | unsigned level; | |
181 | std::string id_1_1; | |
182 | id_placeholder *placeholder_1_6; | |
183 | section_info(boost::intrusive_ptr < section_info > | |
184 | const &parent, unsigned compatibility_version, | |
185 | std::string const &id):parent(parent), | |
186 | compatibility_version(compatibility_version), | |
187 | level(1) | |
188 | , id_1_1(), | |
189 | placeholder_1_6(0) {} | |
190 | }; | |
191 | id_manager::id_manager():state() { } | |
192 | namespace { | |
193 | std::string normalize_id( | |
194 | std::string | |
195 | ) { | |
196 | std::string id; | |
197 | id.erase(); | |
198 | } | |
199 | } | |
200 | id_placeholder *id_state::add_id_to_section(std::string const &id, | |
201 | id_category category, | |
202 | boost::intrusive_ptr < | |
203 | section_info > | |
204 | const §ion) { | |
205 | std::string id_part = id; | |
206 | normalize_id(id); | |
207 | boost::intrusive_ptr < section_info > parent; | |
208 | }; | |
209 | } |