]> git.lyx.org Git - lyx.git/blob - src/Spacing.h
The std::string mammoth path.
[lyx.git] / src / Spacing.h
1 // -*- C++ -*-
2 /**
3  * \file Spacing.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef SPACING_H
13 #define SPACING_H
14
15 #include <iosfwd>
16
17
18 ///
19 class Spacing {
20 public:
21         ///
22         enum Space {
23                 ///
24                 Single,
25                 ///
26                 Onehalf,
27                 ///
28                 Double,
29                 ///
30                 Other,
31                 ///
32                 Default
33         };
34         ///
35         Spacing() : space(Default), value(1.0) {}
36         ///
37         Spacing(Spacing::Space sp, float val = 1.0) {
38                 set(sp, val);
39         }
40         Spacing(Spacing::Space sp, std::string const & val) {
41                 set(sp, val);
42         }
43         ///
44         bool isDefault() const {
45                 return space == Default;
46         }
47         ///
48         float getValue() const;
49         ///
50         Spacing::Space getSpace() const { return space; }
51         ///
52         void set(Spacing::Space sp, float val = 1.0);
53         ///
54         void set(Spacing::Space sp, std::string const & val) ;
55         ///
56         void writeFile(std::ostream &, bool para = false) const;
57         ///
58         std::string const writeEnvirBegin() const;
59         ///
60         std::string const writeEnvirEnd() const;
61
62 private:
63         ///
64         Space space;
65         ///
66         float value;
67         /// names of line spacing
68         static std::string const spacing_string[];
69 };
70
71
72 ///
73 inline
74 bool operator==(Spacing const & a, Spacing const & b)
75 {
76         return a.getSpace() == b.getSpace()
77                 && a.getValue() == b.getValue();
78 }
79
80 ///
81 inline
82 bool operator!=(Spacing const & a, Spacing const & b)
83 {
84         return !(a == b);
85 }
86 #endif