]> git.lyx.org Git - lyx.git/blob - src/tabular_funcs.h
"Inter-word Space"
[lyx.git] / src / tabular_funcs.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  *
5  *           LyX, The Document Processor
6  *
7  *           Copyright 2000-2001 The LyX Team.
8  *
9  *           @author: Jürgen Vigna
10  *
11  * ======================================================
12  */
13
14 #ifndef TABULAR_FUNCS_H
15 #define TABULAR_FUNCS_H
16
17 #include "tabular.h"
18 #include "support/tostr.h"
19
20 #include <iosfwd>
21
22 // Perfect case for a template... (Lgb)
23 // or perhaps not...
24 template<class T>
25 string const write_attribute(string const & name, T const & t)
26 {
27         if (tostr(t).empty())
28                 return string();
29
30         string str = " " + name + "=\"" + tostr(t) + "\"";
31         return str;
32 }
33 template<>
34 string const write_attribute(string const & name, bool const & b);
35 template<>
36 string const write_attribute(string const & name, int const & b);
37 template<>
38 string const write_attribute(string const & name, LyXLength const & value);
39 string const tostr(LyXAlignment const & num);
40 string const tostr(LyXTabular::VAlignment const & num);
41 string const tostr(LyXTabular::BoxType const & num);
42
43 // I would have liked a fromstr template a lot better. (Lgb)
44 extern bool string2type(string const str, LyXAlignment & num);
45 extern bool string2type(string const str, LyXTabular::VAlignment & num);
46 extern bool string2type(string const str, LyXTabular::BoxType & num);
47 extern bool string2type(string const str, bool & num);
48 extern bool getTokenValue(string const & str, char const * token, string &ret);
49 extern bool getTokenValue(string const & str, char const * token, int & num);
50 extern bool getTokenValue(string const & str, char const * token,
51                           LyXAlignment & num);
52 extern bool getTokenValue(string const & str, char const * token,
53                           LyXTabular::VAlignment & num);
54 extern bool getTokenValue(string const & str, char const * token,
55                           LyXTabular::BoxType & num);
56 extern bool getTokenValue(string const & str, char const * token, bool & flag);
57 extern bool getTokenValue(string const & str, char const * token,
58                           LyXLength & len);
59 extern void l_getline(std::istream & is, string & str);
60
61 #endif