summaryrefslogtreecommitdiffstats
path: root/src/devices/list/device_list.cpp
blob: 87ea49525c8dfd676435bb0a3b82302d015d2bab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/***************************************************************************
 *   Copyright (C) 2005-2006 Nicolas Hadacek <hadacek@kde.org>             *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/
#include "device_list.h"

#include <tqregexp.h>

#include "devices/pic/pic/pic_group.h"
#include "devices/mem24/mem24/mem24_group.h"

const Device::AutoData Device::AUTO_DATA = { "*", I18N_NOOP("<auto>") };

const Device::Data *Device::Lister::data(const TQString &device) const
{
  for (ConstIterator it=begin(); it!=end(); it++) {
    const Data *data = static_cast<const Data *>(it.data()->deviceData(device).data);
    if (data) return data;
  }
  return 0;
}

TQString Device::Lister::checkName(const TQString &device) const
{
  if ( device==AUTO_DATA.name ) return device;
  if ( isSupported(device) ) return device;
  if ( device.startsWith("p") ) // compat mode for PiKdev
    return checkName(device.mid(1));
  return "16F871"; // default...
}

namespace Device
{
  Lister _lister;
  const Lister &lister() { return _lister; }
}