lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [5417] Allow proprietary files to contain "taboo" strings


From: Greg Chicares
Subject: [lmi-commits] [5417] Allow proprietary files to contain "taboo" strings
Date: Tue, 06 Mar 2012 17:42:19 +0000

Revision: 5417
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5417
Author:   chicares
Date:     2012-03-06 17:42:18 +0000 (Tue, 06 Mar 2012)
Log Message:
-----------
Allow proprietary files to contain "taboo" strings

Modified Paths:
--------------
    lmi/trunk/my_test_coding_rules.cpp
    lmi/trunk/test_coding_rules.cpp

Modified: lmi/trunk/my_test_coding_rules.cpp
===================================================================
--- lmi/trunk/my_test_coding_rules.cpp  2012-03-01 12:27:26 UTC (rev 5416)
+++ lmi/trunk/my_test_coding_rules.cpp  2012-03-06 17:42:18 UTC (rev 5417)
@@ -29,10 +29,25 @@
 #include <map>
 #include <string>
 
-/// Public dummy for private taboo regexen.
+/// Files containing this regex are exempt from private taboos.
 ///
+/// Copy this file to '../products/src' and edit the copy to specify
+/// a regex (such as a specific license notice) that grants an
+/// indulgence to utter what would otherwise be taboo.
+///
+/// This dummy implementation exempts only files containing '\v',
+/// which is always forbidden for files subject to taboos; thus,
+/// it grants no effective indulgence at all.
+
+std::string my_taboo_indulgence()
+{
+    return "\v";
+}
+
+/// List of private taboo regexen.
+///
 /// Copy this file to '../products/src' and edit the copy to express
-/// private taboos--anything that shouldn't be uttered in the
+/// private taboos--anything that shouldn't be uttered in the public
 /// repository, even to forbid it, such as a client's name.
 
 std::map<std::string, bool> my_taboos()

Modified: lmi/trunk/test_coding_rules.cpp
===================================================================
--- lmi/trunk/test_coding_rules.cpp     2012-03-01 12:27:26 UTC (rev 5416)
+++ lmi/trunk/test_coding_rules.cpp     2012-03-06 17:42:18 UTC (rev 5417)
@@ -41,7 +41,7 @@
 #include <boost/filesystem/path.hpp>
 #include <boost/regex.hpp>
 
-#include <cstddef>        // std::size_t
+#include <cstddef>                      // std::size_t
 #include <ctime>
 #include <iomanip>
 #include <ios>
@@ -53,8 +53,10 @@
 #include <stdexcept>
 #include <string>
 
-std::map<std::string, bool> my_taboos();
+std::string my_taboo_indulgence();       // See 'my_test_coding_rules.cpp'.
 
+std::map<std::string, bool> my_taboos(); // See 'my_test_coding_rules.cpp'.
+
 // Open predefined standard streams in binary mode.
 //
 // There is no portable way to do this. Of course, it doesn't matter
@@ -922,17 +924,20 @@
         taboo(f, "WIN32", boost::regex::icase);
         }
 
-    // Unspeakable private taboos.
-    std::map<std::string, bool> const z = my_taboos();
-    typedef std::map<std::string, bool>::const_iterator mci;
-    for(mci i = z.begin(); i != z.end(); ++i)
+    if(!boost::regex_search(f.data(), boost::regex(my_taboo_indulgence())))
         {
-        boost::regex::flag_type syntax =
-            i->second
-            ? boost::regex::ECMAScript | boost::regex::icase
-            : boost::regex::ECMAScript
-            ;
-        taboo(f, i->first, syntax);
+        // Unspeakable private taboos.
+        std::map<std::string, bool> const z = my_taboos();
+        typedef std::map<std::string, bool>::const_iterator mci;
+        for(mci i = z.begin(); i != z.end(); ++i)
+            {
+            boost::regex::flag_type syntax =
+                i->second
+                ? boost::regex::ECMAScript | boost::regex::icase
+                : boost::regex::ECMAScript
+                ;
+            taboo(f, i->first, syntax);
+            }
         }
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]