diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-10-13 13:12:33 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-10-13 13:14:23 +0100 |
| commit | fa85f0fc32b105bef5948585a7d7a38c2910854b (patch) | |
| tree | 62df5d4c99b3ae89274c848895fa94445f870edb /src/regex.cc | |
| parent | b6f2b872b003639e3a596a2e4a1b817529ebd729 (diff) | |
Refactor regex uses, do not reference boost except in regex.hh
Diffstat (limited to 'src/regex.cc')
| -rw-r--r-- | src/regex.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/regex.cc b/src/regex.cc new file mode 100644 index 00000000..d2c8f615 --- /dev/null +++ b/src/regex.cc @@ -0,0 +1,25 @@ +#include "regex.hh" + +#include "exception.hh" + +namespace Kakoune +{ + +String option_to_string(const Regex& re) +{ + return String{re.str()}; +} + +void option_from_string(StringView str, Regex& re) +{ + try + { + re = Regex{str.begin(), str.end()}; + } + catch (RegexError& err) + { + throw runtime_error("unable to create regex: "_str + err.what()); + } +} + +} |
