]> git.lyx.org Git - lyx.git/blob - src/lyxgluelength.h
fix a compiler warning regarding unused variable
[lyx.git] / src / lyxgluelength.h
1 // -*- C++ -*-
2 /**
3  * \file lyxgluelength.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  * \author Matthias Ettrich
9  * \author Jean-Marc Lasgouttes
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef LYX_GLUE_LENGTH_H
15 #define LYX_GLUE_LENGTH_H
16
17 #include "lyxlength.h"
18
19
20 namespace lyx {
21
22
23 class LyXGlueLength {
24 public:
25         ///
26         LyXGlueLength() {}
27         ///
28         explicit LyXGlueLength(LyXLength const & len);
29         ///
30         LyXGlueLength(LyXLength const & len,
31                       LyXLength const & plus,
32                       LyXLength const & minus);
33
34         /** "data" must be a decimal number, followed by a unit, and
35           optional "glue" indicated by "+" and "-".  You may abbreviate
36           reasonably.  Examples:
37           1.2 cm  //  4mm +2pt  //  2cm -4mm +2mm  //  4+0.1-0.2cm
38           The traditional Latex format is also accepted, like
39           4cm plus 10pt minus 10pt */
40         explicit LyXGlueLength(std::string const & data);
41
42         ///
43         LyXLength const & len() const;
44         ///
45         LyXLength const & plus() const;
46         ///
47         LyXLength const & minus() const;
48
49
50         /// conversion
51         std::string const asString() const;
52         ///
53         std::string const asLatexString() const;
54
55         friend bool isValidGlueLength(std::string const & data,
56                                       LyXGlueLength* result);
57
58 private:
59         /// the normal vlaue
60         LyXLength len_;
61         /// extra stretch
62         LyXLength plus_;
63         /// extra shrink
64         LyXLength minus_;
65 };
66
67 ///
68 bool operator==(LyXGlueLength const & l1, LyXGlueLength const & l2);
69 ///
70 bool operator!=(LyXGlueLength const & l1, LyXGlueLength const & l2);
71 /** If "data" is valid, the length represented by it is
72     stored into "result", if that is not 0. */
73 bool isValidGlueLength(std::string const & data, LyXGlueLength * result = 0);
74
75
76 } // namespace lyx
77
78 #endif // LYXGLUELENGTH_H