-
Notifications
You must be signed in to change notification settings - Fork 0
/
filetree.h
44 lines (35 loc) · 816 Bytes
/
filetree.h
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
// SPDX-License-Identifier: GPL-2.0+
/*
* Fast Lines of Code Counter
*
* Copyright (C) 2021 SUSE
*
* Author: Jörg Rödel <jroedel@suse.de>
*/
#ifndef __FILETREE_H
#define __FILETREE_H
#include <ostream>
#include <string>
#include <map>
#include "counters.h"
struct loc_result {
uint32_t code;
uint32_t comment;
uint32_t whitespace;
uint32_t files;
loc_result();
loc_result& operator+=(const loc_result&);
};
class file_entry {
protected:
file_type m_type;
std::map<file_type, loc_result> m_results;
std::map<std::string, file_entry> m_entries;
public:
file_entry();
file_entry *get_entry(std::string, file_type);
void add_results(file_type, const loc_result&);
void jsonize(std::ostream&, std::string);
};
void insert_file_result(file_entry *root, const struct file_result &r);
#endif