X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLength.cpp;h=0deed7481c915f3e2e70b6f2f100c80d7d993d64;hb=ecdeffb52b1dad2f56e0e4210d0a040e807e2caf;hp=f8eb920c0ff48e5b58bd0065d0aad38d00c9009a;hpb=5014b38cb7ca1967275050a90fcfe1aeade963e4;p=lyx.git diff --git a/src/Length.cpp b/src/Length.cpp index f8eb920c0f..0deed7481c 100644 --- a/src/Length.cpp +++ b/src/Length.cpp @@ -57,17 +57,11 @@ Length::Length(string const & data) } -void Length::swap(Length & rhs) -{ - std::swap(val_, rhs.val_); - std::swap(unit_, rhs.unit_); -} - - string const Length::asString() const { ostringstream os; - os << val_ << unit_name[unit_]; // setw? + if (unit_ != UNIT_NONE) + os << val_ << unit_name[unit_]; // setw? return os.str(); } @@ -75,7 +69,8 @@ string const Length::asString() const docstring const Length::asDocstring() const { odocstringstream os; - os << val_ << unit_name[unit_]; // setw? + if (unit_ != UNIT_NONE) + os << val_ << unit_name[unit_]; // setw? return os.str(); } @@ -102,6 +97,8 @@ string const Length::asLatexString() const case PPH: os << val_ / 100.0 << "\\paperheight"; break; + case UNIT_NONE: + break; default: os << val_ << unit_name[unit_]; break; @@ -363,6 +360,9 @@ GlueLength::GlueLength(string const & data) string const GlueLength::asString() const { + if (len_.empty()) + return string(); + ostringstream buffer; buffer << len_.value();