acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
network_payload.h
1
//
2
// Created by camilo on 2022-10-24 16:10 <3ThomasBorregaardSorensen!!
3
//
4
#pragma once
5
//#include "string.h"
6
//#include "acme/prototype/collection/numeric_array.h"
7
8
9
template
< prototype_number NUMBER >
10
string
& get_network_payload(::string & str,
const
NUMBER & number,
bool
bNewLine =
true
)
11
{
12
13
str = as_string(number);
14
15
return
str;
16
17
}
18
19
20
template
< prototype_array ARRAY >
21
string
& get_network_payload(::string & str,
const
ARRAY & a,
bool
bNewLine =
true
)
22
{
23
24
str +=
"["
;
25
26
if
(a.has_element())
27
{
28
29
get_network_payload(str, a.first(), bNewLine);
30
31
}
32
33
for
(::collection::index i = 1; i < a.get_count(); i++)
34
{
35
36
if
(bNewLine)
37
{
38
39
str +=
", \r\n"
;
40
41
}
42
else
43
{
44
45
str +=
", "
;
46
47
}
48
49
get_network_payload(str, a[i], bNewLine);
50
51
}
52
53
if
(bNewLine)
54
{
55
56
str +=
"\r\n"
;
57
58
}
59
60
str +=
"]"
;
61
62
return
str;
63
64
}
65
66
67
68
prototype
string
network_payload.h
Generated by
1.17.0