source: trunk/save.hxx @ 14

Last change on this file since 14 was 5, checked in by jtv, 14 years ago

Implemented saving/restoring of game state

File size: 1.8 KB
Line 
1/*
2This file is part of libmines.
3
4Copyright (C) 2005, Jeroen T. Vermeulen <jtv@xs4all.nl>
5
6libmines is free software; you can redistribute it and/or modify it under the
7terms of the GNU General Public License as published by the Free Software
8Foundation; either version 2 of the License, or (at your option) any later
9version.
10
11libmines is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13PARTICULAR PURPOSE.  See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License along with
16libmines; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
17Suite 330, Boston, MA  02111-1307  USA
18*/
19
20enum { bitsperchar = 6 };
21
22/// Call this to initialize encoding tables (lazy; should be threadsafe)
23void initialize_encoding();
24
25char *write_header(char *);
26const char *read_header(const char *);
27
28/// Write a newline to output buffer
29char *write_newline(char *);
30/// Find first non-whitespace character at or after given location
31const char *skip_whitespace(const char *);
32
33/// Write key string with integer value to output buffer
34char *write_int(const char key[], char *here, int val);
35/// Read key string with integer value from input buffer
36int read_int(const char key[], const char *&here);
37
38/// End-of-line padding mandated by base64
39int linepadding(int bitsperline);
40
41/// End a line of base64 data (write terminator plus newline)
42char *write_eol(char *, int padding);
43/// Parse a base64 line terminator
44const char *read_eol(const char *, int padding);
45
46/// Extract a character's worth of ASCII-encoded binary data
47unsigned int extract_char(const char *&);
48/// Convert a binary value to a single encoding character
49char produce_char(unsigned int);
50
51/// Write terminating zero to output buffer
52void terminate(char *);
53
Note: See TracBrowser for help on using the repository browser.