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.
28 #include <boost/filesystem/path.hpp>
30 #include "exceptions.h"
32 class catalogueException
: public creaturesException
{
34 catalogueException(const char *s
) throw()
35 : creaturesException(s
) {}
36 catalogueException(const std::string
&s
) throw()
37 : creaturesException(s
) {}
43 static const char *catalogue_parse_p
;
44 static void yyinit(const char *buf
);
47 friend void cataerror(const char *);
48 static void catalogueParseError(const char *err
= NULL
);
50 std::map
<std::string
, std::vector
<std::string
> > data
;
53 friend std::istream
&operator >> (std::istream
&, Catalogue
&);
55 const std::vector
<std::string
> &getTag(std::string t
) const { return (*data
.find(t
)).second
; }
56 bool hasTag(std::string t
) const { return (data
.find(t
) != data
.end()); }
57 const std::string
getAgentName(unsigned char family
, unsigned char genus
, unsigned short species
) const;
58 std::string
calculateWildcardTag(std::string tag
, unsigned char family
, unsigned char genus
, unsigned short species
) const;
61 void addFile(boost::filesystem::path path
);
62 void initFrom(boost::filesystem::path path
);
64 void addVals(std::string
&title
, bool override
, int count
, const std::list
<std::string
> &vals
);
67 extern Catalogue catalogue
;
69 /* For lexer/parser, don't use for anything else. */
71 char catalogue_descape(char c
);