29 #ifndef _GLIBCXX_DEBUG_FORMATTER_H 30 #define _GLIBCXX_DEBUG_FORMATTER_H 1 36 # define _GLIBCXX_TYPEID(_Type) &typeid(_Type) 42 # define _GLIBCXX_TYPEID(_Type) 0 45 #if __cplusplus >= 201103L 48 _GLIBCXX_BEGIN_NAMESPACE_VERSION
50 template<
typename _Iterator,
typename _Container>
51 class __normal_iterator;
53 _GLIBCXX_END_NAMESPACE_VERSION
58 _GLIBCXX_BEGIN_NAMESPACE_VERSION
60 template<
typename _Iterator>
61 class reverse_iterator;
63 template<
typename _Iterator>
66 _GLIBCXX_END_NAMESPACE_VERSION
74 template<
typename _Iterator>
75 bool __check_singular(
const _Iterator&);
77 class _Safe_sequence_base;
79 template<
typename _Iterator,
typename _Sequence,
typename _Category>
82 template<
typename _Iterator,
typename _Sequence>
85 template<
typename _Sequence>
92 __msg_insert_singular,
93 __msg_insert_different,
95 __msg_erase_different,
99 __msg_unpartitioned_pred,
105 __msg_bad_bitset_write,
106 __msg_bad_bitset_read,
107 __msg_bad_bitset_flip,
113 __msg_splice_overlap,
116 __msg_init_copy_singular,
117 __msg_init_const_singular,
122 __msg_iter_subscript_oob,
125 __msg_iter_compare_bad,
126 __msg_compare_different,
127 __msg_iter_order_bad,
128 __msg_order_different,
130 __msg_distance_different,
135 __msg_output_ostream,
137 __msg_deref_istreambuf,
138 __msg_inc_istreambuf,
140 __msg_insert_after_end,
141 __msg_erase_after_bad,
144 __msg_local_iter_compare_bad,
145 __msg_non_empty_range,
147 __msg_self_move_assign,
149 __msg_bucket_index_oob,
150 __msg_valid_load_factor,
153 __msg_insert_range_from_self,
154 __msg_irreflexive_ordering
157 class _Error_formatter
160 struct _Is_iterator { };
161 struct _Is_iterator_value_type { };
162 struct _Is_sequence { };
163 struct _Is_instance { };
201 __iterator_value_type
207 const type_info* _M_type;
210 struct _Instance : _Type
212 const void* _M_address;
220 _Constness _M_constness;
221 _Iterator_state _M_state;
222 const void* _M_sequence;
223 const type_info* _M_seq_type;
227 _Instance _M_sequence;
240 const char* _M_value;
244 _Instance _M_instance;
247 _Type _M_iterator_value_type;
250 _Parameter() : _M_kind(__unused_param), _M_variant() { }
252 _Parameter(
long __value,
const char* __name)
253 : _M_kind(__integer), _M_variant()
255 _M_variant._M_integer._M_name = __name;
256 _M_variant._M_integer._M_value = __value;
259 _Parameter(
const char* __value,
const char* __name)
260 : _M_kind(__string), _M_variant()
262 _M_variant._M_string._M_name = __name;
263 _M_variant._M_string._M_value = __value;
266 template<
typename _Iterator,
typename _Sequence,
typename _Category>
267 _Parameter(_Safe_iterator<_Iterator, _Sequence, _Category>
const& __it,
268 const char* __name, _Is_iterator)
269 : _M_kind(__iterator), _M_variant()
271 _M_variant._M_iterator._M_name = __name;
273 _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(_Iterator);
274 _M_variant._M_iterator._M_constness =
275 __it._S_constant() ? __const_iterator : __mutable_iterator;
276 _M_variant._M_iterator._M_sequence = __it._M_get_sequence();
277 _M_variant._M_iterator._M_seq_type = _GLIBCXX_TYPEID(_Sequence);
279 if (__it._M_singular())
280 _M_variant._M_iterator._M_state = __singular;
283 if (__it._M_is_before_begin())
284 _M_variant._M_iterator._M_state = __before_begin;
285 else if (__it._M_is_end())
286 _M_variant._M_iterator._M_state = __end;
287 else if (__it._M_is_begin())
288 _M_variant._M_iterator._M_state = __begin;
290 _M_variant._M_iterator._M_state = __middle;
294 template<
typename _Iterator,
typename _Sequence>
295 _Parameter(_Safe_local_iterator<_Iterator, _Sequence>
const& __it,
296 const char* __name, _Is_iterator)
297 : _M_kind(__iterator), _M_variant()
299 _M_variant._M_iterator._M_name = __name;
301 _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(_Iterator);
302 _M_variant._M_iterator._M_constness =
303 _M_variant._M_iterator._M_constness =
304 __it._S_constant() ? __const_iterator : __mutable_iterator;
305 _M_variant._M_iterator._M_sequence = __it._M_get_sequence();
306 _M_variant._M_iterator._M_seq_type = _GLIBCXX_TYPEID(_Sequence);
308 if (__it._M_singular())
309 _M_variant._M_iterator._M_state = __singular;
312 if (__it._M_is_end())
313 _M_variant._M_iterator._M_state = __end;
314 else if (__it._M_is_begin())
315 _M_variant._M_iterator._M_state = __begin;
317 _M_variant._M_iterator._M_state = __middle;
321 template<
typename _Type>
322 _Parameter(
const _Type*
const& __it,
const char* __name, _Is_iterator)
323 : _M_kind(__iterator), _M_variant()
325 _M_variant._M_iterator._M_name = __name;
327 _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it);
328 _M_variant._M_iterator._M_constness = __const_iterator;
329 _M_variant._M_iterator._M_state = __it ? __unknown_state : __singular;
330 _M_variant._M_iterator._M_sequence = 0;
331 _M_variant._M_iterator._M_seq_type = 0;
334 template<
typename _Type>
335 _Parameter(_Type*
const& __it,
const char* __name, _Is_iterator)
336 : _M_kind(__iterator), _M_variant()
338 _M_variant._M_iterator._M_name = __name;
340 _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it);
341 _M_variant._M_iterator._M_constness = __mutable_iterator;
342 _M_variant._M_iterator._M_state = __it ? __unknown_state : __singular;
343 _M_variant._M_iterator._M_sequence = 0;
344 _M_variant._M_iterator._M_seq_type = 0;
347 template<
typename _Iterator>
348 _Parameter(_Iterator
const& __it,
const char* __name, _Is_iterator)
349 : _M_kind(__iterator), _M_variant()
351 _M_variant._M_iterator._M_name = __name;
353 _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it);
354 _M_variant._M_iterator._M_constness = __unknown_constness;
355 _M_variant._M_iterator._M_state =
357 _M_variant._M_iterator._M_sequence = 0;
358 _M_variant._M_iterator._M_seq_type = 0;
361 #if __cplusplus >= 201103L 364 template<
typename _Iterator,
typename _Container>
366 __gnu_cxx::__normal_iterator<_Iterator, _Container>
const& __it,
367 const char* __name, _Is_iterator)
368 : _Parameter(__it.base(), __name, _Is_iterator{})
369 { _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it); }
371 template<
typename _Iterator>
373 const char* __name, _Is_iterator)
374 : _Parameter(__it.base(), __name, _Is_iterator{})
376 _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it);
377 _M_variant._M_iterator._M_state
378 = _S_reverse_state(_M_variant._M_iterator._M_state);
381 template<
typename _Iterator,
typename _Sequence,
typename _Category>
383 _Category>>
const& __it,
384 const char* __name, _Is_iterator)
385 : _Parameter(__it.base(), __name, _Is_iterator{})
387 _M_variant._M_iterator._M_type
389 _M_variant._M_iterator._M_state
390 = _S_reverse_state(_M_variant._M_iterator._M_state);
393 template<
typename _Iterator>
395 const char* __name, _Is_iterator)
396 : _Parameter(__it.base(), __name, _Is_iterator{})
397 { _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it); }
399 template<
typename _Iterator,
typename _Sequence,
typename _Category>
401 _Category>>
const& __it,
402 const char* __name, _Is_iterator)
403 : _Parameter(__it.base(), __name, _Is_iterator{})
405 _M_variant._M_iterator._M_type
411 _S_reverse_state(_Iterator_state __state)
429 template<
typename _Sequence>
430 _Parameter(
const _Safe_sequence<_Sequence>& __seq,
431 const char* __name, _Is_sequence)
432 : _M_kind(__sequence), _M_variant()
434 _M_variant._M_sequence._M_name = __name;
435 _M_variant._M_sequence._M_address =
437 _M_variant._M_sequence._M_type = _GLIBCXX_TYPEID(_Sequence);
440 template<
typename _Sequence>
441 _Parameter(
const _Sequence& __seq,
const char* __name, _Is_sequence)
442 : _M_kind(__sequence), _M_variant()
444 _M_variant._M_sequence._M_name = __name;
446 _M_variant._M_sequence._M_type = _GLIBCXX_TYPEID(_Sequence);
449 template<
typename _Iterator>
450 _Parameter(
const _Iterator& __it,
const char* __name,
451 _Is_iterator_value_type)
452 : _M_kind(__iterator_value_type), _M_variant()
454 _M_variant._M_iterator_value_type._M_name = __name;
455 _M_variant._M_iterator_value_type._M_type =
456 _GLIBCXX_TYPEID(
typename std::iterator_traits<_Iterator>::value_type);
459 template<
typename _Type>
460 _Parameter(
const _Type& __inst,
const char* __name, _Is_instance)
461 : _M_kind(__instance), _M_variant()
463 _M_variant._M_instance._M_name = __name;
464 _M_variant._M_instance._M_address = &__inst;
465 _M_variant._M_instance._M_type = _GLIBCXX_TYPEID(_Type);
468 #if !_GLIBCXX_INLINE_VERSION 470 _M_print_field(
const _Error_formatter* __formatter,
471 const char* __name)
const _GLIBCXX_DEPRECATED;
474 _M_print_description(
const _Error_formatter* __formatter)
475 const _GLIBCXX_DEPRECATED;
479 template<
typename _Iterator>
481 _M_iterator(
const _Iterator& __it,
const char* __name = 0)
483 if (_M_num_parameters < std::size_t(__max_parameters))
484 _M_parameters[_M_num_parameters++] = _Parameter(__it, __name,
489 template<
typename _Iterator>
491 _M_iterator_value_type(
const _Iterator& __it,
492 const char* __name = 0)
494 if (_M_num_parameters < __max_parameters)
495 _M_parameters[_M_num_parameters++] =
496 _Parameter(__it, __name, _Is_iterator_value_type());
501 _M_integer(
long __value,
const char* __name = 0)
503 if (_M_num_parameters < __max_parameters)
504 _M_parameters[_M_num_parameters++] = _Parameter(__value, __name);
509 _M_string(
const char* __value,
const char* __name = 0)
511 if (_M_num_parameters < __max_parameters)
512 _M_parameters[_M_num_parameters++] = _Parameter(__value, __name);
516 template<
typename _Sequence>
518 _M_sequence(
const _Sequence& __seq,
const char* __name = 0)
520 if (_M_num_parameters < __max_parameters)
521 _M_parameters[_M_num_parameters++] = _Parameter(__seq, __name,
526 template<
typename _Type>
528 _M_instance(
const _Type& __inst,
const char* __name = 0)
530 if (_M_num_parameters < __max_parameters)
531 _M_parameters[_M_num_parameters++] = _Parameter(__inst, __name,
537 _M_message(
const char* __text)
538 { _M_text = __text;
return *
this; }
543 _M_message(_Debug_msg_id __id)
const throw ();
545 _GLIBCXX_NORETURN
void 548 #if !_GLIBCXX_INLINE_VERSION 549 template<
typename _Tp>
551 _M_format_word(
char*,
int,
const char*, _Tp)
552 const throw () _GLIBCXX_DEPRECATED;
555 _M_print_word(
const char* __word)
const _GLIBCXX_DEPRECATED;
558 _M_print_string(
const char* __string)
const _GLIBCXX_DEPRECATED;
562 _Error_formatter(
const char* __file,
unsigned int __line,
563 const char* __function)
564 : _M_file(__file), _M_line(__line), _M_num_parameters(0), _M_text(0)
565 , _M_function(__function)
568 #if !_GLIBCXX_INLINE_VERSION 570 _M_get_max_length()
const throw () _GLIBCXX_DEPRECATED;
573 enum { __max_parameters = 9 };
576 unsigned int _M_line;
577 _Parameter _M_parameters[__max_parameters];
578 unsigned int _M_num_parameters;
580 const char* _M_function;
583 static _Error_formatter&
584 _S_at(
const char* __file,
unsigned int __line,
const char* __function)
586 static _Error_formatter __formatter(__file, __line, __function);
592 #undef _GLIBCXX_TYPEID ISO C++ entities toplevel namespace is std.
bool __check_singular(const _Tp *__ptr)
Base class for constructing a safe sequence type that tracks iterators that reference it...
GNU debug classes for public use.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
GNU extensions for public use.