-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommonFunctions.h
55 lines (45 loc) · 1.42 KB
/
CommonFunctions.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
45
46
47
48
49
50
51
52
53
54
55
/*
* CommonFunctions.h
*
* Created on: Feb 5, 2014
* Author: edwinrietmeijer
*/
#ifndef COMMONFUNCTIONS_H_
#define COMMONFUNCTIONS_H_
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <cmath>
#include "CustomTypes.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
namespace common {
// Return boolean, string convertable to double?
bool isDouble( const std::string & );
// Return boolean, string convertable to double?
bool isInt( const std::string & );
// Convert string to double
double stringToDouble ( const std::string & );
// Convert string to int
int stringToInt ( const std::string & );
// Convert string to lowercase
std::string lower( std::string toLowerCase );
// Convert vector of strings to lowercase
void strVectorToLower( std::vector<std::string> & );
// Convert vector of strings to vector of doubles ( compare vector sizes for consistancy )
std::vector<double> strVecToDoubleVec( std::vector<std::string> );
// Convert vector of strings to vector of ints ( compare vector sizes for consistancy )
std::vector<int> strVecToIntVec( std::vector<std::string> );
long getFileMutateDate( std::string );
int indexMod( int index, int size );
} // namespace common
// String to single line console output
void toConsole( std::string );
void toConsole( int );
void toConsole( double );
void boolToConsole( bool );
// Line break
void endline();
#endif /* COMMONFUNCTIONS_H_ */