acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
_string_array.h
1
// From _container.h by camilo on 2024-03-10 22:58 <3ThomasBorregaardSorensen!!
2
#pragma once
3
4
5
inline ::string quoted_string(const ::scoped_string& scopedstr)
6
{
7
8
::string str;
9
10
str = scopedstr;
11
12
str.find_replace(
"\\"
,
"\\\\"
);
13
14
str.find_replace(
"\""
,
"\\\""
);
15
16
return
"\""
+ str +
"\""
;
17
18
}
19
20
21
inline ::string as_string(
const
string_array_base & container, const ::scoped_string& scopedstrSeparator =
" "
)
22
{
23
24
::string str;
25
26
for
(
const
auto
&
item
: container)
27
{
28
29
if
(str.has_character())
30
{
31
32
str += scopedstrSeparator;
33
34
}
35
36
str += quoted_string(
item
);
37
38
}
39
40
return
str;
41
42
}
43
44
bool
character_is_the_space(::ansi_character ansich)
noexcept
45
{
46
return
ansich ==
' '
;
47
48
}
49
50
51
inline
void
from_string(string_array_base& container, const ::scoped_string& scopedstr)
52
{
53
54
auto
range
= scopedstr();
55
56
::string str;
57
58
try
59
{
60
61
while
(
true
)
62
{
63
64
range
.consume(&character_is_the_space, 0);
65
66
if
(!
range
.defer_consume_quoted_value(str))
67
{
68
69
break
;
70
71
}
72
73
container.add_item(str);
74
75
}
76
77
}
78
catch
(...)
79
{
80
81
82
}
83
84
}
item
Definition
item.h:93
range
Definition
range.h:223
prototype
collection
_string_array.h
Generated by
1.17.0