[glibmm] Revert "Deprecate Regex now that we have std::regex."
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Revert "Deprecate Regex now that we have std::regex."
- Date: Tue, 1 Sep 2015 15:03:29 +0000 (UTC)
commit 0048bccd55e631da98b1ff9d016afa6b813bfc37
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Sep 1 17:01:19 2015 +0200
Revert "Deprecate Regex now that we have std::regex."
I didn't mean to push this yet. Maybe we will never deprecate this
if it offers better UTF-8 support than std::regex.
This reverts commit a1f0b1a06095d81b6a5b8255b818b1c35c92df29.
examples/Makefile.am | 1 +
examples/regex/main.cc | 45 +++++++++++++++++++++++++++++++++++++++++++++
glib/glibmm.h | 1 +
glib/src/filelist.am | 2 +-
glib/src/regex.hg | 7 -------
5 files changed, 48 insertions(+), 8 deletions(-)
---
diff --git a/examples/Makefile.am b/examples/Makefile.am
index bc98505..0de871a 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -31,6 +31,7 @@ check_PROGRAMS = \
network/socket-server \
options/example \
properties/example \
+ regex/example \
settings/settings \
thread/dispatcher \
thread/dispatcher2 \
diff --git a/examples/regex/main.cc b/examples/regex/main.cc
new file mode 100644
index 0000000..ed6ac56
--- /dev/null
+++ b/examples/regex/main.cc
@@ -0,0 +1,45 @@
+/* Copyright (C) 2004 The glibmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm.h>
+#include <iostream>
+#include <iomanip>
+
+int main(int, char**)
+{
+ Glib::init();
+
+ /* Reusing one regex pattern: */
+ const auto regex = Glib::Regex::create("(a)?(b)");
+ std::cout << "Pattern=" << regex->get_pattern()
+ << ", with string=abcd, result="
+ << std::boolalpha << regex->match("abcd")
+ << std::endl;
+ std::cout << "Pattern=" << regex->get_pattern()
+ << ", with string=1234, result="
+ << std::boolalpha << regex->match("1234")
+ << std::endl;
+ std::cout << std::endl;
+
+ /* Using the static function without a regex instance: */
+ std::cout << "Pattern=b* with string=abcd, result="
+ << std::boolalpha << Glib::Regex::match_simple("b*", "abcd")
+ << std::endl;
+
+ return 0;
+}
+
diff --git a/glib/glibmm.h b/glib/glibmm.h
index 3f076d2..fb409f8 100644
--- a/glib/glibmm.h
+++ b/glib/glibmm.h
@@ -36,6 +36,7 @@
* - Glib::ustring: A UTF-8 string class that can be used interchangably with std::string. Plus @ref
StringUtils
* - Glib::RefPtr: A reference-counting smartpointer, for use with Glib::ObjectBase or similar
* - @ref CharsetConv
+ * - Glib::Regex: Regular expression string matching.
* - Glib::KeyFile: Parsing and writing of key files (similar to .ini files)
* - Glib::Checksum
* - Glib::Date, Glib::Timer, Glib::TimeVal
diff --git a/glib/src/filelist.am b/glib/src/filelist.am
index 8851af5..9434132 100644
--- a/glib/src/filelist.am
+++ b/glib/src/filelist.am
@@ -32,6 +32,7 @@ glibmm_files_any_hg = \
optioncontext.hg \
optionentry.hg \
optiongroup.hg \
+ regex.hg \
shell.hg \
spawn.hg \
threads.hg \
@@ -44,7 +45,6 @@ glibmm_files_any_hg = \
varianttype.hg
glibmm_files_deprecated_hg = \
- regex.hg \
thread.hg \
valuearray.hg
diff --git a/glib/src/regex.hg b/glib/src/regex.hg
index 66bfe34..0044b12 100644
--- a/glib/src/regex.hg
+++ b/glib/src/regex.hg
@@ -17,8 +17,6 @@
_DEFS(glibmm,glib)
-_IS_DEPRECATED // This whole file is deprecated.
-
#include <glibmmconfig.h>
#include <glibmm/refptr.h>
#include <glibmm/ustring.h>
@@ -37,7 +35,6 @@ _WRAP_ENUM(RegexCompileFlags, GRegexCompileFlags, NO_GTYPE)
_WRAP_ENUM(RegexMatchFlags, GRegexMatchFlags, NO_GTYPE)
/** Exception class for Regex
- * @deprecated Glib::Regex is deprecated in favor of std::regex.
*/
_WRAP_GERROR(RegexError, GRegexError, G_REGEX_ERROR, NO_GTYPE)
@@ -94,8 +91,6 @@ class MatchInfo;
* The regular expressions low level functionalities are obtained through the
* excellent PCRE library written by Philip Hazel.
*
- * @deprecated Glib::Regex is deprecated in favor of std::regex.
- *
* @newin{2,14}
*/
class Regex final
@@ -215,8 +210,6 @@ public:
/** MatchInfo - MatchInfo is used to retrieve information about the regular
* expression match which created it.
* @newin{2,28}
- *
- * @deprecated Glib::Regex is deprecated in favor of std::regex.
*/
class MatchInfo
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]