root/trunk/libffado/src/ffadotypes.h

Revision 1770, 2.3 kB (checked in by arnonym, 14 years ago)

Change the fbtypes into ffadotypes.h and add a generic stringlist.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*
2  * Copyright (C) 2005-2008 by Daniel Wagner
3  *           (C) 2009-2009 by Arnold Krille
4  *
5  * This file is part of FFADO
6  * FFADO = Free Firewire (pro-)audio drivers for linux
7  *
8  * FFADO is based upon FreeBoB.
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 2 of the License, or
13  * (at your option) version 3 of the License.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22  *
23  */
24
25 #ifndef FFADOTYPES_H
26 #define FFADOTYPES_H
27
28 #ifndef __STDC_FORMAT_MACROS
29 #define __STDC_FORMAT_MACROS
30 #endif
31 #include <inttypes.h>
32
33 #include <libraw1394/raw1394.h>
34
35 #define INVALID_NODE_ID 0xFF
36
37 typedef quadlet_t   fb_quadlet_t;
38 typedef byte_t      fb_byte_t;
39 typedef octlet_t    fb_octlet_t;
40 typedef nodeid_t    fb_nodeid_t;
41 typedef nodeaddr_t  fb_nodeaddr_t;
42
43 #define FORMAT_FB_OCTLET_T      "0x%016" PRIX64
44 #define FORMAT_FB_NODEID_T      "0x%016" PRIX64
45 #define FORMAT_FB_NODEADDR_T    "0x%016" PRIX64
46
47 class DeviceManager;
48
49 struct ffado_handle {
50     DeviceManager*   m_deviceManager;
51 };
52
53
54 #include <vector>
55 #include <string>
56
57 class stringlist : public std::vector<std::string>
58 {
59     public:
60         static stringlist splitString(std::string in, std::string delimiter) {
61             stringlist result;
62             size_type start = 0, end = 0;
63             while ( start < in.size() ) {
64                 end = std::min(in.size(), in.find(delimiter, start));
65                 result.push_back(in.substr(start, end-start));
66                 start = end+delimiter.size();
67             }
68             return result;
69         }
70
71         std::string join(std::string joiner ="") {
72             std::string result;
73             for ( stringlist::iterator it=begin(); it!=end(); ) {
74                 result += *it;
75                 it++;
76                 if ( it!=end() ) {
77                     result += joiner;
78                 }
79             }
80             return result;
81         }
82 };
83
84 #endif
Note: See TracBrowser for help on using the browser.