[IPLUG/AU] add IParam::mIsMeta and related setter/getter in order to get params that...
[wdl/wdl-ol.git] / WDL / filename.h
blob0a9e7193642981f7b2c29aea9d5c2bd4f4b9be45
1 /*
2 WDL - filename.h
3 Copyright (C) 2005 and later, Cockos Incorporated
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
23 #ifndef _WDL_FILENAME_H_
24 #define _WDL_FILENAME_H_
26 #include <stdio.h>
27 #include <stdarg.h>
30 static char WDL_filename_filterchar(char p, char repl='_', bool filterSlashes=true)
32 if (p == '?' ||
33 p == '*' ||
34 p == ':' ||
35 p == '\"' ||
36 p == '|' ||
37 p == '<' ||
38 p == '>')
40 return repl;
43 if (filterSlashes && (p == '/' || p == '\\' ))
45 return repl;
48 return p;
52 static void WDL_filename_filterstr(char *buf, char repl='_', bool filterSlashes=true)
54 char *rd = buf;
55 while (*rd)
57 char r=WDL_filename_filterchar(*rd++,repl,filterSlashes);
58 if (r) *buf++ = r;
60 *buf=0;
65 #endif // _WDL_FILENAME_H_