Bringing ChocolateCaste-0.7 into the main branch.
[AROS-Contrib.git] / FryingPan / Optical / CfgIOCodes.cpp
blob79824ddce065a3a5d938cab0b9263ae4d71b3e5f
1 /*
2 * FryingPan - Amiga CD/DVD Recording Software (User Interface and supporting Libraries only)
3 * Copyright (C) 2001-2011 Tomasz Wiszkowski Tomasz.Wiszkowski at gmail.com
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public License
7 * as published by the Free Software Foundation; either version 2.1
8 * of the License, or (at your option) any later version.
9 *
10 * This program 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 Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #include "CfgIOCodes.h"
22 static const char* Cfg_IOCodes = "IOCodes";
23 static const char* Cfg_IOCodeCode = "Code";
24 static const char* Cfg_IOCodeQual = "Qualifier";
25 static const char* Cfg_IOCodeMessage = "Message";
27 CfgIOCodes::CfgIOCodes(ConfigParser *parent)
29 XMLElement *xel;
30 config = new ConfigParser(parent, Cfg_IOCodes);
32 xel = config->getElement();
34 iocodes.FreeOnDelete(true);
36 for (int i=0; (xel!=0) && (i<xel->GetChildrenCount()); i++)
38 XMLElement *el = xel->GetChild(i);
39 ASSERT (el != 0);
40 if (el != 0)
42 String *c = el->GetAttributeValue(Cfg_IOCodeCode);
43 String *q = el->GetAttributeValue(Cfg_IOCodeQual);
44 String *m = el->GetAttributeValue(Cfg_IOCodeMessage);
46 if ((c != 0) && (q != 0) && (m != 0))
48 IOCode *ioc = new IOCode;
49 ioc->message = *m;
50 ioc->code = c->ToLong();
51 ioc->qual = q->ToLong();
53 iocodes << ioc;
59 CfgIOCodes::~CfgIOCodes()
61 delete config;