• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kjs
 

kjs

  • kjs
regexp.h
1/*
2 * This file is part of the KDE libraries
3 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 */
20
21#ifndef _KJS_REGEXP_H_
22#define _KJS_REGEXP_H_
23
24#include <sys/types.h>
25
26#include "config.h"
27
28#ifdef HAVE_PCRE2POSIX
29#define PCRE2_CODE_UNIT_WIDTH 8
30#include <pcre2.h>
31typedef PCRE2_UCHAR8 buftype_t;
32#else // POSIX regex - not so good...
33extern "C" { // bug with some libc5 distributions
34#include <regex.h>
35typedef char buftype_t;
36}
37#endif
38
39#include "ustring.h"
40
41namespace KJS {
42
43 class RegExp {
44 public:
45 enum { None = 0, Global = 1, IgnoreCase = 2, Multiline = 4 };
46 RegExp(const UString &p, int f = None);
47 ~RegExp();
48 int flags() const { return flgs; }
49 UString pattern() const { return pat; }
50 bool isValid() const { return valid; }
51 UString match(const UString &s, int i, int *pos = 0, int **ovector = 0);
52 // test is unused. The JS spec says that RegExp.test should use
53 // RegExp.exec, so it has to store $1 etc.
54 // bool test(const UString &s, int i = -1);
55 unsigned int subPatterns() const { return nrSubPatterns; }
56
57 //These methods should be called around the match of the same string..
58 void prepareMatch(const UString &s);
59 void doneMatch();
60 private:
61 const UString pat;
62 int flgs : 8;
63 bool m_notEmpty;
64 bool valid;
65
66 // Cached encoding info...
67 buftype_t *buffer;
68 int* originalPos;
69 int bufferSize;
70
71 void prepareUtf8 (const UString& s);
72 void prepareASCII (const UString& s);
73#ifndef NDEBUG
74 UString originalS; // the original string, used for sanity-checking
75#endif
76
77#ifndef HAVE_PCRE2POSIX
78 regex_t preg;
79#else
80 pcre2_code *pcregex;
81 pcre2_match_data *match_data;
82
83 enum UTF8SupportState {
84 Unknown,
85 Supported,
86 Unsupported
87 };
88 static UTF8SupportState utf8Support;
89#endif
90 uint32_t nrSubPatterns;
91
92 RegExp();
93 };
94
95} // namespace
96
97#endif

kjs

Skip menu "kjs"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kjs

Skip menu "kjs"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for kjs by doxygen 1.9.4
This website is maintained by Timothy Pearson.