]> git.lyx.org Git - lyx.git/blob - src/support/regex.h
TR1: check in cmake for GCC version, fallback in checktr1.h for other build systems...
[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 #include "checktr1.h"
16
17
18 #define LYX_REGEX_TO_LYX(X) \
19     using X::regex; \
20     using X::smatch; \
21     using X::regex_replace; \
22     using X::basic_regex; \
23     using X::regex_error; \
24     using X::regex_search; \
25     using X::sregex_iterator; \
26     using X::match_results; \
27     \
28     namespace regex_constants \
29     { \
30         using namespace X::regex_constants; \
31         using X::regex_constants::match_flag_type; \
32     } \
33
34
35
36 #if defined(LYX_USE_TR1) && defined(LYX_USE_TR1_REGEX)
37
38 #ifdef _MSC_VER
39 #include <regex>
40 #define match_partial _Match_partial
41 #else
42 #include <tr1/regex>
43 // TODO no match_partial in gcc, how to replace?
44 #define match_partial match_default
45 #endif
46
47 namespace lyx
48 {
49     LYX_REGEX_TO_LYX(std::tr1);    
50 }
51
52 #else 
53
54 #include "boost/regex.hpp"
55
56 namespace lyx
57 {
58     LYX_REGEX_TO_LYX(boost);
59 }
60
61 #endif
62
63
64 #endif