Readme and Install files lifting.
[Faustine.git] / interpretor / faust-0.9.47mr3 / architecture / osclib / faust / src / osc / OSCAddress.cpp
1 /*
2 Copyright (C) 2011 Grame
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18 Grame Research Laboratory, 9 rue du Garet, 69001 Lyon - France
19 research@grame.fr
20
21 */
22
23
24 #include "OSCAddress.h"
25
26 using namespace std;
27
28 namespace oscfaust
29 {
30
31 #define kAddressSep '/'
32 //--------------------------------------------------------------------------
33 string OSCAddress::addressFirst (const string& a)
34 {
35 if (a[0] == kAddressSep) {
36 size_t n = a.find_first_of(kAddressSep, 1);
37 if (n == string::npos) n = a.size();
38 return a.substr(1, n-1);
39 }
40 return "";
41 }
42
43 //--------------------------------------------------------------------------
44 string OSCAddress::addressLast (const string& a)
45 {
46 size_t n = a.find_last_of(kAddressSep);
47 if (n == string::npos) return "";
48 return a.substr(n+1);
49 }
50
51 //--------------------------------------------------------------------------
52 string OSCAddress::addressTail (const string& a)
53 {
54 if (a[0] == kAddressSep) {
55 size_t n = a.find_first_of(kAddressSep, 1);
56 if (n != string::npos) {
57 return a.substr(n, a.size() - n);
58 }
59 }
60 return "";
61 }
62
63
64 } // end namespoace