creaturesImage work: add mutableCopy and tint methods to the base class (and change...
[openc2e.git] / Catalogue.h
blob17490b61d652a73a225ebccdb7985801f4d03d3e
1 /*
2 * Catalogue.h
3 * openc2e
5 * Created by Alyssa Milburn on Sat 13 Nov 2004.
6 * Copyright (c) 2004-2006 Alyssa Milburn. All rights reserved.
7 * Copyright (c) 2005 Bryan Donlan. All rights reserved.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
20 #ifndef _CATALOGUE_H
21 #define _CATALOGUE_H
23 #include <iostream>
24 #include <map>
25 #include <string>
26 #include <vector>
27 #include <istream>
28 #include <boost/filesystem/path.hpp>
29 #include <list>
30 #include "exceptions.h"
32 class catalogueException : public creaturesException {
33 public:
34 catalogueException(const char *s) throw()
35 : creaturesException(s) {}
36 catalogueException(const std::string &s) throw()
37 : creaturesException(s) {}
38 };
40 class Catalogue {
41 //protected:
42 public:
43 std::map<std::string, std::vector<std::string> > data;
45 public:
46 friend std::istream &operator >> (std::istream &, Catalogue &);
48 const std::vector<std::string> &getTag(std::string t) const { return (*data.find(t)).second; }
49 bool hasTag(std::string t) const { return (data.find(t) != data.end()); }
50 const std::string getAgentName(unsigned char family, unsigned char genus, unsigned short species) const;
51 std::string calculateWildcardTag(std::string tag, unsigned char family, unsigned char genus, unsigned short species) const;
53 void reset();
54 void addFile(boost::filesystem::path path);
55 void initFrom(boost::filesystem::path path);
57 void addVals(std::string &title, bool override, int count, const std::list<std::string> &vals);
60 extern Catalogue catalogue;
62 /* For lexer/parser, don't use for anything else. */
64 char catalogue_descape(char c);
66 #endif
67 /* vim: set noet: */