doc tweaks
[luabind.git] / examples / regexp / regex_wrap.cpp
bloba107240c81b7453dad139b77e889d2ace485f930
1 #include <boost/cregex.hpp>
3 extern "C"
5 #include "lua.h"
6 #include "lauxlib.h"
7 #include "lualib.h"
10 #include <luabind/luabind.hpp>
13 void wrap_regex(lua_State* L)
15 using boost::RegEx;
16 using namespace luabind;
18 class_<RegEx>(L, "regex")
19 .def(constructor<const char*>())
20 .def(constructor<const char*, bool>())
21 .def("match", (bool(RegEx::*)(const char*, unsigned int))&RegEx::Match)
22 .def("search", (bool(RegEx::*)(const char*, unsigned int))&RegEx::Search)
23 .def("what", &RegEx::What)
24 .def("matched", &RegEx::Matched)
25 .def("length", &RegEx::Length)
26 .def("position", &RegEx::Position)
27 .enum_("flags")
29 value("match_default", boost::match_default),
30 value("match_prev_avail", boost::match_prev_avail),
31 value("match_not_bob", boost::match_not_bob)
36 void test_wrap_regex()
38 lua_State* L = lua_open();
39 lua_baselibopen(L);
40 lua_strlibopen(L);
42 wrap_regex(L);
44 lua_dofile(L, "regex.lua");
46 lua_close(L);