~ubuntu-branches/ubuntu/intrepid/enigma/intrepid

« back to all changes in this revision

Viewing changes to lib-src/oxydlib/DatFile.h

  • Committer: Bazaar Package Importer
  • Author(s): Erich Schubert
  • Date: 2005-08-28 15:30:09 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050828153009-sky64kb6tcq37xt5
Tags: 0.92.1-1
* New upstream subversion checkout
* Remove menu.s3m, which we are allowed to distributed but not to modify
  also copyright notice is confusing... (Closes: #321669)
* Rebuild with new libzipios (Closes: #325405)
  I hope this works without a versioned build-dependency
* Added "enigma replaces enigma-data" for upgrades (Closes: #308558)
* Added notes about the fonts copyright.
* updated to policy 3.6.2.1 (no changes)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright 2003 Jeremy Sawicki
2
 
//
3
 
// This file is part of OxydLib.
4
 
//
5
 
// OxydLib is free software; you can redistribute it and/or modify
6
 
// it under the terms of the GNU General Public License as published by
7
 
// the Free Software Foundation; either version 2 of the License, or
8
 
// (at your option) any later version.
9
 
//
10
 
// OxydLib is distributed in the hope that it will be useful,
11
 
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
// GNU General Public License for more details.
14
 
//
15
 
// You should have received a copy of the GNU General Public License
16
 
// along with OxydLib; if not, write to the Free Software
17
 
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
 
 
19
 
#ifndef DATFILE_H
20
 
#define DATFILE_H
21
 
 
22
 
#include "VecUtils.h"
23
 
#include "OxydVersion.h"
24
 
#include <string>
25
 
#include <set>
26
 
#include <map>
27
 
 
28
 
namespace OxydLib {
29
 
 
30
 
class DatFile
31
 
{
32
 
public:
33
 
  DatFile();
34
 
  ~DatFile();
35
 
 
36
 
  void clear();
37
 
 
38
 
  bool getInit() const { return m_bInit; }
39
 
  void setInit(bool bInit) { m_bInit = bInit; }
40
 
 
41
 
  OxydVersion getVersion() const { return m_ver; }
42
 
  void setVersion(OxydVersion ver) { m_ver = ver; }
43
 
 
44
 
  const ByteVec &getCredits() const { return m_credits; }
45
 
  ByteVec *getCreditsForWrite() { return &m_credits; }
46
 
 
47
 
  const ByteVec &getCodes() const { return m_codes; }
48
 
  ByteVec *getCodesForWrite() { return &m_codes; }
49
 
 
50
 
  const ByteVec &getLevel(int nLevel) const { return m_levels[nLevel]; }
51
 
  ByteVec *getLevelForWrite(int nLevel) { return &m_levels[nLevel]; }
52
 
 
53
 
  void getChunkNames(std::set<std::string> *pChunkNames) const;
54
 
  void addChunk(const std::string &chunkName);
55
 
  void removeChunk(const std::string &chunkName);
56
 
 
57
 
  const ByteVec *getChunk(const std::string &chunkName) const;
58
 
  ByteVec *getChunkForWrite(const std::string &chunkName);
59
 
 
60
 
private:
61
 
  bool m_bInit;
62
 
 
63
 
  OxydVersion m_ver;
64
 
 
65
 
  ByteVec m_credits;
66
 
  ByteVec m_codes;
67
 
 
68
 
  std::vector<ByteVec> m_levels;
69
 
 
70
 
  typedef std::map<std::string, ByteVec> ChunkMap;
71
 
  ChunkMap m_chunks;
72
 
};
73
 
 
74
 
bool parseDatFile(const ByteVec &in,
75
 
                  OxydVersion ver,
76
 
                  DatFile *pDatFile,
77
 
                  std::string *pMsg = 0);
78
 
bool unparseDatFile(const DatFile &datFile,
79
 
                    ByteVec *pOut,
80
 
                    std::string *pMsg = 0);
81
 
 
82
 
}
83
 
 
84
 
#endif