X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FSpacing.C;h=1bbb945f9f48e51ad0f743c3d2c349c9ca4f1f3b;hb=98c966c64594611e469313314abd1e59524adb4a;hp=61cf42bbcecc320dcab1feeaa958a914f2dfeaa0;hpb=94c15c0ed7ed8dadcabae6d9aa27a4683d5375a2;p=lyx.git diff --git a/src/Spacing.C b/src/Spacing.C index 61cf42bbce..1bbb945f9f 100644 --- a/src/Spacing.C +++ b/src/Spacing.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -21,15 +21,10 @@ using std::ios; using std::ostream; -/// how can I put this inside of Spacing (class) -namespace { - -char const * const spacing_string[] = {"single", "onehalf", "double", "other"}; - -} // namespace anon +string const Spacing::spacing_string[] + = {"single", "onehalf", "double", "other"}; - -float Spacing::getValue() const +float Spacing::getValue() const { switch (space) { case Default: // nothing special should happen with this... @@ -58,8 +53,8 @@ void Spacing::set(Spacing::Space sp, float val) void Spacing::set(Spacing::Space sp, string const & val) { - float fval; - istringstream istr(val); + float fval = 0.0; + istringstream istr(val.c_str()); istr >> fval; set(sp, fval); } @@ -68,9 +63,9 @@ void Spacing::set(Spacing::Space sp, string const & val) void Spacing::writeFile(ostream & os, bool para) const { if (space == Default) return; - + string cmd = para ? "\\paragraph_spacing " : "\\spacing "; - + if (getSpace() == Spacing::Other) { os.setf(ios::showpoint|ios::fixed); os.precision(2); @@ -78,7 +73,7 @@ void Spacing::writeFile(ostream & os, bool para) const << " " << getValue() << " \n"; } else { os << cmd << spacing_string[getSpace()] << " \n"; - } + } }