1// Aseprite Document Library
2// Copyright (c) 2001-2015 David Capello
3//
4// This file is released under the terms of the MIT license.
5// Read LICENSE.txt for more information.
6
7#ifdef HAVE_CONFIG_H
8#include "config.h"
9#endif
10
11#include "doc/user_data_io.h"
12
13#include "base/serialization.h"
14#include "doc/string_io.h"
15#include "doc/user_data.h"
16
17#include <iostream>
18
19namespace doc {
20
21using namespace base::serialization;
22using namespace base::serialization::little_endian;
23
24void write_user_data(std::ostream& os, const UserData& userData)
25{
26 write_string(os, userData.text());
27 write32(os, userData.color());
28}
29
30UserData read_user_data(std::istream& is)
31{
32 UserData userData;
33 userData.setText(read_string(is));
34 userData.setColor(read32(is));
35 return userData;
36}
37
38}
39