]> git.lyx.org Git - lyx.git/blob - src/support/types.h
split LyXText::rowlist_ into individual Paragraph::rows_ chunks
[lyx.git] / src / support / types.h
1 // -*- C++ -*-
2 /**
3  * \file types.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * Provide a set of typedefs for commonly used things like sizes and
8  * indices wile trying to stay compatible with types used
9  * by the standard containers.
10  *
11  * \author André Pönitz
12  *
13  * Full author contact details are available in file CREDITS
14  */
15
16 #ifndef LYX_TYPES_H
17 #define LYX_TYPES_H
18
19 // this probably could be improved by using <cstddef>...
20 #include <vector>
21
22 namespace lyx
23 {
24         /// a type for positions used in paragraphs
25         // needs to be signed for a while to hold the special value -1 that is
26         // used there...
27         typedef std::vector<char>::difference_type   pos_type;
28
29
30 // set this to '0' if you want to have really safe types
31 #if 1
32
33         /// a type for sizes
34         typedef std::vector<char>::size_type         size_type;
35
36         /// a type used for numbering text classes
37         // used to be LyXTextClassList::size_type
38         typedef std::vector<char>::size_type         textclass_type;
39
40 #else
41
42         // These structs wrap simple things to make them distinguishible
43         // to the compiler.
44         // It's a shame that different typedefs are not "really" different
45
46         struct size_type {
47                 ///
48                 typedef std::vector<char>::size_type  base_type;
49                 ///
50                 size_type(base_type t) { data_ = t; }
51                 ///
52                 operator base_type() const { return data_; }
53                 ///
54                 private:
55                 base_type data_;
56         };
57
58         struct textclass_type {
59                 ///
60                 typedef std::vector<char>::size_type  base_type;
61                 ///
62                 textclass_type(base_type t) { data_ = t; }
63                 ///
64                 operator base_type() const { return data_; }
65                 ///
66                 private:
67                 base_type data_;
68         };
69
70
71 #endif
72
73         ///
74         enum word_location {
75                 // the word around the cursor, only if the cursor is
76                 //not at a boundary
77                 WHOLE_WORD_STRICT,
78                 // the word around the cursor
79                 WHOLE_WORD,
80                 /// the word begining from the cursor position
81                 PARTIAL_WORD,
82                 /// the word around the cursor or before the cursor
83                 PREVIOUS_WORD,
84                 /// the next word (not yet used)
85                 NEXT_WORD
86         };
87
88 }
89
90 #endif // LYX_TYPES_H