• 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_PCREPOSIX
29 #include <pcre.h>
30 #else // POSIX regex - not so good...
31 extern "C" { // bug with some libc5 distributions
32 #include <regex.h>
33 }
34 #endif //HAVE_PCREPOSIX
35 
36 #include "ustring.h"
37 
38 namespace KJS {
39 
40  class RegExp {
41  public:
42  enum { None = 0, Global = 1, IgnoreCase = 2, Multiline = 4 };
43  RegExp(const UString &p, int f = None);
44  ~RegExp();
45  int flags() const { return flgs; }
46  UString pattern() const { return pat; }
47  bool isValid() const { return valid; }
48  UString match(const UString &s, int i, int *pos = 0, int **ovector = 0);
49  // test is unused. The JS spec says that RegExp.test should use
50  // RegExp.exec, so it has to store $1 etc.
51  // bool test(const UString &s, int i = -1);
52  unsigned int subPatterns() const { return nrSubPatterns; }
53 
54  //These methods should be called around the match of the same string..
55  void prepareMatch(const UString &s);
56  void doneMatch();
57  private:
58  const UString pat;
59  int flgs : 8;
60  bool m_notEmpty;
61  bool valid;
62 
63  // Cached encoding info...
64  char* buffer;
65  int* originalPos;
66  int bufferSize;
67 
68  void prepareUtf8 (const UString& s);
69  void prepareASCII (const UString& s);
70 #ifndef NDEBUG
71  UString originalS; // the original string, used for sanity-checking
72 #endif
73 
74 #ifndef HAVE_PCREPOSIX
75  regex_t preg;
76 #else
77  pcre *pcregex;
78 
79  enum UTF8SupportState {
80  Unknown,
81  Supported,
82  Unsupported
83  };
84 
85 #ifdef PCRE_CONFIG_UTF8
86  static UTF8SupportState utf8Support;
87 #endif
88 #endif
89  unsigned int nrSubPatterns;
90 
91  RegExp();
92  };
93 
94 } // namespace
95 
96 #endif
KJS
Definition: array_instance.h:27

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
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for kjs by doxygen 1.8.8
This website is maintained by Timothy Pearson.