Browse code

Add warnings to building with GCC/Clang.

* These were mostly copied from the old Makefile.
* The files including wxWidgets need -Wno-old-style-cast done in the code via pragmas because I do not want to disable that warning for the rest of the files. (It might've been overkill for some places where wxWidgets was included, but whatever.)

Naram Qashat authored on 2021/04/04 23:35:09
Showing 1 changed files
... ...
@@ -1,5 +1,17 @@
1
+#ifdef __GNUC__
2
+# pragma GCC diagnostic push
3
+# pragma GCC diagnostic ignored "-Wold-style-cast"
4
+#elif defined(__clang__)
5
+# pragma clang diagnostic push
6
+# pragma clang diagnostic ignored "-Wold-style-cast"
7
+#endif
1 8
 #include <wx/object.h>
2 9
 #include <wx/string.h>
10
+#ifdef __GNUC__
11
+# pragma GCC diagnostic pop
12
+#elif defined(__clang__)
13
+# pragma clang diagnostic pop
14
+#endif
3 15
 #include "RegExValidator.h"
4 16
 
5 17
 RegExValidator::RegExValidator(const wxString &regExpString, wxString *valPtr, int regExpFlags) : wxTextValidator(wxFILTER_EMPTY, valPtr), regEx(regExpString, regExpFlags), regExString(regExpString), regExFlags(regExpFlags)
Browse code

Minor changes to the RegEx validator.

Naram Qashat authored on 2021/03/29 23:32:29
Showing 1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 #include <wx/string.h>
3 3
 #include "RegExValidator.h"
4 4
 
5
-RegExValidator::RegExValidator(wxString regExpString, wxString *valPtr, int regExpFlags) : wxTextValidator(wxFILTER_EMPTY, valPtr), regEx(regExpString, regExpFlags), regExString(regExpString), regExFlags(regExpFlags)
5
+RegExValidator::RegExValidator(const wxString &regExpString, wxString *valPtr, int regExpFlags) : wxTextValidator(wxFILTER_EMPTY, valPtr), regEx(regExpString, regExpFlags), regExString(regExpString), regExFlags(regExpFlags)
6 6
 {
7 7
 }
8 8
 
Browse code

Add a RegEx validator for use with wxWidgets.

Naram Qashat authored on 2021/03/29 21:55:32
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,20 @@
1
+#include <wx/object.h>
2
+#include <wx/string.h>
3
+#include "RegExValidator.h"
4
+
5
+RegExValidator::RegExValidator(wxString regExpString, wxString *valPtr, int regExpFlags) : wxTextValidator(wxFILTER_EMPTY, valPtr), regEx(regExpString, regExpFlags), regExString(regExpString), regExFlags(regExpFlags)
6
+{
7
+}
8
+
9
+wxObject *RegExValidator::Clone() const
10
+{
11
+	return new RegExValidator(this->regExString, this->m_stringValue, this->regExFlags);
12
+}
13
+
14
+wxString RegExValidator::IsValid(const wxString &str) const
15
+{
16
+	if (!this->regEx.Matches(str))
17
+		return "Invalid format.";
18
+
19
+	return wxTextValidator::IsValid(str);
20
+}