Debian Codegraph @

melder/STRVEC.h

raw symbols SCIP
1 #pragma once
2 /* STRVEC.h
3 *
4 * Copyright (C) 1992-2023 Paul Boersma
5 *
6 * This code is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 *
11 * This code is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 * See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this work. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 autoSTRVEC fileNames_STRVEC (conststring32 path /* cattable */);
21 autoSTRVEC folderNames_STRVEC (conststring32 path /* cattable */);
22 autoSTRVEC fileNames_caseInsensitive_STRVEC (conststring32 path /* cattable */);
23 autoSTRVEC folderNames_caseInsensitive_STRVEC (conststring32 path /* cattable */);
24
25 autoSTRVEC readLinesFromFile_STRVEC (MelderFile file);
26
27 autoSTRVEC shuffle_STRVEC (STRVEC const& x);
28 void shuffle_STRVEC_inout (STRVEC const& x);
29
30 autoSTRVEC sort_STRVEC (STRVEC const& a);
31 void sort_STRVEC_inout (STRVEC const& a) noexcept;
32
33 autoSTRVEC sort_numberAware_STRVEC (STRVEC const& a);
34 void sort_numberAware_STRVEC_inout (STRVEC const& a) noexcept;
35
36 /*
37 Regard a string as a sequence of tokens,
38 separated (and perhaps preceded and followed) by white space.
39 The tokens cannot contain spaces themselves (there are no escapes).
40 */
41 autoSTRVEC splitByWhitespace_STRVEC (conststring32 string);
42
43 /*
44 Regard a string as a sequence of tokens,
45 separated by commas (or another separator) according to RFC 1480.
46 Each token is optionally surrounded by double quotes,
47 in which case the token can contain a comma itself,
48 or even a double quote (which should be doubled to escape it),
49 or even a line separator.
50 Well-formed:
51 abc,"def" -> first token is abc, second token is def
52 abc,"""def""" -> first token is abc, second token is "def"
53 abc,"def""ghi" -> first token is abc, second token is def"ghi
54 Ill-formed:
55 abc,"def"ghi -> non-terminated quoted string
56 abc,def"ghi -> a quote in an unquoted string
57 abc,"def"ghi" -> second token def not followed by comma or end
58 Note that in a quoted string in PraatScript,
59 abc,"""def"""
60 would have to be written as
61 "abc,""""""def"""""""
62 in which case it would be much easier (if possible) to use a string vector:
63 { "abc", """def""" }
64 */
65 autoSTRVEC splitBy_STRVEC (conststring32 string, conststring32 separator);
66
67 /* End of file STRVEC.h */