]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use std::strlen
authorDaniel Arndt <arndtd@ornl.gov>
Tue, 16 May 2023 22:06:52 +0000 (18:06 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Tue, 16 May 2023 22:09:41 +0000 (18:09 -0400)
source/base/patterns.cc

index e76155a937c8157b308633cf0ec847b0140a5b28..83a04861343eb04be3cc887d7e31bab9539fa892 100644 (file)
@@ -315,18 +315,18 @@ namespace Patterns
       {
         std::istringstream is(description);
 
-        if (is.str().size() > strlen(description_init) + 1)
+        if (is.str().size() > std::strlen(description_init) + 1)
           {
             // TODO: verify that description matches the pattern "^\[Integer
             // range \d+\.\.\.\d+\]$"
             int lower_bound, upper_bound;
 
-            is.ignore(strlen(description_init) + strlen(" range "));
+            is.ignore(std::strlen(description_init) + std::strlen(" range "));
 
             if (!(is >> lower_bound))
               return std::make_unique<Integer>();
 
-            is.ignore(strlen("..."));
+            is.ignore(std::strlen("..."));
 
             if (!(is >> upper_bound))
               return std::make_unique<Integer>();
@@ -780,8 +780,9 @@ namespace Patterns
       {
         unsigned int min_elements = 0, max_elements = 0;
 
-        std::string::const_iterator it =
-          description.begin() + strlen(description_init) + strlen(" of <");
+        std::string::const_iterator it = description.begin() +
+                                         std::strlen(description_init) +
+                                         std::strlen(" of <");
 
         int  n_open_angular = 1;
         auto tmp_it         = it - 1;
@@ -803,15 +804,15 @@ namespace Patterns
           pattern_factory(base_pattern_string));
 
         std::istringstream is(
-          std::string(tmp_it + strlen(" of length "), description.end()));
+          std::string(tmp_it + std::strlen(" of length "), description.end()));
         if (!(is >> min_elements))
           return std::make_unique<List>(*base_pattern);
 
-        is.ignore(strlen("..."));
+        is.ignore(std::strlen("..."));
         if (!(is >> max_elements))
           return std::make_unique<List>(*base_pattern, min_elements);
 
-        is.ignore(strlen(" (inclusive) separated by <"));
+        is.ignore(std::strlen(" (inclusive) separated by <"));
         std::string separator;
         if (!is.eof())
           std::getline(is, separator, '>');
@@ -988,7 +989,7 @@ namespace Patterns
         unsigned int min_elements = 0, max_elements = 0;
 
         std::istringstream is(description);
-        is.ignore(strlen(description_init) + strlen(" of <"));
+        is.ignore(std::strlen(description_init) + std::strlen(" of <"));
 
         std::string key;
         std::getline(is, key, '>');
@@ -1003,17 +1004,17 @@ namespace Patterns
         std::unique_ptr<PatternBase> key_pattern(pattern_factory(key));
         std::unique_ptr<PatternBase> value_pattern(pattern_factory(value));
 
-        is.ignore(strlen(" of length "));
+        is.ignore(std::strlen(" of length "));
         if (!(is >> min_elements))
           return std::make_unique<Map>(*key_pattern, *value_pattern);
 
-        is.ignore(strlen("..."));
+        is.ignore(std::strlen("..."));
         if (!(is >> max_elements))
           return std::make_unique<Map>(*key_pattern,
                                        *value_pattern,
                                        min_elements);
 
-        is.ignore(strlen(" (inclusive) separated by <"));
+        is.ignore(std::strlen(" (inclusive) separated by <"));
         std::string separator;
         if (!is.eof())
           std::getline(is, separator, '>');
@@ -1194,7 +1195,7 @@ namespace Patterns
         std::vector<std::unique_ptr<PatternBase>> patterns;
 
         std::istringstream is(description);
-        is.ignore(strlen(description_init) + strlen(" of <"));
+        is.ignore(std::strlen(description_init) + std::strlen(" of <"));
 
         std::string len;
         std::getline(is, len, '>');
@@ -1203,7 +1204,7 @@ namespace Patterns
                ExcMessage("Provide at least 1 element in the tuple."));
         patterns.resize(n_elements);
 
-        is.ignore(strlen(" elements <"));
+        is.ignore(std::strlen(" elements <"));
 
         std::string element;
         std::getline(is, element, '>');
@@ -1211,12 +1212,12 @@ namespace Patterns
 
         for (unsigned int i = 1; i < n_elements; ++i)
           {
-            is.ignore(strlen(", <"));
+            is.ignore(std::strlen(", <"));
             std::getline(is, element, '>');
             patterns[i] = pattern_factory(element);
           }
 
-        is.ignore(strlen(" separated by <"));
+        is.ignore(std::strlen(" separated by <"));
 
         std::string separator;
         if (!is.eof())
@@ -1590,7 +1591,7 @@ namespace Patterns
         std::string        file_type;
         FileType           type;
 
-        is.ignore(strlen(description_init) + strlen(" (Type:"));
+        is.ignore(std::strlen(description_init) + std::strlen(" (Type:"));
 
         is >> file_type;
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.