Merge remote-tracking branch 'upstream/edge' into upstream-master
[clinton/Smoothieware.git] / src / libs / utils.h
1 #ifndef UTILS_H
2 #define UTILS_H
3
4 #include <stdint.h>
5 #include <string>
6 #include <vector>
7
8 using std::string;
9 using std::vector;
10
11 string lc(const string& str);
12
13 bool is_alpha( int );
14 bool is_digit( int );
15 bool is_numeric( int );
16 bool is_alphanum( int );
17 bool is_whitespace( int );
18
19 vector<string> split(const char *str, char c = ',');
20 vector<float> parse_number_list(const char *str);
21 vector<uint32_t> parse_number_list(const char *str, uint8_t radix);
22
23 string remove_non_number( string str );
24
25 uint16_t get_checksum(const string& to_check);
26 uint16_t get_checksum(const char* to_check);
27
28 void get_checksums(uint16_t check_sums[], const string& key);
29
30 string shift_parameter( string &parameters );
31
32 string get_arguments( string possible_command );
33
34 bool file_exists( const string file_name );
35
36 void system_reset( bool dfu= false );
37
38 string absolute_from_relative( string path );
39
40 int append_parameters(char *buf, std::vector<std::pair<char,float>> params, size_t bufsize);
41
42 #endif