1 |
|
2 |
#include <string> |
3 |
#include <vector> |
4 |
|
5 |
#include "Sms.h" |
6 |
#include "Util.h" |
7 |
#include "SmsPdu.h" |
8 |
|
9 |
|
10 |
|
11 |
std::string SMS::ExtractCommand() |
12 |
{ |
13 |
unsigned int pos = message.find(" "); |
14 |
|
15 |
std::string result; |
16 |
|
17 |
if (pos == std::string::npos) |
18 |
result = message; |
19 |
else |
20 |
result = message.substr(0, pos); |
21 |
|
22 |
return Util::str_trim(result); |
23 |
} |
24 |
|
25 |
std::string SMS::ExtractParameters() |
26 |
{ |
27 |
unsigned int pos = message.find(" "); |
28 |
|
29 |
if (pos == std::string::npos) |
30 |
return ""; |
31 |
else |
32 |
{ |
33 |
pos++; |
34 |
|
35 |
std::string data = message.substr(pos, message.length()-pos ); |
36 |
|
37 |
data = Util::str_trim(data); |
38 |
return data; |
39 |
} |
40 |
} |
41 |
|
42 |
SMS::SMS() |
43 |
{ |
44 |
} |
45 |
|
46 |
SMS::SMS(std::string _index, std::string _sender, std::string _message, std::string _timestamp) |
47 |
: sms_index(_index), sender(_sender), message(_message), timestamp(_timestamp) |
48 |
{ |
49 |
} |