| 1 | // LAF Base Library |
| 2 | // Copyright (c) 2001-2016 David Capello |
| 3 | // |
| 4 | // This file is released under the terms of the MIT license. |
| 5 | // Read LICENSE.txt for more information. |
| 6 | |
| 7 | #ifndef BASE_SERIALIZATION_H_INCLUDED |
| 8 | #define BASE_SERIALIZATION_H_INCLUDED |
| 9 | #pragma once |
| 10 | |
| 11 | #include "base/ints.h" |
| 12 | #include <iosfwd> |
| 13 | |
| 14 | namespace base { |
| 15 | namespace serialization { |
| 16 | |
| 17 | std::ostream& write8(std::ostream& os, uint8_t byte); |
| 18 | uint8_t read8(std::istream& is); |
| 19 | |
| 20 | namespace little_endian { |
| 21 | |
| 22 | std::ostream& write16(std::ostream& os, uint16_t word); |
| 23 | std::ostream& write32(std::ostream& os, uint32_t dword); |
| 24 | uint16_t read16(std::istream& is); |
| 25 | uint32_t read32(std::istream& is); |
| 26 | |
| 27 | } // little_endian namespace |
| 28 | |
| 29 | namespace big_endian { |
| 30 | |
| 31 | std::ostream& write16(std::ostream& os, uint16_t word); |
| 32 | std::ostream& write32(std::ostream& os, uint32_t dword); |
| 33 | uint16_t read16(std::istream& is); |
| 34 | uint32_t read32(std::istream& is); |
| 35 | |
| 36 | } // big_endian namespace |
| 37 | |
| 38 | } // serialization namespace |
| 39 | } // base namespace |
| 40 | |
| 41 | #endif |
| 42 | |