File: debug_info.h

package info (click to toggle)
xca 2.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,328 kB
  • sloc: cpp: 30,584; sh: 341; xml: 74; makefile: 56; python: 34
file content (47 lines) | stat: -rw-r--r-- 833 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* vi: set sw=4 ts=4:
 *
 * Copyright (C) 2023 Christian Hohnstaedt.
 *
 * All rights reserved.
 */

#ifndef __DEBUG_INFO_H
#define __DEBUG_INFO_H

#include <QString>
#include <QList>

class dbg_pattern
{
		QString file, func;
		unsigned first, last;
		bool inv;
	public:
		bool invert() const { return inv; }
		dbg_pattern(QString);
		bool match(const QString &curr_file, const QString &curr_func,
					unsigned line) const;
};

class debug_info
{
	private:
		QString short_file;
		QString short_func;
		unsigned line;

		static QList<dbg_pattern> patternlist;
	public:
		static bool all;
		static void set_debug(const QString &dbg);
		static void init();
		debug_info(const QMessageLogContext &c);
		QString log_prefix() const;
		bool do_debug() const;
		static bool isEmpty()
		{
			return patternlist.size() == 0;
		}
};

#endif