29 #ifndef _GLIBCXX_DEBUG_FORMATTER_H 30 #define _GLIBCXX_DEBUG_FORMATTER_H 1 37 # define _GLIBCXX_TYPEID(_Type) &typeid(_Type) 43 # define _GLIBCXX_TYPEID(_Type) 0 50 template<
typename _Iterator>
51 bool __check_singular(
const _Iterator&);
53 class _Safe_sequence_base;
55 template<
typename _Iterator,
typename _Sequence>
58 template<
typename _Iterator,
typename _Sequence>
61 template<
typename _Sequence>
68 __msg_insert_singular,
69 __msg_insert_different,
71 __msg_erase_different,
75 __msg_unpartitioned_pred,
81 __msg_bad_bitset_write,
82 __msg_bad_bitset_read,
83 __msg_bad_bitset_flip,
92 __msg_init_copy_singular,
93 __msg_init_const_singular,
98 __msg_iter_subscript_oob,
101 __msg_iter_compare_bad,
102 __msg_compare_different,
103 __msg_iter_order_bad,
104 __msg_order_different,
106 __msg_distance_different,
111 __msg_output_ostream,
113 __msg_deref_istreambuf,
114 __msg_inc_istreambuf,
116 __msg_insert_after_end,
117 __msg_erase_after_bad,
120 __msg_local_iter_compare_bad,
121 __msg_non_empty_range,
123 __msg_self_move_assign,
125 __msg_bucket_index_oob,
126 __msg_valid_load_factor,
129 __msg_insert_range_from_self,
130 __msg_irreflexive_ordering
133 class _Error_formatter
136 struct _Is_iterator { };
137 struct _Is_iterator_value_type { };
138 struct _Is_sequence { };
139 struct _Is_instance { };
174 __iterator_value_type
183 struct _Instance : _Type
185 const void* _M_address;
193 _Constness _M_constness;
194 _Iterator_state _M_state;
195 const void* _M_sequence;
200 _Instance _M_sequence;
213 const char* _M_value;
217 _Instance _M_instance;
220 _Type _M_iterator_value_type;
223 _Parameter() : _M_kind(__unused_param), _M_variant() { }
225 _Parameter(
long __value,
const char* __name)
226 : _M_kind(__integer), _M_variant()
228 _M_variant._M_integer._M_name = __name;
229 _M_variant._M_integer._M_value = __value;
232 _Parameter(
const char* __value,
const char* __name)
233 : _M_kind(__string), _M_variant()
235 _M_variant._M_string._M_name = __name;
236 _M_variant._M_string._M_value = __value;
239 template<
typename _Iterator,
typename _Sequence>
241 const char* __name, _Is_iterator)
242 : _M_kind(__iterator), _M_variant()
244 _M_variant._M_iterator._M_name = __name;
246 _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it);
247 _M_variant._M_iterator._M_constness =
248 std::__are_same<_Safe_iterator<_Iterator, _Sequence>,
249 typename _Sequence::iterator>::
250 __value ? __mutable_iterator : __const_iterator;
251 _M_variant._M_iterator._M_sequence = __it._M_get_sequence();
252 _M_variant._M_iterator._M_seq_type = _GLIBCXX_TYPEID(_Sequence);
255 _M_variant._M_iterator._M_state = __singular;
259 _M_variant._M_iterator._M_state = __before_begin;
261 _M_variant._M_iterator._M_state = __end;
263 _M_variant._M_iterator._M_state = __begin;
265 _M_variant._M_iterator._M_state = __middle;
269 template<
typename _Iterator,
typename _Sequence>
271 const char* __name, _Is_iterator)
272 : _M_kind(__iterator), _M_variant()
274 _M_variant._M_iterator._M_name = __name;
276 _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it);
277 _M_variant._M_iterator._M_constness =
278 std::__are_same<_Safe_local_iterator<_Iterator, _Sequence>,
279 typename _Sequence::local_iterator>::
280 __value ? __mutable_iterator : __const_iterator;
281 _M_variant._M_iterator._M_sequence = __it._M_get_sequence();
282 _M_variant._M_iterator._M_seq_type = _GLIBCXX_TYPEID(_Sequence);
285 _M_variant._M_iterator._M_state = __singular;
289 _M_variant._M_iterator._M_state = __end;
291 _M_variant._M_iterator._M_state = __begin;
293 _M_variant._M_iterator._M_state = __middle;
297 template<
typename _Type>
298 _Parameter(
const _Type*
const& __it,
const char* __name, _Is_iterator)
299 : _M_kind(__iterator), _M_variant()
301 _M_variant._M_iterator._M_name = __name;
303 _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it);
304 _M_variant._M_iterator._M_constness = __const_iterator;
305 _M_variant._M_iterator._M_state = __it ? __unknown_state : __singular;
306 _M_variant._M_iterator._M_sequence = 0;
307 _M_variant._M_iterator._M_seq_type = 0;
310 template<
typename _Type>
311 _Parameter(_Type*
const& __it,
const char* __name, _Is_iterator)
312 : _M_kind(__iterator), _M_variant()
314 _M_variant._M_iterator._M_name = __name;
316 _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it);
317 _M_variant._M_iterator._M_constness = __mutable_iterator;
318 _M_variant._M_iterator._M_state = __it ? __unknown_state : __singular;
319 _M_variant._M_iterator._M_sequence = 0;
320 _M_variant._M_iterator._M_seq_type = 0;
323 template<
typename _Iterator>
324 _Parameter(_Iterator
const& __it,
const char* __name, _Is_iterator)
325 : _M_kind(__iterator), _M_variant()
327 _M_variant._M_iterator._M_name = __name;
329 _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it);
330 _M_variant._M_iterator._M_constness = __unknown_constness;
331 _M_variant._M_iterator._M_state =
332 __gnu_debug::__check_singular(__it) ? __singular : __unknown_state;
333 _M_variant._M_iterator._M_sequence = 0;
334 _M_variant._M_iterator._M_seq_type = 0;
337 template<
typename _Sequence>
338 _Parameter(
const _Safe_sequence<_Sequence>& __seq,
339 const char* __name, _Is_sequence)
340 : _M_kind(__sequence), _M_variant()
342 _M_variant._M_sequence._M_name = __name;
343 _M_variant._M_sequence._M_address =
345 _M_variant._M_sequence._M_type = _GLIBCXX_TYPEID(_Sequence);
348 template<
typename _Sequence>
349 _Parameter(
const _Sequence& __seq,
const char* __name, _Is_sequence)
350 : _M_kind(__sequence), _M_variant()
352 _M_variant._M_sequence._M_name = __name;
354 _M_variant._M_sequence._M_type = _GLIBCXX_TYPEID(_Sequence);
357 template<
typename _Iterator>
358 _Parameter(
const _Iterator& __it,
const char* __name,
359 _Is_iterator_value_type)
360 : _M_kind(__iterator_value_type), _M_variant()
362 _M_variant._M_iterator_value_type._M_name = __name;
363 _M_variant._M_iterator_value_type._M_type =
364 _GLIBCXX_TYPEID(
typename std::iterator_traits<_Iterator>::value_type);
367 template<
typename _Type>
368 _Parameter(
const _Type& __inst,
const char* __name, _Is_instance)
369 : _M_kind(__instance), _M_variant()
371 _M_variant._M_instance._M_name = __name;
372 _M_variant._M_instance._M_address = &__inst;
373 _M_variant._M_instance._M_type = _GLIBCXX_TYPEID(_Type);
377 _M_print_field(
const _Error_formatter* __formatter,
378 const char* __name)
const _GLIBCXX_DEPRECATED;
381 _M_print_description(
const _Error_formatter* __formatter)
382 const _GLIBCXX_DEPRECATED;
385 template<
typename _Iterator>
387 _M_iterator(
const _Iterator& __it,
const char* __name = 0)
389 if (_M_num_parameters < std::size_t(__max_parameters))
390 _M_parameters[_M_num_parameters++] = _Parameter(__it, __name,
395 template<
typename _Iterator>
397 _M_iterator_value_type(
const _Iterator& __it,
398 const char* __name = 0)
400 if (_M_num_parameters < __max_parameters)
401 _M_parameters[_M_num_parameters++] =
402 _Parameter(__it, __name, _Is_iterator_value_type());
407 _M_integer(
long __value,
const char* __name = 0)
409 if (_M_num_parameters < __max_parameters)
410 _M_parameters[_M_num_parameters++] = _Parameter(__value, __name);
415 _M_string(
const char* __value,
const char* __name = 0)
417 if (_M_num_parameters < __max_parameters)
418 _M_parameters[_M_num_parameters++] = _Parameter(__value, __name);
422 template<
typename _Sequence>
424 _M_sequence(
const _Sequence& __seq,
const char* __name = 0)
426 if (_M_num_parameters < __max_parameters)
427 _M_parameters[_M_num_parameters++] = _Parameter(__seq, __name,
432 template<
typename _Type>
434 _M_instance(
const _Type& __inst,
const char* __name = 0)
436 if (_M_num_parameters < __max_parameters)
437 _M_parameters[_M_num_parameters++] = _Parameter(__inst, __name,
443 _M_message(
const char* __text)
444 { _M_text = __text;
return *
this; }
449 _M_message(_Debug_msg_id __id)
const throw ();
451 _GLIBCXX_NORETURN
void 454 template<
typename _Tp>
456 _M_format_word(
char*,
int,
const char*, _Tp)
457 const throw () _GLIBCXX_DEPRECATED;
460 _M_print_word(const
char* __word) const _GLIBCXX_DEPRECATED;
463 _M_print_string(const
char* __string) const _GLIBCXX_DEPRECATED;
466 _Error_formatter(const
char* __file,
unsigned int __line)
467 : _M_file(__file), _M_line(__line), _M_num_parameters(0), _M_text(0)
471 _M_get_max_length()
const throw () _GLIBCXX_DEPRECATED;
473 enum { __max_parameters = 9 };
476 unsigned int _M_line;
477 _Parameter _M_parameters[__max_parameters];
478 unsigned int _M_num_parameters;
482 static _Error_formatter&
483 _M_at(
const char* __file,
unsigned int __line)
485 static _Error_formatter __formatter(__file, __line);
491 #undef _GLIBCXX_TYPEID
bool _M_is_begin() const
Is this iterator equal to the sequence's begin(bucket) iterator?
ISO C++ entities toplevel namespace is std.
bool _M_is_end() const
Is this iterator equal to the sequence's end(bucket) iterator?
Base class for constructing a safe sequence type that tracks iterators that reference it...
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
GNU debug classes for public use.
bool _M_is_begin() const
Is this iterator equal to the sequence's begin() iterator?
bool _M_is_end() const
Is this iterator equal to the sequence's end() iterator?
bool _M_is_before_begin() const
Is this iterator equal to the sequence's before_begin() iterator if any?