std::string message;
auto append_to_message = [&message](const char *p) {
- if (message.length() > 0)
+ if (message.size() > 0)
message += ", ";
message += p;
};
inline std::size_t
memory_consumption(const std::string &s)
{
- return sizeof(s) + s.length();
+ return sizeof(s) + s.size();
}
columns[key].max_length =
std::max(columns[key].max_length,
static_cast<unsigned int>(
- entry.get_cached_string().length()));
+ entry.get_cached_string().size()));
}
}
entry.cache_string(columns[key].scientific, columns[key].precision);
columns[key].max_length =
std::max(columns[key].max_length,
- static_cast<unsigned int>(entry.get_cached_string().length()));
+ static_cast<unsigned int>(entry.get_cached_string().size()));
}
// if there was anything left in the stream that is current to this
// thread, make sure we flush it before it gets lost
{
- if (get_stream().str().length() > 0)
+ if (get_stream().str().size() > 0)
{
// except the situation is not quite that simple. if this object is
// the 'deallog' object, then it is destroyed upon exit of the
// If we see the line which is the same as @p last_line ,
// terminate the parsing.
- if (last_line.length() != 0 && input_line == last_line)
+ if (last_line.size() != 0 && input_line == last_line)
break;
// Check whether or not the current line should be joined with the next
// line before calling scan_line.
- if (input_line.length() != 0 &&
- input_line.find_last_of('\\') == input_line.length() - 1)
+ if (input_line.size() != 0 &&
+ input_line.find_last_of('\\') == input_line.size() - 1)
{
- input_line.erase(input_line.length() - 1); // remove the last '\'
+ input_line.erase(input_line.size() - 1); // remove the last '\'
is_concatenated = true;
fully_concatenated_line += input_line;
for (const auto &p : current_section)
if (is_parameter_node(p.second) == true)
{
- longest_name = std::max(longest_name, demangle(p.first).length());
- longest_value =
- std::max(longest_value,
- p.second.get<std::string>("value").length());
+ longest_name = std::max(longest_name, demangle(p.first).size());
+ longest_value = std::max(longest_value,
+ p.second.get<std::string>("value").size());
}
// print entries one by one
// print name and value of this entry
out << std::setw(overall_indent_level * 2) << ""
<< "set " << demangle(p.first)
- << std::setw(longest_name - demangle(p.first).length() + 1)
- << " "
+ << std::setw(longest_name - demangle(p.first).size() + 1) << " "
<< "= " << value;
// finally print the default value, but only if it differs
if (!is_short &&
value != p.second.get<std::string>("default_value"))
{
- out << std::setw(longest_value - value.length() + 1) << ' '
+ out << std::setw(longest_value - value.size() + 1) << ' '
<< "# ";
out << "default: "
<< p.second.get<std::string>("default_value");
std::size_t longest_name = 0;
for (const auto &p : current_section)
if (is_parameter_node(p.second) == true)
- longest_name = std::max(longest_name, demangle(p.first).length());
+ longest_name = std::max(longest_name, demangle(p.first).size());
// print entries one by one
for (const auto &p : current_section)
// print name and value
out << std::setw(overall_indent_level * 2) << ""
<< "set " << demangle(p.first)
- << std::setw(longest_name - demangle(p.first).length() + 1)
- << " "
+ << std::setw(longest_name - demangle(p.first).size() + 1) << " "
<< " = ";
// print possible values:
// if there is a documenting string, print it as well
if (!is_short &&
- p.second.get<std::string>("documentation").length() != 0)
+ p.second.get<std::string>("documentation").size() != 0)
out << std::setw(overall_indent_level * 2 + longest_name + 10)
<< ""
<< "(" << p.second.get<std::string>("documentation") << ")"
line = Utilities::trim(line);
// if line is now empty: leave
- if (line.length() == 0)
+ if (line.size() == 0)
{
return;
}
Utilities::match_at_string_start(line, "subsection "))
{
// delete this prefix
- line.erase(0, std::string("subsection").length() + 1);
+ line.erase(0, std::string("subsection").size() + 1);
const std::string subsection = Utilities::trim(line);
std::string tmp(sequence);
// remove whitespace at beginning
- while ((tmp.length() != 0) && (std::isspace(tmp.front()) != 0))
+ while ((tmp.size() != 0) && (std::isspace(tmp.front()) != 0))
tmp.erase(0, 1);
// check the different possibilities
}
// remove whitespace at the end
- while ((tmp.length() != 0) && (std::isspace(tmp.back()) != 0))
+ while ((tmp.size() != 0) && (std::isspace(tmp.back()) != 0))
tmp.erase(tmp.end() - 1);
// check last choice, not finished by |
std::string sequence(description);
sequence.erase(0, std::strlen(description_init) + 1);
- sequence.erase(sequence.length() - 2, 2);
+ sequence.erase(sequence.size() - 2, 2);
return std::make_unique<Selection>(sequence);
}
std::vector<std::string> split_names;
// first split the input list
- while (tmp.length() != 0)
+ while (tmp.size() != 0)
{
std::string name;
name = tmp;
else
tmp = "";
- while ((name.length() != 0) && (std::isspace(name.front()) != 0))
+ while ((name.size() != 0) && (std::isspace(name.front()) != 0))
name.erase(0, 1);
- while ((name.length() != 0) && (std::isspace(name.back()) != 0))
- name.erase(name.length() - 1, 1);
+ while ((name.size() != 0) && (std::isspace(name.back()) != 0))
+ name.erase(name.size() - 1, 1);
split_names.push_back(name);
}
std::string sequence(description);
sequence.erase(0, std::strlen(description_init) + 1);
- sequence.erase(sequence.length() - 2, 2);
+ sequence.erase(sequence.size() - 2, 2);
return std::make_unique<MultipleSelection>(sequence);
}
entry.cache_string(scientific, precision);
max_length =
std::max(max_length,
- static_cast<unsigned int>(entry.get_cached_string().length()));
+ static_cast<unsigned int>(entry.get_cached_string().size()));
}
}
entry.cache_string(this->scientific, this->precision);
max_length =
std::max(max_length,
- static_cast<unsigned int>(entry.get_cached_string().length()));
+ static_cast<unsigned int>(entry.get_cached_string().size()));
}
}
entry.cache_string(column.second.scientific, column.second.precision);
column.second.max_length =
std::max(column.second.max_length,
- static_cast<unsigned int>(
- entry.get_cached_string().length()));
+ static_cast<unsigned int>(entry.get_cached_string().size()));
}
}
const std::string &key = sel_columns[j];
column_widths[j] =
std::max(column_widths[j],
- static_cast<unsigned int>(key.length()));
+ static_cast<unsigned int>(key.size()));
out << std::setw(column_widths[j]);
out << key << " | ";
}
}
// header is longer than the column(s) under it
- if (width < key.length())
+ if (width < key.size())
{
// make the column or the last column in this
// supercolumn wide enough
{
if (sel_columns[i] == colname)
{
- column_widths[i] += key.length() - width;
+ column_widths[i] += key.size() - width;
break;
}
}
- width = key.length();
+ width = key.size();
}
// now write key. try to center it somehow
- const unsigned int front_padding = (width - key.length()) / 2,
+ const unsigned int front_padding = (width - key.size()) / 2,
rear_padding =
- (width - key.length()) - front_padding;
+ (width - key.size()) - front_padding;
for (unsigned int i = 0; i < front_padding; ++i)
out << ' ';
out << key;
// get the maximum width among all sections
unsigned int max_width = 0;
for (const auto &i : sections)
- max_width =
- std::max(max_width, static_cast<unsigned int>(i.first.length()));
+ max_width = std::max(max_width, static_cast<unsigned int>(i.first.size()));
// 32 is the default width until | character
max_width = std::max(max_width + 1, static_cast<unsigned int>(32));
// get the maximum width among all sections
unsigned int max_width = 0;
for (const auto &i : sections)
- max_width =
- std::max(max_width, static_cast<unsigned int>(i.first.length()));
+ max_width = std::max(max_width, static_cast<unsigned int>(i.first.size()));
// 17 is the default width until | character
max_width = std::max(max_width + 1, static_cast<unsigned int>(17));
// as discussed in the documentation, eat whitespace from the end
// of the string
- while (tmp.length() != 0 && tmp[tmp.length() - 1] == ' ')
- tmp.erase(tmp.length() - 1, 1);
+ while (tmp.size() != 0 && tmp[tmp.size() - 1] == ' ')
+ tmp.erase(tmp.size() - 1, 1);
// split the input list until it is empty. since in every iteration
// 'tmp' is what's left of the string after the next delimiter,
// there was space after the last delimiter. this matches what's
// discussed in the documentation
std::vector<std::string> split_list;
- while (tmp.length() != 0)
+ while (tmp.size() != 0)
{
std::string name;
name = tmp;
tmp = "";
// strip spaces from this element's front and end
- while ((name.length() != 0) && (name[0] == ' '))
+ while ((name.size() != 0) && (name[0] == ' '))
name.erase(0, 1);
- while (name.length() != 0 && name[name.length() - 1] == ' ')
- name.erase(name.length() - 1, 1);
+ while (name.size() != 0 && name[name.size() - 1] == ' ')
+ name.erase(name.size() - 1, 1);
split_list.push_back(name);
}
std::vector<std::string> lines;
// remove trailing spaces
- while ((text.length() != 0) && (text[text.length() - 1] == delimiter))
- text.erase(text.length() - 1, 1);
+ while ((text.size() != 0) && (text[text.size() - 1] == delimiter))
+ text.erase(text.size() - 1, 1);
// then split the text into lines
- while (text.length() != 0)
+ while (text.size() != 0)
{
// in each iteration, first remove
// leading spaces
- while ((text.length() != 0) && (text[0] == delimiter))
+ while ((text.size() != 0) && (text[0] == delimiter))
text.erase(0, 1);
std::size_t pos_newline = text.find_first_of('\n', 0);
if (pos_newline != std::string::npos && pos_newline <= width)
{
std::string line(text, 0, pos_newline);
- while ((line.length() != 0) &&
- (line[line.length() - 1] == delimiter))
- line.erase(line.length() - 1, 1);
+ while ((line.size() != 0) && (line[line.size() - 1] == delimiter))
+ line.erase(line.size() - 1, 1);
lines.push_back(line);
text.erase(0, pos_newline + 1);
continue;
// if we can fit everything into one
// line, then do so. otherwise, we have
// to keep breaking
- if (text.length() < width)
+ if (text.size() < width)
{
// remove trailing spaces
- while ((text.length() != 0) &&
- (text[text.length() - 1] == delimiter))
- text.erase(text.length() - 1, 1);
+ while ((text.size() != 0) && (text[text.size() - 1] == delimiter))
+ text.erase(text.size() - 1, 1);
lines.push_back(text);
text = "";
}
// starting at position width, find the
// location of the previous space, so
// that we can break around there
- int location = std::min<int>(width, text.length() - 1);
+ int location = std::min<int>(width, text.size() - 1);
for (; location > 0; --location)
if (text[location] == delimiter)
break;
// if there are no spaces, then try if
// there are spaces coming up
if (location == 0)
- for (location = std::min<int>(width, text.length() - 1);
- location < static_cast<int>(text.length());
+ for (location = std::min<int>(width, text.size() - 1);
+ location < static_cast<int>(text.size());
++location)
if (text[location] == delimiter)
break;
// location and put it into a single
// line, and remove it from 'text'
std::string line(text, 0, location);
- while ((line.length() != 0) &&
- (line[line.length() - 1] == delimiter))
- line.erase(line.length() - 1, 1);
+ while ((line.size() != 0) && (line[line.size() - 1] == delimiter))
+ line.erase(line.size() - 1, 1);
lines.push_back(line);
text.erase(0, location);
}
const unsigned int number_points,
const bool is_upper)
{
- Assert(serialnumber.length() == 4,
+ Assert(serialnumber.size() == 4,
ExcMessage("This NACA-serial number is not implemented!"));
return naca_create_points_4_digits(serialnumber,
}) != line.end())
{
in.putback('\n');
- for (int i = line.length() - 1; i >= 0; --i)
+ for (int i = line.size() - 1; i >= 0; --i)
in.putback(line[i]);
return;
}
{
const std::string::size_type slashpos = name.find_last_of('/');
const std::string::size_type dotpos = name.find_last_of('.');
- if (dotpos < name.length() &&
+ if (dotpos < name.size() &&
(dotpos > slashpos || slashpos == std::string::npos))
{
std::string ext = name.substr(dotpos + 1);