root/trunk/libffado/src/DeviceStringParser.h

Revision 1763, 2.5 kB (checked in by ppalmers, 11 years ago)

Merged revisions 1536,1541,1544-1546,1549,1554-1562,1571,1579-1581,1618,1632,1634-1635,1661,1677-1679,1703-1704,1715,1720-1723,1743-1745,1755 via svnmerge from
svn+ssh://ffadosvn@ffado.org/ffado/branches/libffado-2.0

Also fix remaining format string warnings.

Line 
1 /*
2  * Copyright (C) 2005-2008 by Pieter Palmers
3  *
4  * This file is part of FFADO
5  * FFADO = Free Firewire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB.
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 2 of the License, or
12  * (at your option) version 3 of the License.
13  *
14  * This program 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
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #ifndef __FFADO_DEVICESTRINGPARSER__
25 #define __FFADO_DEVICESTRINGPARSER__
26
27 #include "debugmodule/debugmodule.h"
28
29 #include <vector>
30 #include <string>
31 #include <stdint.h>
32
33 class ConfigRom;
34
35 class DeviceStringParser {
36
37 protected:
38     class DeviceString {
39     public:
40         enum eType {
41             eInvalid = 0,
42             eBusNode = 1, // old-style hw:bus,node
43             eGUID = 2,    // GUID match
44         };
45
46         DeviceString(DeviceStringParser&);
47         ~DeviceString();
48
49         bool parse(std::string s);
50         bool match(ConfigRom &);
51
52         std::string getString() {return m_String;};
53         void show();
54
55         bool operator==(const DeviceString& x);
56         static bool isValidString(std::string s);
57
58     private:
59         DeviceStringParser & m_Parent;
60
61         int m_node;
62         int m_port;
63         uint64_t m_guid;
64         std::string m_String;
65         enum eType  m_Type;
66
67         DECLARE_DEBUG_MODULE_REFERENCE;
68     };
69
70 public:
71     DeviceStringParser();
72     virtual ~DeviceStringParser();
73
74     int countDeviceStrings() {return m_DeviceStrings.size();};
75
76     bool match(ConfigRom &);
77     int matchPosition(ConfigRom& c);
78
79     bool parseString(std::string s);
80     void show();
81     void setVerboseLevel(int i);
82
83     static bool isValidString(std::string s);
84
85 protected:
86     bool removeDeviceString(DeviceString *);
87     bool addDeviceString(DeviceString *);
88     bool hasDeviceString(DeviceString *);
89
90 private:
91     int findDeviceString(DeviceString *);
92
93     void pruneDuplicates();
94
95     typedef std::vector< DeviceString* > DeviceStringVector;
96     typedef std::vector< DeviceString* >::iterator DeviceStringVectorIterator;
97     DeviceStringVector m_DeviceStrings;
98
99 protected:
100     DECLARE_DEBUG_MODULE;
101
102 };
103
104 #endif /* __FFADO_DEVICESTRINGPARSER__ */
105
106
Note: See TracBrowser for help on using the browser.