acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
filestream.h
1#pragma once
2
3
4template < class t1, class t2, class t3, class t4 >
5void 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
18template < class t1, class t2, class t3, class t4 >
19void 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
Definition ___serialization_draft.h:42
Definition std_iterator.h:49