rohdeschwarz  0.2.0
TCPIP socket library for Rohde & Schwarz instrument control
helpers.hpp
Go to the documentation of this file.
1 
7 #ifndef ROHDESCHWARZ_HELPERS_HPP
8 #define ROHDESCHWARZ_HELPERS_HPP
9 
10 
11 // std lib
12 #include <string>
13 #include <vector>
14 
15 
16 namespace rohdeschwarz
17 {
18 
19 
20 // trim whitespace
21 
25 std::string leftTrim(std::string text);
26 
27 
31 std::string rightTrim(std::string text);
32 
33 
37 std::string trim(const std::string& text);
38 
39 
40 // quotes
41 
49 bool isLeftQuote(const char* text);
50 
51 
59 bool isLeftQuote(const std::string& text);
60 
61 
69 bool isRightQuote(const char* text);
70 
71 
79 bool isRightQuote(const std::string& text);
80 
81 
89 bool isQuoted(const char* text);
90 
91 
99 bool isQuoted(const std::string& text);
100 
101 
108 std::string quote(const char* text, char quote_character = '\'');
109 
110 
117 std::string quote(const std::string& text, char quote_character = '\'');
118 
119 
125 std::string unquote(const char* text);
126 
127 
133 std::string unquote(const std::string& text);
134 
135 
136 // split
137 
144 std::vector<std::string> split(const char* csvList, const char separator = ',');
145 
146 
153 std::vector<std::string> split(const std::string& csvList, const char separator = ',');
154 
155 
156 } // rohdeschwarz
157 #endif // ROHDESCHWARZ_HELPERS_HPP
std::string unquote(const char *text)
Removes quotes from beginning and end of string.
Definition: helpers.cpp:121
bool isRightQuote(const char *text)
Checks for a quote at the end of the string.
Definition: helpers.cpp:80
std::string trim(const std::string &text)
Trims whitespace beginning and end of string.
Definition: helpers.cpp:56
std::string quote(const char *text, char quote_character='\'')
Surrounds string in quotes.
Definition: helpers.cpp:106
bool isLeftQuote(const char *text)
Checks for a quote at the beginning of the string.
Definition: helpers.cpp:62
std::vector< std::string > split(const char *csvList, const char separator=',')
Splits string on separator.
Definition: helpers.cpp:136
std::string leftTrim(std::string text)
Trims whitespace from left (beginning) of string.
Definition: helpers.cpp:39
bool isQuoted(const char *text)
Checks for quotes at the beginning and end of the string.
Definition: helpers.cpp:93
std::string rightTrim(std::string text)
Trims whitespace from right (end) of string.
Definition: helpers.cpp:47