~louis/ubuntu/trusty/clamav/lp799623_fix_logrotate

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/include/llvm/Support/Regex.h

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-03-12 11:30:04 UTC
  • mfrom: (0.41.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100312113004-b0fop4bkycszdd0z
Tags: 0.96~rc1+dfsg-0ubuntu1
* New upstream RC - FFE (LP: #537636):
  - Add OfficialDatabaseOnly option to clamav-base.postinst.in
  - Add LocalSocketGroup option to clamav-base.postinst.in
  - Add LocalSocketMode option to clamav-base.postinst.in
  - Add CrossFilesystems option to clamav-base.postinst.in
  - Add ClamukoScannerCount option to clamav-base.postinst.in
  - Add BytecodeSecurity opiton to clamav-base.postinst.in
  - Add DetectionStatsHostID option to clamav-freshclam.postinst.in
  - Add Bytecode option to clamav-freshclam.postinst.in
  - Add MilterSocketGroup option to clamav-milter.postinst.in
  - Add MilterSocketMode option to clamav-milter.postinst.in
  - Add ReportHostname option to clamav-milter.postinst.in
  - Bump libclamav SO version to 6.1.0 in libclamav6.install
  - Drop clamdmon from clamav.examples (no longer shipped by upstream)
  - Drop libclamav.a from libclamav-dev.install (not built by upstream)
  - Update SO version for lintian override for libclamav6
  - Add new Bytecode Testing Tool, usr/bin/clambc, to clamav.install
  - Add build-depends on python and python-setuptools for new test suite
  - Update debian/copyright for the embedded copy of llvm (using the system
    llvm is not currently feasible)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//===-- Regex.h - Regular Expression matcher implementation -*- C++ -*-----===//
 
2
//
 
3
//                     The LLVM Compiler Infrastructure
 
4
//
 
5
// This file is distributed under the University of Illinois Open Source
 
6
// License. See LICENSE.TXT for details.
 
7
//
 
8
//===----------------------------------------------------------------------===//
 
9
//
 
10
// This file implements a POSIX regular expression matcher.
 
11
//
 
12
//===----------------------------------------------------------------------===//
 
13
 
 
14
#include <string>
 
15
 
 
16
struct llvm_regex;
 
17
 
 
18
namespace llvm {
 
19
  class StringRef;
 
20
  template<typename T> class SmallVectorImpl;
 
21
  
 
22
  class Regex {
 
23
  public:
 
24
    enum {
 
25
      NoFlags=0,
 
26
      /// Compile for matching that ignores upper/lower case distinctions.
 
27
      IgnoreCase=1,
 
28
      /// Compile for newline-sensitive matching. With this flag '[^' bracket
 
29
      /// expressions and '.' never match newline. A ^ anchor matches the 
 
30
      /// null string after any newline in the string in addition to its normal 
 
31
      /// function, and the $ anchor matches the null string before any 
 
32
      /// newline in the string in addition to its normal function.
 
33
      Newline=2
 
34
    };
 
35
 
 
36
    /// Compiles the given POSIX Extended Regular Expression \arg Regex.
 
37
    /// This implementation supports regexes and matching strings with embedded
 
38
    /// NUL characters.
 
39
    Regex(const StringRef &Regex, unsigned Flags = NoFlags);
 
40
    ~Regex();
 
41
 
 
42
    /// isValid - returns the error encountered during regex compilation, or
 
43
    /// matching, if any.
 
44
    bool isValid(std::string &Error);
 
45
 
 
46
    /// getNumMatches - In a valid regex, return the number of parenthesized
 
47
    /// matches it contains.  The number filled in by match will include this
 
48
    /// many entries plus one for the whole regex (as element 0).
 
49
    unsigned getNumMatches() const;
 
50
    
 
51
    /// matches - Match the regex against a given \arg String.
 
52
    ///
 
53
    /// \param Matches - If given, on a succesful match this will be filled in
 
54
    /// with references to the matched group expressions (inside \arg String),
 
55
    /// the first group is always the entire pattern.
 
56
    ///
 
57
    /// This returns true on a successful match.
 
58
    bool match(const StringRef &String, SmallVectorImpl<StringRef> *Matches=0);
 
59
 
 
60
    /// sub - Return the result of replacing the first match of the regex in
 
61
    /// \arg String with the \arg Repl string. Backreferences like "\0" in the
 
62
    /// replacement string are replaced with the appropriate match substring.
 
63
    ///
 
64
    /// Note that the replacement string has backslash escaping performed on
 
65
    /// it. Invalid backreferences are ignored (replaced by empty strings).
 
66
    ///
 
67
    /// \param Error If non-null, any errors in the substitution (invalid
 
68
    /// backreferences, trailing backslashes) will be recorded as a non-empty
 
69
    /// string.
 
70
    std::string sub(StringRef Repl, StringRef String, std::string *Error = 0);
 
71
 
 
72
  private:
 
73
    struct llvm_regex *preg;
 
74
    int error;
 
75
  };
 
76
}