acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
filestream.h
1
#pragma once
2
3
4
template
<
class
t1,
class
t2,
class
t3,
class
t4 >
5
void
serialize_write(
stream
& ostream, map_base < t1, t2, t3, t4 > & m)
6
{
7
::collection::count count = m.get_count();
8
typename
map_base < t1, t2, t3, t4 >::pair *
iterator
= m.get_start();
9
ostream << count;
10
while
(
iterator
!=
nullptr
)
11
{
12
ostream <<
iterator
->element1();
13
ostream <<
iterator
->element2();
14
iterator
= m.get_next(
iterator
);
15
}
16
}
17
18
template
<
class
t1,
class
t2,
class
t3,
class
t4 >
19
void
serialize_read(
stream
& istream, map_base < t1, t2, t3, t4 > & m)
20
{
21
try
22
{
23
t1 iCount;
24
// class map_base < t1, t2, t3, t4 >::pair * iterator =
25
// m.get_start();
26
istream >> iCount;
27
t1 key;
28
t3 value;
29
m.erase_all();
30
for
(::i32 i = 0; i < iCount; i++)
31
{
32
istream >> key;
33
istream >> value;
34
m.set_at(key, value);
35
}
36
}
37
catch
(const ::scoped_string & scopedstr)
38
{
39
m.erase_all();
40
throw ::exception(scopedstr);
41
}
42
}
43
44
stream
Definition
___serialization_draft.h:42
iterator
Definition
std_iterator.h:49
prototype
mathematics
filestream.h
Generated by
1.17.0