-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.hpp
More file actions
31 lines (24 loc) · 738 Bytes
/
util.hpp
File metadata and controls
31 lines (24 loc) · 738 Bytes
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
//
// Created by tate on 02-05-20.
//
#ifndef SCL_UTIL_HPP
#define SCL_UTIL_HPP
#include <string>
#include <istream>
#include <iostream>
#include <fstream>
namespace util {
// Escape sequences
extern const char* term_eff_bold;
extern const char* term_eff_red;
extern const char* term_eff_reset;
/// show full line at position pos in file
std::string show_line_pos(std::istream& file, unsigned long long pos, std::string fname);
inline std::string show_line_pos(const std::string& fname, const unsigned long long pos)
{
std::ifstream f(fname, std::ifstream::in);
return show_line_pos(f, pos, fname);
}
std::pair<long, long> pos_to_line_offset(std::istream& file, const unsigned long long pos);
}
#endif //SCL_UTIL_HPP