summaryrefslogtreecommitdiff
path: root/includes/BRegex.h
blob: 4a2f207bcc4af0ace5ef1b9f645f7c6394538272 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once

#include <vector>
#include <sys/types.h>
#include <regex.h>
#include <BString.h>
#include <Exceptions.h>

namespace Balau {

class Regex {
  public:
    typedef std::vector<String> Captures;
      Regex(const char * regex, bool icase = false) throw (GeneralException);
      ~Regex();
    Captures match(const char * str) const throw (GeneralException);
  private:
    String getError(int err) const;
    regex_t m_regex;
};

class Regexes {
  public:
    static const Regex any;
    static const Regex empty;
};

};