1 /*
2  *  config.h -- Configuration file parser module (include)
3  *
4  *  Copyright (C) 2004 Tony Sin(x) '76 <administrator@tortugalabs.it>
5  *  All rights reserved.
6  *
7  */
8 
9 /*
10  *			 GNU GENERAL PUBLIC LICENSE
11  *			    Version 2, June 1991
12  *
13  *  Copyright (C) 1989, 1991 Free Software Foundation, Inc.
14  *                           675 Mass Ave, Cambridge, MA 02139, USA
15  *  Everyone is permitted to copy and distribute verbatim copies
16  *  of this license document, but changing it is not allowed.
17  *
18  *  This program is free software; you can redistribute it and/or modify
19  *  it under the terms of the GNU General Public License as published by
20  *  the Free Software Foundation; either version 2 of the License, or
21  *  (at your option) any later version.
22 
23  *  This program is distributed in the hope that it will be useful,
24  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
25  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26  *  GNU General Public License for more details.
27 
28  *  You should have received a copy of the GNU General Public License
29  *  along with this program; if not, write to the Free Software
30  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31  *
32  */
33 
34 #ifndef __config_h__
35 #define __config_h__
36 
37 #define MAX_KEYS 23
38 
39 enum key_type { _ip = 0, _port, _mount, _password, _server, _name, _genre,
40                _description, _url, _bitrate, _public, _dumpfile, _mp3path,
41                _format, _log, _source, _loop, _recurse, _shuffle, _metaupdate,
42 							 _dataport, _logpath, _mdfpath, _badkey };
43 
44 #define INTERNAL_BUF_SIZE 512
45 
46 class cConfig
47 {
48   char *Table[MAX_KEYS];
49   char *int_buf;
50   int ParseLine(const char *buf, char *key, char *value);
51   key_type LookupKey(const char *key) const;
52 public:
53   cConfig(const char *path);
54   ~cConfig();
55   char *GetValue(key_type key) const;
56   void SetValue(key_type key, const char *value);
57 };
58 
59 extern char ErrStr[];
60 
61 #endif
62