]> git.lyx.org Git - lyx.git/blob - src/support/regex.h
Update shortcuts in fr.po
[lyx.git] / src / support / regex.h
1 // -*- C++ -*-
2 /**
3  * \file regexp.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Peter Kümmel
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef LYX_REGEXP_H
13 #define LYX_REGEXP_H
14
15 #ifdef LYX_USE_STD_REGEX
16 #  include <regex>
17 // <regex> in gcc is unusable in versions less than 4.9.0
18 // see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53631
19 #  define LR_NS std
20 #else
21 #  include <boost/regex.hpp>
22 #  define LR_NS boost
23 #endif
24
25 namespace lyx {
26 using LR_NS::regex;
27 using LR_NS::regex_match;
28 using LR_NS::regex_replace;
29 using LR_NS::regex_search;
30 using LR_NS::sregex_iterator;
31 using LR_NS::smatch;
32 using LR_NS::basic_regex;
33 using LR_NS::regex_error;
34 using LR_NS::match_results;
35
36 namespace regex_constants
37 {
38 using namespace LR_NS::regex_constants;
39 using LR_NS::regex_constants::match_flag_type;
40 } // namespace regex_constants
41
42 } // namespace lyx
43
44 #undef LR_NS
45
46 #ifdef LYX_USE_STD_REGEX
47 // Match Begin and End of String when using ECMAScript (default std::regex)
48 #define REGEX_BOS "^"
49 #define REGEX_EOS "$"
50 #else
51 // Match Begin and End of String when using Perl RE (default boost::regex)
52 #define REGEX_BOS "\\`"
53 #define REGEX_EOS "\\'"
54 #endif
55
56 #endif