33 switch (justification) {
46 switch (justification_) {
48 return NearlyEqual(lmargin + lindent, margin_ + first_indent_, tolerance_);
50 return NearlyEqual(rmargin + rindent, margin_ + first_indent_, tolerance_);
52 return NearlyEqual(lindent, rindent, tolerance_ * 2);
60 switch (justification_) {
62 return NearlyEqual(lmargin + lindent, margin_ + body_indent_, tolerance_);
64 return NearlyEqual(rmargin + rindent, margin_ + body_indent_, tolerance_);
66 return NearlyEqual(lindent, rindent, tolerance_ * 2);
74 if (justification_ != other.justification_) {
80 int tolerance = (tolerance_ + other.tolerance_) / 4;
87 const char *alignment = ParagraphJustificationToString(justification_);
88 snprintf(buffer,
sizeof(buffer),
"margin: %d, first_indent: %d, body_indent: %d, alignment: %s",
89 margin_, first_indent_, body_indent_, alignment);
90 return std::string(buffer);
bool NearlyEqual(T x, T y, T tolerance)
bool Comparable(const ParagraphModel &other) const
bool ValidFirstLine(int lmargin, int lindent, int rindent, int rmargin) const
std::string ToString() const
bool ValidBodyLine(int lmargin, int lindent, int rindent, int rmargin) const