1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-16 10:09:58 +00:00

clang-tidy: apply readability-container-size-empty check

This commit is contained in:
Carles Fernandez 2019-02-11 14:47:18 +01:00
parent 16bd8aa983
commit 298a9c2391

View File

@ -786,7 +786,7 @@ inline Gnuplot::Gnuplot(const std::vector<double> &x,
template <typename X>
Gnuplot &Gnuplot::plot_x(const X &x, const std::string &title)
{
if (x.size() == 0)
if (x.empty())
{
throw GnuplotException("std::vector too small");
return *this;
@ -794,7 +794,7 @@ Gnuplot &Gnuplot::plot_x(const X &x, const std::string &title)
std::ofstream tmp;
std::string name = create_tmpfile(tmp);
if (name == "")
if (name.empty())
return *this;
//
@ -819,7 +819,7 @@ Gnuplot &Gnuplot::plot_x(const X &x, const std::string &title)
template <typename X, typename Y>
Gnuplot &Gnuplot::plot_xy(const X &x, const Y &y, const std::string &title, const unsigned int decimate)
{
if (x.size() == 0 || y.size() == 0)
if (x.empty() || y.empty())
{
throw GnuplotException("std::vectors too small");
return *this;
@ -833,7 +833,7 @@ Gnuplot &Gnuplot::plot_xy(const X &x, const Y &y, const std::string &title, cons
std::ofstream tmp;
std::string name = create_tmpfile(tmp);
if (name == "")
if (name.empty())
return *this;
//
@ -875,7 +875,7 @@ Gnuplot &Gnuplot::plot_xy_err(const X &x,
std::ofstream tmp;
std::string name = create_tmpfile(tmp);
if (name == "")
if (name.empty())
return *this;
//
@ -904,14 +904,14 @@ Gnuplot &Gnuplot::plot_grid3d(const X &x,
const E &mag,
const std::string &title)
{
if (x.size() == 0 || y.size() == 0)
if (x.empty() || y.empty())
{
throw GnuplotException("std::vectors too small");
return *this;
}
std::ofstream tmp;
std::string name = create_tmpfile(tmp);
if (name == "")
if (name.empty())
return *this;
//
@ -937,7 +937,7 @@ Gnuplot &Gnuplot::plot_grid3d(const X &x,
cmdstr << " splot \"" << name << "\" u 1:2:3";
if (title == "")
if (title.empty())
cmdstr << " notitle with " << pstyle << " palette";
else
cmdstr << " title \"" << title << "\" with " << pstyle << " palette";
@ -961,7 +961,7 @@ Gnuplot &Gnuplot::plot_xyz(const X &x,
const Z &z,
const std::string &title)
{
if (x.size() == 0 || y.size() == 0 || z.size() == 0)
if (x.empty() || y.empty() || z.empty())
{
throw GnuplotException("std::vectors too small");
return *this;
@ -975,7 +975,7 @@ Gnuplot &Gnuplot::plot_xyz(const X &x,
std::ofstream tmp;
std::string name = create_tmpfile(tmp);
if (name == "")
if (name.empty())
return *this;
//
@ -1507,7 +1507,7 @@ Gnuplot &Gnuplot::plot_slope(const double a,
cmdstr << a << " * x + " << b << " title \"";
if (title == "")
if (title.empty())
cmdstr << "f(x) = " << a << " * x + " << b;
else
cmdstr << title;
@ -1541,7 +1541,7 @@ Gnuplot &Gnuplot::plot_equation(const std::string &equation,
cmdstr << equation << " title \"";
if (title == "")
if (title.empty())
cmdstr << "f(x) = " << equation;
else
cmdstr << title;
@ -1575,7 +1575,7 @@ Gnuplot &Gnuplot::plot_equation3d(const std::string &equation,
cmdstr << equation << " title \"";
if (title == "")
if (title.empty())
cmdstr << "f(x,y) = " << equation;
else
cmdstr << title;
@ -1615,12 +1615,12 @@ Gnuplot &Gnuplot::plotfile_x(const std::string &filename,
cmdstr << "\"" << filename << "\" using " << column;
if (title == "")
if (title.empty())
cmdstr << " notitle ";
else
cmdstr << " title \"" << title << "\" ";
if (smooth == "")
if (smooth.empty())
cmdstr << "with " << pstyle;
else
cmdstr << "smooth " << smooth;
@ -1660,12 +1660,12 @@ Gnuplot &Gnuplot::plotfile_xy(const std::string &filename,
cmdstr << "\"" << filename << "\" using " << column_x << ":" << column_y << " every " << std::to_string(decimate);
if (title == "")
if (title.empty())
cmdstr << " notitle ";
else
cmdstr << " title \"" << title << "\" ";
if (smooth == "")
if (smooth.empty())
cmdstr << "with " << pstyle;
else
cmdstr << "smooth " << smooth;
@ -1707,7 +1707,7 @@ Gnuplot &Gnuplot::plotfile_xy_err(const std::string &filename,
<< column_x << ":" << column_y << ":" << column_dy
<< " with errorbars ";
if (title == "")
if (title.empty())
cmdstr << " notitle ";
else
cmdstr << " title \"" << title << "\" ";
@ -1748,7 +1748,7 @@ Gnuplot &Gnuplot::plotfile_xyz(const std::string &filename,
cmdstr << "\"" << filename << "\" using " << column_x << ":" << column_y
<< ":" << column_z;
if (title == "")
if (title.empty())
cmdstr << " notitle with " << pstyle;
else
cmdstr << " title \"" << title << "\" with " << pstyle;
@ -1773,7 +1773,7 @@ Gnuplot &Gnuplot::plot_image(const unsigned char *ucPicBuf,
{
std::ofstream tmp;
std::string name = create_tmpfile(tmp);
if (name == "")
if (name.empty())
return *this;
//
@ -1801,7 +1801,7 @@ Gnuplot &Gnuplot::plot_image(const unsigned char *ucPicBuf,
else
cmdstr << "plot ";
if (title == "")
if (title.empty())
cmdstr << "\"" << name << "\" with image";
else
cmdstr << "\"" << name << "\" title \"" << title << "\" with image";
@ -1824,7 +1824,7 @@ Gnuplot &Gnuplot::plot_circle(double east, double north, double radius, const st
cmdstr << "set object circle at " + std::to_string(east) + "," + std::to_string(north) + " size " +
std::to_string(radius) + " back\n";
if (label != "")
if (!label.empty())
{
double east_label = (std::cos(M_PI / 3.0) * radius) * 1.1 + east;
double north_label = (std::sin(M_PI / 3.0) * radius) * 1.1 + north;
@ -2151,7 +2151,7 @@ std::string Gnuplot::create_tmpfile(std::ofstream &tmp)
void Gnuplot::remove_tmpfiles()
{
if ((tmpfile_list).size() > 0)
if (!(tmpfile_list).empty())
{
for (auto &i : tmpfile_list)
if (remove(i.c_str()) != 0)