-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutils.h
34 lines (25 loc) · 919 Bytes
/
utils.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
#ifndef UTILS_H
#define UTILS_H
#include <fstream>
#include <functional>
#include <string.h>
#include <string>
#include <utility> // pair
#include <vector>
// utility functions go here
bool replace(std::string &str, const std::string &from, const std::string &to);
bool replace(std::string &str, const char *from, const char *to);
bool file_exists(const std::string &name);
bool file_exists(const char *name);
void string_toupper(std::string &str);
bool iequals(const std::string &a, const std::string &b);
std::vector<std::pair<int, int>> find_words(const std::string &text);
std::vector<std::string> split(const std::string &text, char sep);
// logger access
extern std::function<std::ofstream &(void)> get_logger;
extern std::function<void(void)> cls_display_starfield;
extern std::function<int(void)> press_a_key;
// configuration settings access
#include "yaml-cpp/yaml.h"
extern YAML::Node config;
#endif