6 using std::istringstream;
15 /// how can I put this inside of Spacing (class)
17 char const * spacing_string[] = {"single", "onehalf", "double", "other"};
20 float Spacing::getValue() const
23 case Single: return 1.0;
24 case Onehalf: return 1.25;
25 case Double: return 1.667;
26 case Other: return value;
32 void Spacing::set(Spacing::Space sp, float val)
36 switch(int(val * 1000 + 0.5)) {
37 case 1000: space = Single; break;
38 case 1250: space = Onehalf; break;
39 case 1667: space = Double; break;
40 default: value = val; break;
46 void Spacing::set(Spacing::Space sp, char const * val)
50 istringstream istr(val);
59 void Spacing::writeFile(ostream & os) const
61 if (getSpace() == Spacing::Other) {
62 os.setf(ios::showpoint|ios::fixed);
64 os << "\\spacing " << spacing_string[getSpace()]
65 << " " << getValue() << " \n";
67 os << "\\spacing " << spacing_string[getSpace()] << " \n";