1 // -*- c-basic-offset: 2 -*-
3 * This file is part of the KDE libraries
4 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef _KJS_REGEXP_H_
23 #define _KJS_REGEXP_H_
25 #include <sys/types.h>
31 #else // POSIX regex - not so good...
32 extern "C" { // bug with some libc5 distributions
35 #endif // HAVE(PCREPOSIX)
43 enum { None = 0, Global = 1, IgnoreCase = 2, Multiline = 4 };
45 RegExp(const UString &pattern, int flags = None);
48 int flags() const { return _flags; }
50 UString match(const UString &s, int i, int *pos = 0, int **ovector = 0);
51 unsigned subPatterns() const { return _numSubPatterns; }
60 unsigned _numSubPatterns;
62 RegExp(const RegExp &);
63 RegExp &operator=(const RegExp &);
65 static UString sanitizePattern(const UString&);
67 static bool isHexDigit(UChar);
68 static unsigned char convertHex(int);
69 static unsigned char convertHex(int, int);
70 static UChar convertUnicode(UChar, UChar, UChar, UChar);