6 using std::istringstream;
16 /// how can I put this inside of Spacing (class)
18 char const * spacing_string[] = {"single", "onehalf", "double", "other"};
21 float Spacing::getValue() const
24 case Single: return 1.0;
25 case Onehalf: return 1.25;
26 case Double: return 1.667;
27 case Other: return value;
33 void Spacing::set(Spacing::Space sp, float val)
37 switch(int(val * 1000 + 0.5)) {
38 case 1000: space = Single; break;
39 case 1250: space = Onehalf; break;
40 case 1667: space = Double; break;
41 default: value = val; break;
47 void Spacing::set(Spacing::Space sp, char const * val)
51 istringstream istr(val);
60 void Spacing::writeFile(ostream & os) const
62 if (getSpace() == Spacing::Other) {
63 os.setf(ios::showpoint|ios::fixed);
65 os << "\\spacing " << spacing_string[getSpace()]
66 << " " << getValue() << " \n";
68 os << "\\spacing " << spacing_string[getSpace()] << " \n";