]> git.lyx.org Git - lyx.git/blob - src/support/regex.h
0826c9724ce6e82743e8bce9a6db0a4e1351fcfb
[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 // TODO: only tested with msvc10
37 #if defined(LYX_USE_TR1) && defined(_MSC_VER)
38
39 #ifdef _MSC_VER
40 #include <regex>
41 #define match_partial _Match_partial // why is match_partial not public?
42 #else
43 #include <tr1/regexp>
44 #endif
45
46 namespace lyx
47 {
48     LYX_REGEX_TO_LYX(std::tr1);    
49 }
50
51 #else 
52
53 #include "boost/regex.hpp"
54
55 namespace lyx
56 {
57     LYX_REGEX_TO_LYX(boost);
58 }
59
60 #endif
61
62
63 #endif