Arduino Libraries
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
string_support.hpp
Go to the documentation of this file.
1 // Author: Mario S. Könz <mskoenz@gmx.net>
2 // Date: 26.08.2013 19:13:33 CEST
3 // File: string_support.hpp
4 
5 /* This program is free software. It comes without any warranty, to
6  * the extent permitted by applicable law. You can redistribute it
7  * and/or modify it under the terms of the Do What The Fuck You Want
8  * To Public License, Version 2, as published by Sam Hocevar. See
9  * http://www.wtfpl.net/ or COPYING for more details. */
10 
11 #ifndef __STRING_SUPPORT_HEADER
12 #define __STRING_SUPPORT_HEADER
13 
14 #include <string>
15 
16 //------------------- serialize -------------------
17 namespace com {
18  template<typename Archive>
19  void serialize(Archive & ar, std::string & arg) {
20  typedef uint16_t size_type;
21  size_type size_ = arg.size();
22  ar & size_;
23  if(Archive::type == archive_enum::input) {
24  arg.resize(size_);
25  }
26  for(size_type i = 0; i < size_; ++i) {
27  ar & arg[i];
28  }
29  }
30 }//end namespace com
31 
32 #endif //__STRING_SUPPORT_HEADER
void serialize(Archive &ar, T &t)
Definition: serializer.hpp:95