X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FDimension.h;h=802b3bb5557345b6787be54f8e3c966ddc07222c;hb=6ec6db8cd9073bcb856e6a055d12ff95802e22be;hp=0607be6eba20e222f1eda6a18d43f4b34d5a13dc;hpb=f643ae700700cbd9aa0b1aca8155c6d7f2aee34d;p=lyx.git diff --git a/src/Dimension.h b/src/Dimension.h index 0607be6eba..802b3bb555 100644 --- a/src/Dimension.h +++ b/src/Dimension.h @@ -18,22 +18,18 @@ namespace lyx { class Dimension { public: /// constructor - Dimension() : wid(0), asc(0), des(0) {} + Dimension() = default; /// initialize data Dimension(int w, int a, int d) : wid(w), asc(a), des(d) {} + /// + Dimension & operator=(Dimension const & dim) = default; - Dimension & operator=(Dimension const & dim) { - wid = dim.wid; - asc = dim.asc; - des = dim.des; - return *this; - } /// glue horizontally void operator+=(Dimension const & dim); /// set to empty box void clear() { wid = asc = des = 0; } - /// check if box is empty - bool empty() const { return wid == 0 && asc == 0 && wid == 0; } + /// check whether box is empty + bool empty() const { return wid == 0 && asc == 0 && des == 0; } /// get height int height() const { return asc + des; } /// get ascent @@ -59,35 +55,33 @@ public: /// /// makes the code neither faster nor clearer /// width - int wid; + int wid = 0; /// ascent - int asc; + int asc = 0; /// descent - int des; + int des = 0; }; inline bool operator==(Dimension const & a, Dimension const & b) { - return a.wid == b.wid && a.asc == b.asc && a.des == b.des ; + return a.wid == b.wid && a.asc == b.asc && a.des == b.des; } inline bool operator!=(Dimension const & a, Dimension const & b) { - return a.wid != b.wid || a.asc != b.asc || a.des != b.des ; + return !(a == b); } class Point { public: - Point() - : x_(0), y_(0) - {} - + Point() = default; Point(int x, int y); - int x_, y_; + int x_ = 0; + int y_ = 0; }; } // namespace lyx