3#define __DCL_INCLUDED_STRING_H
11#if __DCL_HAVE_ALLOC_DEBUG
12#undef __DCL_ALLOC_LEVEL
13#define __DCL_ALLOC_LEVEL __DCL_ALLOC_INTERNAL
26RegexException::RegexException(
const char* _name,
const char* _what)
55void Regex::MatchResults::attach(
match_result* _results,
size_t _size)
71 if (!(_index < __size)) {
74 return __results[_index];
102 compile(_pattern.data(), _pattern.length(), _flags);
117 catch (std::exception& e) {
133 catch (std::exception& e) {
150 _results.attach(results,
n);
155 catch (std::exception& e) {
173 catch (std::exception& e) {
188 size_t n =
__regex_match(__handle, _begin, _end, &results, _flags);
190 _results.attach(results,
n);
195 catch (std::exception& e) {
203 const String& _string,
204 const String& _replacement,
208 const wchar_t* _begin = _string.data();
209 const wchar_t* _end = _string.data() + _string.length();
213 while (_begin < _end && 0 < _limit &&
search(_begin, _end, results)) {
214 r.append(_begin, results[0].first);
215 r.append(_replacement);
218 _begin = results[0].second;
222 r.append(_begin, _end);
229 const wchar_t* _begin,
const wchar_t* _end,
230 StringArray& _results,
238 while(_begin < _end && _limit > 0 &&
search(_begin, _end, results)) {
239 _results.add(String(_begin, results[0].first - _begin));
242 _begin = results[0].second;
246 _results.add(String(_end, _end - _begin));
249 return _results.size();
253 const wchar_t* _regex,
254 const wchar_t* _string,
261 _regex, _regex + String::length(_regex),
262 _string, _string + String::length(_string),
276 _regex, _regex + ByteString::length(_regex),
277 _string, _string + ByteString::length(_string),
bool __regex_search(regex_handle _handle, const wchar_t *_begin, const wchar_t *_end, match_result **_results, unsigned int _flags)
void __matches_free(match_result *_results)
regex_handle __regex_create()
size_t __regex_match(regex_handle _handle, const wchar_t *_begin, const wchar_t *_end, match_result **_results, unsigned int _flags)
void __regex_compile(regex_handle _handle, const wchar_t *_pattern, size_t _n, unsigned int _flags)
void __regex_destroy(regex_handle _handle)
#define __DCL_ASSERT_PARAM(expr)
#define __DCL_ASSERT(expr)
#define IMPLEMENT_CLASSINFO(class_name, base_class_name)
void CharsetConvertException *size_t n
static String decode(const char *_mbs, size_t _mbslen=(size_t) -1)
virtual String toString() const
const match_result & operator[](size_t _index) const __DCL_THROWS1(InvalidIndexException *)
size_t split(const wchar_t *_begin, const wchar_t *_end, StringArray &_results, size_t _limit=(size_t) -1) __DCL_THROWS1(RegexException *)
bool search(const wchar_t *_begin, const wchar_t *_end, unsigned int _flags=0) __DCL_THROWS1(RegexException *)
bool match(const wchar_t *_begin, const wchar_t *_end, unsigned int _flags) __DCL_THROWS1(RegexException *)
void compile(const wchar_t *_pattern, size_t _n, unsigned int _flags=0) __DCL_THROWS1(RegexException *)
String replace(const String &_string, const String &_replacement, size_t _limit=(size_t) -1) __DCL_THROWS1(RegexException *)
static bool test(const wchar_t *_regex, const wchar_t *_string, bool _icase=false) __DCL_THROWS1(RegexException *)