aboutsummaryrefslogtreecommitdiff
path: root/modules/regex/regex.h
diff options
context:
space:
mode:
authorRémi Verschelde2017-08-31 11:56:19 +0200
committerGitHub2017-08-31 11:56:19 +0200
commit0cee288c1147f0f719682c544ea21b13faddf347 (patch)
treeebb259da2bb6b8d25976c02dbd21681647bf38d7 /modules/regex/regex.h
parent3b0b0a1d99e2eb8e6d2ca05c74b9ce5b0c556fce (diff)
parente3e2f063244804bb147418dc219ba6db8219304b (diff)
downloadgodot-0cee288c1147f0f719682c544ea21b13faddf347.tar.gz
godot-0cee288c1147f0f719682c544ea21b13faddf347.tar.zst
godot-0cee288c1147f0f719682c544ea21b13faddf347.zip
Diffstat (limited to 'modules/regex/regex.h')
-rw-r--r--modules/regex/regex.h47
1 files changed, 21 insertions, 26 deletions
diff --git a/modules/regex/regex.h b/modules/regex/regex.h
index 8c76035b8..0d97bcce5 100644
--- a/modules/regex/regex.h
+++ b/modules/regex/regex.h
@@ -31,59 +31,53 @@
#ifndef REGEX_H
#define REGEX_H
+#include "core/array.h"
#include "core/dictionary.h"
+#include "core/map.h"
#include "core/reference.h"
-#include "core/resource.h"
#include "core/ustring.h"
#include "core/vector.h"
-class RegExNode;
-
class RegExMatch : public Reference {
GDCLASS(RegExMatch, Reference);
- struct Group {
- Variant name;
+ struct Range {
int start;
- int length;
+ int end;
};
- Vector<Group> captures;
- String string;
+ String subject;
+ Vector<Range> data;
+ Map<String, int> names;
friend class RegEx;
- friend class RegExSearch;
- friend class RegExNodeCapturing;
- friend class RegExNodeBackReference;
protected:
static void _bind_methods();
-public:
- String expand(const String &p_template) const;
+ int _find(const Variant &p_name) const;
+public:
+ String get_subject() const;
int get_group_count() const;
- Array get_group_array() const;
-
- Array get_names() const;
- Dictionary get_name_dict() const;
+ Dictionary get_names() const;
+ Array get_strings() const;
String get_string(const Variant &p_name) const;
int get_start(const Variant &p_name) const;
int get_end(const Variant &p_name) const;
-
- RegExMatch();
};
-class RegEx : public Resource {
+class RegEx : public Reference {
- GDCLASS(RegEx, Resource);
+ GDCLASS(RegEx, Reference);
- RegExNode *root;
- Vector<Variant> group_names;
+ void *general_ctx;
+ void *code;
String pattern;
- int lookahead_depth;
+
+ void _pattern_info(uint32_t what, void *where) const;
protected:
static void _bind_methods();
@@ -91,9 +85,10 @@ protected:
public:
void clear();
Error compile(const String &p_pattern);
+ void _init(const String &p_pattern = "");
- Ref<RegExMatch> search(const String &p_text, int p_start = 0, int p_end = -1) const;
- String sub(const String &p_text, const String &p_replacement, bool p_all = false, int p_start = 0, int p_end = -1) const;
+ Ref<RegExMatch> search(const String &p_subject, int offset = 0, int end = -1) const;
+ String sub(const String &p_subject, const String &p_replacement, bool p_all = false, int p_start = 0, int p_end = -1) const;
bool is_valid() const;
String get_pattern() const;