source: subversion/applications/lib/libimg/ImgData.h @ 34621

Last change on this file since 34621 was 2092, checked in by enxrah, 13 years ago

Nick didn't write this. I did :-)

File size: 1.9 KB
Line 
1/*
2    Copyright (C) 2007 Robert Hart, rob@bathterror.free-online.co.uk
3
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 2 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU Lesser General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software
16    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
17
18 */
19#ifndef IMGDATA_H
20#define IMGDATA_H
21#include <iostream>
22#include <fstream>
23#include <sstream>
24#include <string>
25#include "time.h"
26
27class ImgData {
28 public:
29  ImgData();
30  virtual void WriteFile(std::ofstream &out);
31  virtual int ReadFile(std::ifstream &in) = 0;
32  virtual void CreateHeader() = 0;
33  tm updatetime;
34  void SetUpdateTime(tm timeval);
35  void SetUpdateTime(time_t timeval);
36   
37 protected:
38  char xorbyte;
39  char *data;
40  int blocksize;
41  int nblocks;
42
43  //  virtual void CreateHeader();
44  void SetByte(int add, int val);
45  void SetShort(int add, long val);
46  void SetLong(int add, long val);
47  void SetInt24(int add, long val);
48  void SetByte(int add, int val, int n);
49  void SetString(int add, std::string str);
50  void SetString(int add, char *str);
51  void SetBlockList(int add, int first, int last);
52  void SetCoord(int add, double coord);
53
54  int DecodeByte(int add);
55  long DecodeShort(int add);
56  long DecodeLong(int add);
57  long DecodeInt24(int add);
58  void DecodeString(int add, int length, std::string &str);
59  int DecodeBlockList(int add, int &first, int &last);
60  int CoordToMap(double coord);
61  double MapToCoord(int map);
62  double DecodeCoord(int add);
63};
64
65#endif
Note: See TracBrowser for help on using the repository browser.