4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
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.
11 * \author André Pönitz
13 * Full author contact details are available in file CREDITS.
19 #include <boost/cstdint.hpp>
25 /// The type used to hold characters in paragraphs
27 // Prefer this if possible because GNU libstdc++ has usable
28 // std::ctype<wchar_t> locale facets but not
29 // std::ctype<boost::uint32_t>. gcc older than 3.4 is also missing
30 // usable std::char_traits<boost::uint32_t>.
31 typedef wchar_t char_type;
33 typedef boost::uint32_t char_type;
36 /// a type for positions used in paragraphs
37 // needs to be signed for a while to hold the special value -1 that is
39 typedef ptrdiff_t pos_type;
41 /// a type for paragraph offsets
42 // FIXME: should be unsigned as well.
43 // however, simply changing it breaks a downward loop somewhere...
44 typedef ptrdiff_t pit_type;
46 /// a type for the nesting depth of a paragraph
47 typedef size_t depth_type;
49 // set this to '0' if you want to have really safe types
53 typedef size_t size_type;
55 /// a type used for numbering text classes
56 typedef size_t textclass_type;
60 // These structs wrap simple things to make them distinguishible
62 // It's a shame that different typedefs are not "really" different
66 typedef size_t base_type;
68 size_type(base_type t) { data_ = t; }
70 operator base_type() const { return data_; }
76 struct textclass_type {
78 typedef size_t base_type;
80 textclass_type(base_type t) { data_ = t; }
82 operator base_type() const { return data_; }
93 // the word around the cursor, only if the cursor is
96 // the word around the cursor
98 /// the word begining from the cursor position
100 /// the word around the cursor or before the cursor
102 /// the next word (not yet used)
108 #endif // LYX_TYPES_H