SPAOP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Parsetools.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014 Martin Hansen
3  *
4  * This file is part of SPAOP (Spatial Audio Object Positioner).
5  *
6  * SPAOP is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * SPAOP is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with SPAOP. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef PARSETOOLS_H_INCLUDED
21 #define PARSETOOLS_H_INCLUDED
22 
23 #include <string>
24 #include <sstream>
25 #include <vector>
26 #include <iostream>
27 #ifdef _WIN32
28 #include <Ws2tcpip.h>
29 #else
30 #include <arpa/inet.h>
31 #endif
32 
33 #define PORT_NO_MIN 1024
34 #define PORT_NO_MAX 65535
44 namespace parsetools {
45 
53 std::vector<const std::string> splitString(const std::string& s, char delim);
54 
62 bool isValidIP(const std::string& ip);
63 
73 bool isValidPort(const std::string& port);
74 
75 }
76 
77 
78 
79 #endif // PARSETOOLS_H_INCLUDED
std::vector< const std::string > splitString(const std::string &s, char delim)
Splits a string around the matches of a given delimiter char.
Definition: Parsetools.cpp:24
bool isValidIP(const std::string &ip)
Checks whether a given string represents a valid IP(v4).
Definition: Parsetools.cpp:37
bool isValidPort(const std::string &port)
Checks whether a given string represents a valid user port number.
Definition: Parsetools.cpp:44