Re: [pcre-dev] pcrecpp::no_arg is not exported in Windows po…

トップ ページ
このメッセージを削除
著者: Craig Silverstein
日付:  
To: gshiman
CC: Pcre-dev
題目: Re: [pcre-dev] pcrecpp::no_arg is not exported in Windows port ofpcrecpp
OK, here's a patch that just moves no_arg into the RE class. Can you
verify if this patch works for you? If so, Philip, can you apply it
when the time comes?

craig

--cut here--

Index: pcrecpp.h
===================================================================
--- pcrecpp.h    (revision 301)
+++ pcrecpp.h    (working copy)
@@ -346,9 +346,6 @@
 #define PCRE_IS_SET(o)  \
         (all_options_ & o) == o


-// We convert user-passed pointers into special Arg objects
-PCRECPP_EXP_DECL Arg no_arg;
-
/***** Compiling regular expressions: the RE class *****/

 // RE_Options allow you to set options to be passed along to pcre,
@@ -403,25 +400,25 @@
     return PCRE_IS_SET(PCRE_DOTALL);
   }
   RE_Options &set_dotall(bool x) {
-    PCRE_SET_OR_CLEAR(x,PCRE_DOTALL);
+    PCRE_SET_OR_CLEAR(x, PCRE_DOTALL);
   }


   bool extended() const {
     return PCRE_IS_SET(PCRE_EXTENDED);
   }
   RE_Options &set_extended(bool x) {
-    PCRE_SET_OR_CLEAR(x,PCRE_EXTENDED);
+    PCRE_SET_OR_CLEAR(x, PCRE_EXTENDED);
   }


   bool dollar_endonly() const {
     return PCRE_IS_SET(PCRE_DOLLAR_ENDONLY);
   }
   RE_Options &set_dollar_endonly(bool x) {
-    PCRE_SET_OR_CLEAR(x,PCRE_DOLLAR_ENDONLY);
+    PCRE_SET_OR_CLEAR(x, PCRE_DOLLAR_ENDONLY);
   }


   bool extra() const {
-    return PCRE_IS_SET( PCRE_EXTRA);
+    return PCRE_IS_SET(PCRE_EXTRA);
   }
   RE_Options &set_extra(bool x) {
     PCRE_SET_OR_CLEAR(x, PCRE_EXTRA);
@@ -646,6 +643,9 @@
   // regexp wasn't valid on construction.
   int NumberOfCapturingGroups() const;


+ // The default value for an argument, to indicate no arg was passed in
+ static Arg no_arg;
+
private:

   void Init(const string& pattern, const RE_Options* options);
Index: pcrecpp.cc
===================================================================
--- pcrecpp.cc    (revision 301)
+++ pcrecpp.cc    (working copy)
@@ -55,7 +55,7 @@
 static const int kVecSize = (1 + kMaxArgs) * 3;  // results + PCRE workspace


// Special object that stands-in for no argument
-PCRECPP_EXP_DEFN Arg no_arg((void*)NULL);
+Arg RE::no_arg((void*)NULL);

 // If a regular expression has no error, its error_ field points here
 static const string empty_string;
Index: pcre_scanner.h
===================================================================
--- pcre_scanner.h    (revision 301)
+++ pcre_scanner.h    (working copy)
@@ -80,9 +80,9 @@
   // If it returns true, it skips over the matched input and any
   // following input that matches the "skip" regular expression.
   bool Consume(const RE& re,
-               const Arg& arg0 = no_arg,
-               const Arg& arg1 = no_arg,
-               const Arg& arg2 = no_arg
+               const Arg& arg0 = RE::no_arg,
+               const Arg& arg1 = RE::no_arg,
+               const Arg& arg2 = RE::no_arg
                // TODO: Allow more arguments?
                );