blob: 7cf3b0aee7315afbcbe1e60287b58519be1a7ee1 (
plain)
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
|
#pragma once
#include <algorithm>
#include <vector>
class StringList
{
private:
std::vector<std::wstring> strings;
public:
StringList() {}
StringList(const wchar_t* string, const wchar_t *delimeters = L" ")
{
wchar_t *data = ::mir_wstrdup(string);
if (data)
{
wchar_t *p = ::wcstok(data, delimeters);
if (p)
{
this->strings.push_back(p);
while (p = wcstok(NULL, delimeters))
{
this->strings.push_back(p);
}
}
::mir_free(data);
}
}
virtual ~StringList() { }
__inline const wchar_t *operator[](size_t idx) const
{
return (idx >= 0 && idx < this->size()) ? this->strings[idx].c_str() : NULL;
}
__inline void insert(const wchar_t* p)
{
this->strings.push_back(::mir_wstrdup(p));
}
__inline bool contains(const wchar_t* p) const
{
return std::find(this->strings.begin(), this->strings.end(), p) != this->strings.end();
}
__inline size_t size() const
{
return this->strings.size();
}
__inline bool empty() const
{
return this->strings.empty();
}
__inline void clear()
{
this->strings.clear();
}
};
|