Author: jkupec
Date: Sat Apr 12 00:00:55 2008
New Revision: 9562
URL: http://svn.opensuse.org/viewcvs/zypp?rev=9562&view=rev
Log:
- operator= and copy c-tor added
- regex_t * get() added for direct use in regexec()
Modified:
trunk/libzypp/zypp/base/Regex.cc
trunk/libzypp/zypp/base/Regex.h
Modified: trunk/libzypp/zypp/base/Regex.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/base/Regex.cc?rev=9562&r1=9561&r2=9562&view=diff
==============================================================================
--- trunk/libzypp/zypp/base/Regex.cc (original)
+++ trunk/libzypp/zypp/base/Regex.cc Sat Apr 12 00:00:55 2008
@@ -28,6 +28,8 @@
void regex::assign(const std::string& str,int flags)
{
m_valid = true;
+ m_str = str;
+ m_flags = flags;
int err;
char errbuff[100];
if (!(flags & normal)) {
Modified: trunk/libzypp/zypp/base/Regex.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/base/Regex.h?rev=9562&r1=9561&r2=9562&view=diff
==============================================================================
--- trunk/libzypp/zypp/base/Regex.h (original)
+++ trunk/libzypp/zypp/base/Regex.h Sat Apr 12 00:00:55 2008
@@ -12,9 +12,7 @@
#ifndef ZYPP_BASE_REGEX_H
#define ZYPP_BASE_REGEX_H
-#include <iosfwd>
#include <string>
-
#include
#include "zypp/base/Exception.h"
@@ -32,20 +30,12 @@
///////////////////////////////////////////////////////////////////
/** \defgroup ZYPP_STR_REGEX Regular expressions
*
- * Namespace zypp::str regular expressions \b using the
- * boost regex library
- * \url http://www.boost.org/libs/regex/doc/index.html.
- *
- * \li \c regex
- * \li \c regex_match
- * \li \c regex_search
- * \li \c regex_replace
- * \li \c match_results
- * \li \c cmatch
- * \li \c wcmatch
- * \li \c smatch
- * \li \c wsmatch
- */
+ * Namespace zypp::str regular expressions \b using the glibc regex library.
+ *
+ * regex
+ * regex_match
+ * smatch
+ */
typedef Exception regex_error;
@@ -76,12 +66,26 @@
regex(const std::string& s,int flags = match_extended);
~regex() throw();
+ regex(const regex & rhs)
+ { assign(rhs.m_str, rhs.m_flags); }
+
+ regex & operator=(const regex & rhs)
+ { assign(rhs.m_str, rhs.m_flags); return *this; }
+
+ public:
+ /** Expert backdoor. Returns pointer to the compiled regex for direct use in regexec() */
+ regex_t * get()
+ { return & m_preg; }
+
+ private:
void assign(const std::string& s,int flags = match_extended);
private:
friend class smatch;
friend bool regex_match(const char * s, str::smatch& matches, const regex& regex);
friend bool regex_match(const char * s, const regex& regex);
+ std::string m_str;
+ int m_flags;
regex_t m_preg;
bool m_valid;
};
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org