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