mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-02-01 11:49:16 +00:00
clang-tidy: apply readability-container-size-empty check
This commit is contained in:
parent
16bd8aa983
commit
298a9c2391
@ -786,7 +786,7 @@ inline Gnuplot::Gnuplot(const std::vector<double> &x,
|
|||||||
template <typename X>
|
template <typename X>
|
||||||
Gnuplot &Gnuplot::plot_x(const X &x, const std::string &title)
|
Gnuplot &Gnuplot::plot_x(const X &x, const std::string &title)
|
||||||
{
|
{
|
||||||
if (x.size() == 0)
|
if (x.empty())
|
||||||
{
|
{
|
||||||
throw GnuplotException("std::vector too small");
|
throw GnuplotException("std::vector too small");
|
||||||
return *this;
|
return *this;
|
||||||
@ -794,7 +794,7 @@ Gnuplot &Gnuplot::plot_x(const X &x, const std::string &title)
|
|||||||
|
|
||||||
std::ofstream tmp;
|
std::ofstream tmp;
|
||||||
std::string name = create_tmpfile(tmp);
|
std::string name = create_tmpfile(tmp);
|
||||||
if (name == "")
|
if (name.empty())
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -819,7 +819,7 @@ Gnuplot &Gnuplot::plot_x(const X &x, const std::string &title)
|
|||||||
template <typename X, typename Y>
|
template <typename X, typename Y>
|
||||||
Gnuplot &Gnuplot::plot_xy(const X &x, const Y &y, const std::string &title, const unsigned int decimate)
|
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");
|
throw GnuplotException("std::vectors too small");
|
||||||
return *this;
|
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::ofstream tmp;
|
||||||
std::string name = create_tmpfile(tmp);
|
std::string name = create_tmpfile(tmp);
|
||||||
if (name == "")
|
if (name.empty())
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -875,7 +875,7 @@ Gnuplot &Gnuplot::plot_xy_err(const X &x,
|
|||||||
|
|
||||||
std::ofstream tmp;
|
std::ofstream tmp;
|
||||||
std::string name = create_tmpfile(tmp);
|
std::string name = create_tmpfile(tmp);
|
||||||
if (name == "")
|
if (name.empty())
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -904,14 +904,14 @@ Gnuplot &Gnuplot::plot_grid3d(const X &x,
|
|||||||
const E &mag,
|
const E &mag,
|
||||||
const std::string &title)
|
const std::string &title)
|
||||||
{
|
{
|
||||||
if (x.size() == 0 || y.size() == 0)
|
if (x.empty() || y.empty())
|
||||||
{
|
{
|
||||||
throw GnuplotException("std::vectors too small");
|
throw GnuplotException("std::vectors too small");
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
std::ofstream tmp;
|
std::ofstream tmp;
|
||||||
std::string name = create_tmpfile(tmp);
|
std::string name = create_tmpfile(tmp);
|
||||||
if (name == "")
|
if (name.empty())
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -937,7 +937,7 @@ Gnuplot &Gnuplot::plot_grid3d(const X &x,
|
|||||||
|
|
||||||
cmdstr << " splot \"" << name << "\" u 1:2:3";
|
cmdstr << " splot \"" << name << "\" u 1:2:3";
|
||||||
|
|
||||||
if (title == "")
|
if (title.empty())
|
||||||
cmdstr << " notitle with " << pstyle << " palette";
|
cmdstr << " notitle with " << pstyle << " palette";
|
||||||
else
|
else
|
||||||
cmdstr << " title \"" << title << "\" with " << pstyle << " palette";
|
cmdstr << " title \"" << title << "\" with " << pstyle << " palette";
|
||||||
@ -961,7 +961,7 @@ Gnuplot &Gnuplot::plot_xyz(const X &x,
|
|||||||
const Z &z,
|
const Z &z,
|
||||||
const std::string &title)
|
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");
|
throw GnuplotException("std::vectors too small");
|
||||||
return *this;
|
return *this;
|
||||||
@ -975,7 +975,7 @@ Gnuplot &Gnuplot::plot_xyz(const X &x,
|
|||||||
|
|
||||||
std::ofstream tmp;
|
std::ofstream tmp;
|
||||||
std::string name = create_tmpfile(tmp);
|
std::string name = create_tmpfile(tmp);
|
||||||
if (name == "")
|
if (name.empty())
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1507,7 +1507,7 @@ Gnuplot &Gnuplot::plot_slope(const double a,
|
|||||||
|
|
||||||
cmdstr << a << " * x + " << b << " title \"";
|
cmdstr << a << " * x + " << b << " title \"";
|
||||||
|
|
||||||
if (title == "")
|
if (title.empty())
|
||||||
cmdstr << "f(x) = " << a << " * x + " << b;
|
cmdstr << "f(x) = " << a << " * x + " << b;
|
||||||
else
|
else
|
||||||
cmdstr << title;
|
cmdstr << title;
|
||||||
@ -1541,7 +1541,7 @@ Gnuplot &Gnuplot::plot_equation(const std::string &equation,
|
|||||||
|
|
||||||
cmdstr << equation << " title \"";
|
cmdstr << equation << " title \"";
|
||||||
|
|
||||||
if (title == "")
|
if (title.empty())
|
||||||
cmdstr << "f(x) = " << equation;
|
cmdstr << "f(x) = " << equation;
|
||||||
else
|
else
|
||||||
cmdstr << title;
|
cmdstr << title;
|
||||||
@ -1575,7 +1575,7 @@ Gnuplot &Gnuplot::plot_equation3d(const std::string &equation,
|
|||||||
|
|
||||||
cmdstr << equation << " title \"";
|
cmdstr << equation << " title \"";
|
||||||
|
|
||||||
if (title == "")
|
if (title.empty())
|
||||||
cmdstr << "f(x,y) = " << equation;
|
cmdstr << "f(x,y) = " << equation;
|
||||||
else
|
else
|
||||||
cmdstr << title;
|
cmdstr << title;
|
||||||
@ -1615,12 +1615,12 @@ Gnuplot &Gnuplot::plotfile_x(const std::string &filename,
|
|||||||
|
|
||||||
cmdstr << "\"" << filename << "\" using " << column;
|
cmdstr << "\"" << filename << "\" using " << column;
|
||||||
|
|
||||||
if (title == "")
|
if (title.empty())
|
||||||
cmdstr << " notitle ";
|
cmdstr << " notitle ";
|
||||||
else
|
else
|
||||||
cmdstr << " title \"" << title << "\" ";
|
cmdstr << " title \"" << title << "\" ";
|
||||||
|
|
||||||
if (smooth == "")
|
if (smooth.empty())
|
||||||
cmdstr << "with " << pstyle;
|
cmdstr << "with " << pstyle;
|
||||||
else
|
else
|
||||||
cmdstr << "smooth " << smooth;
|
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);
|
cmdstr << "\"" << filename << "\" using " << column_x << ":" << column_y << " every " << std::to_string(decimate);
|
||||||
|
|
||||||
if (title == "")
|
if (title.empty())
|
||||||
cmdstr << " notitle ";
|
cmdstr << " notitle ";
|
||||||
else
|
else
|
||||||
cmdstr << " title \"" << title << "\" ";
|
cmdstr << " title \"" << title << "\" ";
|
||||||
|
|
||||||
if (smooth == "")
|
if (smooth.empty())
|
||||||
cmdstr << "with " << pstyle;
|
cmdstr << "with " << pstyle;
|
||||||
else
|
else
|
||||||
cmdstr << "smooth " << smooth;
|
cmdstr << "smooth " << smooth;
|
||||||
@ -1707,7 +1707,7 @@ Gnuplot &Gnuplot::plotfile_xy_err(const std::string &filename,
|
|||||||
<< column_x << ":" << column_y << ":" << column_dy
|
<< column_x << ":" << column_y << ":" << column_dy
|
||||||
<< " with errorbars ";
|
<< " with errorbars ";
|
||||||
|
|
||||||
if (title == "")
|
if (title.empty())
|
||||||
cmdstr << " notitle ";
|
cmdstr << " notitle ";
|
||||||
else
|
else
|
||||||
cmdstr << " title \"" << title << "\" ";
|
cmdstr << " title \"" << title << "\" ";
|
||||||
@ -1748,7 +1748,7 @@ Gnuplot &Gnuplot::plotfile_xyz(const std::string &filename,
|
|||||||
cmdstr << "\"" << filename << "\" using " << column_x << ":" << column_y
|
cmdstr << "\"" << filename << "\" using " << column_x << ":" << column_y
|
||||||
<< ":" << column_z;
|
<< ":" << column_z;
|
||||||
|
|
||||||
if (title == "")
|
if (title.empty())
|
||||||
cmdstr << " notitle with " << pstyle;
|
cmdstr << " notitle with " << pstyle;
|
||||||
else
|
else
|
||||||
cmdstr << " title \"" << title << "\" with " << pstyle;
|
cmdstr << " title \"" << title << "\" with " << pstyle;
|
||||||
@ -1773,7 +1773,7 @@ Gnuplot &Gnuplot::plot_image(const unsigned char *ucPicBuf,
|
|||||||
{
|
{
|
||||||
std::ofstream tmp;
|
std::ofstream tmp;
|
||||||
std::string name = create_tmpfile(tmp);
|
std::string name = create_tmpfile(tmp);
|
||||||
if (name == "")
|
if (name.empty())
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1801,7 +1801,7 @@ Gnuplot &Gnuplot::plot_image(const unsigned char *ucPicBuf,
|
|||||||
else
|
else
|
||||||
cmdstr << "plot ";
|
cmdstr << "plot ";
|
||||||
|
|
||||||
if (title == "")
|
if (title.empty())
|
||||||
cmdstr << "\"" << name << "\" with image";
|
cmdstr << "\"" << name << "\" with image";
|
||||||
else
|
else
|
||||||
cmdstr << "\"" << name << "\" title \"" << title << "\" with image";
|
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 " +
|
cmdstr << "set object circle at " + std::to_string(east) + "," + std::to_string(north) + " size " +
|
||||||
std::to_string(radius) + " back\n";
|
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 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;
|
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()
|
void Gnuplot::remove_tmpfiles()
|
||||||
{
|
{
|
||||||
if ((tmpfile_list).size() > 0)
|
if (!(tmpfile_list).empty())
|
||||||
{
|
{
|
||||||
for (auto &i : tmpfile_list)
|
for (auto &i : tmpfile_list)
|
||||||
if (remove(i.c_str()) != 0)
|
if (remove(i.c_str()) != 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user