projects
/
AXE.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
589f864
)
Added a copy contructor to the regex class. This prevents multiple frees in the destr...
author
arjen
<arjen>
Fri, 4 May 2007 13:56:05 +0000
(13:56 +0000)
committer
arjen
<arjen>
Fri, 4 May 2007 13:56:05 +0000
(13:56 +0000)
src/String.h
patch
|
blob
|
history
src/regex.cpp
patch
|
blob
|
history
diff --git
a/src/String.h
b/src/String.h
index
2fa0127
..
a5eee1a
100644
(file)
--- a/
src/String.h
+++ b/
src/String.h
@@
-5,7
+5,7
@@
***********************
** FILE NAME : String.h
** SYSTEM NAME : Andromeda X-Windows Encapsulation
***********************
** FILE NAME : String.h
** SYSTEM NAME : Andromeda X-Windows Encapsulation
-** VERSION NUMBER : $Revision: 1.
3
$
+** VERSION NUMBER : $Revision: 1.
4
$
**
** DESCRIPTION : Character String class definition
**
**
** DESCRIPTION : Character String class definition
**
@@
-23,7
+23,10
@@
/*****************************
$Log: String.h,v $
/*****************************
$Log: String.h,v $
- Revision 1.3 2002-11-03 13:18:57 arjen
+ Revision 1.4 2007-05-04 13:56:05 arjen
+ Added a copy contructor to the regex class. This prevents multiple frees in the destructor.
+
+ Revision 1.3 2002/11/03 13:18:57 arjen
New functions - String::escape() and String::unescape()
Revision 1.2 2002/09/28 06:45:51 arjen
New functions - String::escape() and String::unescape()
Revision 1.2 2002/09/28 06:45:51 arjen
@@
-35,7
+38,7
@@
*****************************/
*****************************/
-// static const char RCSID[] = "$Id: String.h,v 1.
3 2002-11-03 13:18:57
arjen Exp $";
+// static const char RCSID[] = "$Id: String.h,v 1.
4 2007-05-04 13:56:05
arjen Exp $";
#ifndef STRING_H
#define STRING_H
#ifndef STRING_H
#define STRING_H
@@
-46,6
+49,10
@@
#include <regex.h>
#include <regex.h>
+// Forward declarations.
+class substring;
+class regex;
+
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
** NAME : String - Character String class.
** MEMBERS : p -> s : Pointer to the actual String data.
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
** NAME : String - Character String class.
** MEMBERS : p -> s : Pointer to the actual String data.
@@
-72,7
+79,6
@@
**+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
**+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
-
class String
{
friend class substring;
class String
{
friend class substring;
@@
-359,11
+365,13
@@
class regex
friend class String;
regex_t expression;
friend class String;
regex_t expression;
+ String original;
public:
regex(const String & reg);
regex(const char * reg);
public:
regex(const String & reg);
regex(const char * reg);
+ regex(const regex & reg);
~regex();
friend bool operator == (const String &s, const regex &r);
~regex();
friend bool operator == (const String &s, const regex &r);
diff --git
a/src/regex.cpp
b/src/regex.cpp
index
025ff40
..
f1c5033
100644
(file)
--- a/
src/regex.cpp
+++ b/
src/regex.cpp
@@
-5,7
+5,7
@@
***********************
** FILE NAME : regex.cpp
** SYSTEM NAME : Andromeda X-Windows Encapsulation
***********************
** FILE NAME : regex.cpp
** SYSTEM NAME : Andromeda X-Windows Encapsulation
-** VERSION NUMBER : $Revision: 1.
2
$
+** VERSION NUMBER : $Revision: 1.
3
$
**
** DESCRIPTION : regex class implementation.
**
**
** DESCRIPTION : regex class implementation.
**
@@
-23,7
+23,10
@@
/*****************************
$Log: regex.cpp,v $
/*****************************
$Log: regex.cpp,v $
- Revision 1.2 2002-09-28 06:45:51 arjen
+ Revision 1.3 2007-05-04 13:56:05 arjen
+ Added a copy contructor to the regex class. This prevents multiple frees in the destructor.
+
+ Revision 1.2 2002/09/28 06:45:51 arjen
New feature: subtring selection by regular expression.
Bugfix: use the std: namespace for STL classes istream and ostream
New feature: subtring selection by regular expression.
Bugfix: use the std: namespace for STL classes istream and ostream
@@
-32,7
+35,7
@@
*****************************/
*****************************/
-static const char RCSID[] = "$Id: regex.cpp,v 1.
2 2002-09-28 06:45:51
arjen Exp $";
+static const char RCSID[] = "$Id: regex.cpp,v 1.
3 2007-05-04 13:56:05
arjen Exp $";
#include <stdio.h>
#include <ctype.h>
#include <stdio.h>
#include <ctype.h>
@@
-42,14
+45,22
@@
static const char RCSID[] = "$Id: regex.cpp,v 1.2 2002-09-28 06:45:51 arjen Exp
regex::regex(const String ®)
{
regex::regex(const String ®)
{
+ original = reg;
regcomp (&expression, reg.p->s, REG_EXTENDED);
}
regex::regex(const char *reg)
{
regcomp (&expression, reg.p->s, REG_EXTENDED);
}
regex::regex(const char *reg)
{
+ original = reg;
regcomp (&expression, reg, REG_EXTENDED);
}
regcomp (&expression, reg, REG_EXTENDED);
}
+regex::regex(const regex & reg)
+{
+ original = reg.original;
+ regcomp (&expression, reg.original, REG_EXTENDED);
+}
+
regex::~regex()
{
regfree(&expression);
regex::~regex()
{
regfree(&expression);