ddc
LemmaInfoSerialize.h
Go to the documentation of this file.
1 // DDC originally by Alexey Sokirko
2 // Changes and modifications 2011-2014 by Bryan Jurish
3 //
4 // This file is part of DDC.
5 //
6 // DDC is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU Lesser General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // DDC is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with DDC. If not, see <http://www.gnu.org/licenses/>.
18 //
19 #ifndef _LEMMA_INFO_SERIALIZE_H
20 #define _LEMMA_INFO_SERIALIZE_H
21 
22 #include "../CommonLib/bserialize.h"
23 
24 inline size_t get_size_in_bytes (const CLemmaInfo& t)
25 {
26  return
29  + 2; //== CommonAncodeSize
30  ;
31 };
32 
33 
34 
35 inline size_t save_to_bytes(const CLemmaInfo& i, BYTE* buf)
36 {
37  buf += save_to_bytes(i.m_FlexiaModelNo, buf);
38  buf += save_to_bytes(i.m_AccentModelNo, buf);
39  buf += save_to_bytes((BYTE)i.m_CommonAncode[0], buf);
40  buf += save_to_bytes((BYTE)i.m_CommonAncode[1], buf);
41  return get_size_in_bytes(i);
42 }
43 
44 
45 inline size_t restore_from_bytes(CLemmaInfo& i, const BYTE* buf)
46 {
47  buf += restore_from_bytes(i.m_FlexiaModelNo, buf);
48  buf += restore_from_bytes(i.m_AccentModelNo, buf);
49  buf += restore_from_bytes(i.m_CommonAncode[0], buf);
50  buf += restore_from_bytes(i.m_CommonAncode[1], buf);
51  return get_size_in_bytes(i);
52 }
53 
54 
55 #endif
56 
57 /*--- emacs style variables ---
58  * Local Variables:
59  * mode: C++
60  * c-file-style: "ellemtel"
61  * c-basic-offset: 4
62  * tab-width: 8
63  * indent-tabs-mode: nil
64  * End:
65  */
char m_CommonAncode[CommonAncodeSize]
Definition: FormInfo.h:93
WORD m_FlexiaModelNo
Definition: FormInfo.h:91
size_t get_size_in_bytes(const CLemmaInfo &t)
Definition: LemmaInfoSerialize.h:24
WORD m_AccentModelNo
Definition: FormInfo.h:92
unsigned char BYTE
Definition: utilit.h:94
size_t restore_from_bytes(CLemmaInfo &i, const BYTE *buf)
Definition: LemmaInfoSerialize.h:45
size_t save_to_bytes(const CLemmaInfo &i, BYTE *buf)
Definition: LemmaInfoSerialize.h:35
Definition: FormInfo.h:89