Mercurial > hg > vamp-plugin-sdk
comparison src/vamp-hostsdk/Files.cpp @ 477:628a5b8ff634
Revert to C++98 -- this library is not supposed to use C++11
author | Chris Cannam |
---|---|
date | Fri, 18 Nov 2016 14:02:49 +0000 |
parents | 0545cd3f1738 |
children | 54277cb679ff |
comparison
equal
deleted
inserted
replaced
476:15348e89c1d7 | 477:628a5b8ff634 |
---|---|
64 using namespace std; | 64 using namespace std; |
65 | 65 |
66 vector<string> | 66 vector<string> |
67 Files::listLibraryFiles() | 67 Files::listLibraryFiles() |
68 { | 68 { |
69 return listLibraryFilesMatching({}); | 69 return listLibraryFilesMatching(Filter()); |
70 } | 70 } |
71 | 71 |
72 vector<string> | 72 vector<string> |
73 Files::listLibraryFilesMatching(Filter filter) | 73 Files::listLibraryFilesMatching(Filter filter) |
74 { | 74 { |
76 vector<string> libraryFiles; | 76 vector<string> libraryFiles; |
77 | 77 |
78 // we match case-insensitively, but only with ascii range | 78 // we match case-insensitively, but only with ascii range |
79 // characters (input strings are expected to be utf-8) | 79 // characters (input strings are expected to be utf-8) |
80 vector<string> libraryNames; | 80 vector<string> libraryNames; |
81 for (auto n: filter.libraryNames) { | 81 for (int j = 0; j < int(filter.libraryNames.size()); ++j) { |
82 string n = filter.libraryNames[j]; | |
82 for (size_t i = 0; i < n.length(); ++i) { | 83 for (size_t i = 0; i < n.length(); ++i) { |
83 if (!(n[i] & 0x80)) { | 84 if (!(n[i] & 0x80)) { |
84 n[i] = char(tolower(n[i])); | 85 n[i] = char(tolower(n[i])); |
85 } | 86 } |
86 } | 87 } |
95 fi != files.end(); ++fi) { | 96 fi != files.end(); ++fi) { |
96 | 97 |
97 // we match case-insensitively, but only with ascii range | 98 // we match case-insensitively, but only with ascii range |
98 // characters (this string is expected to be utf-8) | 99 // characters (this string is expected to be utf-8) |
99 string cleaned = *fi; | 100 string cleaned = *fi; |
100 for (size_t i = 0; i < cleaned.length(); ++i) { | 101 for (size_t j = 0; j < cleaned.length(); ++j) { |
101 if (!(cleaned[i] & 0x80)) { | 102 if (!(cleaned[j] & 0x80)) { |
102 cleaned[i] = char(tolower(cleaned[i])); | 103 cleaned[j] = char(tolower(cleaned[j])); |
103 } | 104 } |
104 } | 105 } |
105 | 106 |
106 // libraryName should be lacking an extension, as it is | 107 // libraryName should be lacking an extension, as it is |
107 // supposed to have come from the plugin key | 108 // supposed to have come from the plugin key |
117 case Filter::All: | 118 case Filter::All: |
118 matched = true; | 119 matched = true; |
119 break; | 120 break; |
120 | 121 |
121 case Filter::Matching: | 122 case Filter::Matching: |
122 for (const auto &n: libraryNames) { | 123 for (int j = 0; j < int(libraryNames.size()); ++j) { |
123 if (cleaned == n) { | 124 if (cleaned == libraryNames[j]) { |
124 matched = true; | 125 matched = true; |
125 break; | 126 break; |
126 } | 127 } |
127 } | 128 } |
128 break; | 129 break; |
129 | 130 |
130 case Filter::NotMatching: | 131 case Filter::NotMatching: |
131 matched = true; | 132 matched = true; |
132 for (const auto &n: libraryNames) { | 133 for (int j = 0; j < int(libraryNames.size()); ++j) { |
133 if (cleaned == n) { | 134 if (cleaned == libraryNames[j]) { |
134 matched = false; | 135 matched = false; |
135 break; | 136 break; |
136 } | 137 } |
137 } | 138 } |
138 break; | 139 break; |