2014-02-10 01:10:30 +00:00
|
|
|
/*************************************************/
|
|
|
|
/* regex.h */
|
|
|
|
/*************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/*************************************************/
|
|
|
|
/* Source code within this file is: */
|
|
|
|
/* (c) 2007-2010 Juan Linietsky, Ariel Manzur */
|
|
|
|
/* All Rights Reserved. */
|
|
|
|
/*************************************************/
|
|
|
|
|
|
|
|
#ifndef REGEX_H
|
|
|
|
#define REGEX_H
|
|
|
|
|
|
|
|
#include "ustring.h"
|
2015-07-24 00:18:46 +00:00
|
|
|
#include "vector.h"
|
2014-02-10 01:10:30 +00:00
|
|
|
#include "core/reference.h"
|
2015-07-24 00:18:46 +00:00
|
|
|
#include "nrex.hpp"
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
class RegEx : public Reference {
|
|
|
|
|
|
|
|
OBJ_TYPE(RegEx, Reference);
|
|
|
|
|
|
|
|
mutable String text;
|
2015-07-24 00:18:46 +00:00
|
|
|
mutable Vector<nrex_result> captures;
|
|
|
|
nrex exp;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
static void _bind_methods();
|
2015-07-24 00:18:46 +00:00
|
|
|
StringArray _bind_get_capture_list() const;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
bool is_valid() const;
|
|
|
|
int get_capture_count() const;
|
2015-07-24 00:18:46 +00:00
|
|
|
String get_capture(int capture) const;
|
|
|
|
Error compile(const String& p_pattern);
|
|
|
|
bool match(const String& p_text, int p_start = 0, int p_end = -1) const;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
RegEx();
|
|
|
|
RegEx(const String& p_pattern);
|
|
|
|
~RegEx();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // REGEX_H
|