Chris@0
|
1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@0
|
2
|
Chris@0
|
3 /*
|
Chris@0
|
4 A waveform viewer and audio annotation editor.
|
Chris@2
|
5 Chris Cannam, Queen Mary University of London, 2005-2006
|
Chris@0
|
6
|
Chris@0
|
7 This is experimental software. Not for distribution.
|
Chris@0
|
8 */
|
Chris@0
|
9
|
Chris@0
|
10 /*
|
Chris@0
|
11 This is a modified version of a source file from the
|
Chris@0
|
12 Rosegarden MIDI and audio sequencer and notation editor.
|
Chris@0
|
13 This file copyright 2000-2005 Chris Cannam.
|
Chris@0
|
14 */
|
Chris@0
|
15
|
Chris@0
|
16 #include "PluginIdentifier.h"
|
Chris@0
|
17 #include <iostream>
|
Chris@0
|
18
|
Chris@0
|
19 QString
|
Chris@0
|
20 PluginIdentifier::createIdentifier(QString type,
|
Chris@0
|
21 QString soName,
|
Chris@0
|
22 QString label)
|
Chris@0
|
23 {
|
Chris@0
|
24 QString identifier = type + ":" + soName + ":" + label;
|
Chris@0
|
25 return identifier;
|
Chris@0
|
26 }
|
Chris@0
|
27
|
Chris@0
|
28 void
|
Chris@0
|
29 PluginIdentifier::parseIdentifier(QString identifier,
|
Chris@0
|
30 QString &type,
|
Chris@0
|
31 QString &soName,
|
Chris@0
|
32 QString &label)
|
Chris@0
|
33 {
|
Chris@0
|
34 type = identifier.section(':', 0, 0);
|
Chris@0
|
35 soName = identifier.section(':', 1, 1);
|
Chris@0
|
36 label = identifier.section(':', 2);
|
Chris@0
|
37 }
|
Chris@0
|
38
|
Chris@0
|
39 bool
|
Chris@0
|
40 PluginIdentifier::areIdentifiersSimilar(QString id1, QString id2)
|
Chris@0
|
41 {
|
Chris@0
|
42 QString type1, type2, soName1, soName2, label1, label2;
|
Chris@0
|
43
|
Chris@0
|
44 parseIdentifier(id1, type1, soName1, label1);
|
Chris@0
|
45 parseIdentifier(id2, type2, soName2, label2);
|
Chris@0
|
46
|
Chris@0
|
47 if (type1 != type2 || label1 != label2) return false;
|
Chris@0
|
48
|
Chris@0
|
49 bool similar = (soName1.section('/', -1).section('.', 0, 0) ==
|
Chris@0
|
50 soName2.section('/', -1).section('.', 0, 0));
|
Chris@0
|
51
|
Chris@0
|
52 return similar;
|
Chris@0
|
53 }
|
Chris@0
|
54
|
Chris@0
|
55 QString
|
Chris@0
|
56 PluginIdentifier::BUILTIN_PLUGIN_SONAME = "_builtin";
|
Chris@0
|
57
|
Chris@0
|
58 QString
|
Chris@0
|
59 PluginIdentifier::RESERVED_PROJECT_DIRECTORY_KEY = "__QMUL__:__RESERVED__:ProjectDirectoryKey";
|
Chris@0
|
60
|