-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfig.h
More file actions
64 lines (50 loc) · 1.45 KB
/
config.h
File metadata and controls
64 lines (50 loc) · 1.45 KB
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
56
57
58
59
60
61
62
63
64
/*
===========================================================================
SSHConnector
Copyright (C) 2024 spalter
This file is part of sshconnector, distributed under the GNU GPL v2
For full terms see the included COPYING file.
===========================================================================
*/
#ifndef __config_H__
#define __config_H__
/*
===============================================================================
config
===============================================================================
*/
#include <string.h>
#include <fstream>
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
typedef struct t_host
{
string name;
string host;
string port;
string user;
} t_host;
class Config
{
public:
Config();
~Config();
void Initialize( char *file );
void AppendList( char *file );
void CopyToVectorList( vector<char *> &result );
void GetSshCommandById( char *cmd, int index );
int CopyToCharArray( char **&result );
vector<t_host> GetHosts();
private:
void ReadConfig();
void SplitLine( char *line );
vector<string> &Split( const string &str, char delimeter, vector<string> &items );
vector<string> Split( const string &str, char delimeter );
char *ToCharArray( string &value );
void BuildHostLine( char *line, string &name, string &host, string &port, string &user );
char *filename;
vector<t_host> hosts;
};
#endif /* !__config_H__ */