2001-12-20 14:52:15 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/* This file is part of
|
2002-03-21 17:27:08 +00:00
|
|
|
|
* ======================================================
|
|
|
|
|
*
|
2001-12-20 14:52:15 +00:00
|
|
|
|
* LyX, The Document Processor
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2001-12-20 14:52:15 +00:00
|
|
|
|
* Copyright 2000-2001 The LyX Team.
|
|
|
|
|
*
|
|
|
|
|
* @author: J<EFBFBD>rgen Vigna
|
|
|
|
|
*
|
2002-03-21 17:27:08 +00:00
|
|
|
|
* ======================================================
|
2001-12-20 14:52:15 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef TABULAR_FUNCS_H
|
|
|
|
|
#define TABULAR_FUNCS_H
|
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma interface
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "LString.h"
|
|
|
|
|
#include "tabular.h"
|
2002-06-10 07:57:39 +00:00
|
|
|
|
#include "support/lstrings.h" // for tostr
|
2001-12-20 14:52:15 +00:00
|
|
|
|
|
2001-12-20 17:23:17 +00:00
|
|
|
|
#include <iosfwd>
|
2001-12-20 14:52:15 +00:00
|
|
|
|
|
|
|
|
|
// Perfect case for a template... (Lgb)
|
|
|
|
|
// or perhaps not...
|
|
|
|
|
template<class T>
|
2001-12-20 17:23:17 +00:00
|
|
|
|
string const write_attribute(string const & name, T const & t)
|
|
|
|
|
{
|
2002-02-26 08:24:48 +00:00
|
|
|
|
if (tostr(t).empty())
|
|
|
|
|
return string();
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2001-12-20 17:23:17 +00:00
|
|
|
|
string str = " " + name + "=\"" + tostr(t) + "\"";
|
|
|
|
|
return str;
|
|
|
|
|
}
|
2001-12-20 14:52:15 +00:00
|
|
|
|
template<>
|
|
|
|
|
string const write_attribute(string const & name, bool const & b);
|
|
|
|
|
template<>
|
2002-02-26 08:24:48 +00:00
|
|
|
|
string const write_attribute(string const & name, int const & b);
|
|
|
|
|
template<>
|
2001-12-20 14:52:15 +00:00
|
|
|
|
string const write_attribute(string const & name, LyXLength const & value);
|
|
|
|
|
string const tostr(LyXAlignment const & num);
|
|
|
|
|
string const tostr(LyXTabular::VAlignment const & num);
|
|
|
|
|
string const tostr(LyXTabular::BoxType const & num);
|
|
|
|
|
|
|
|
|
|
// I would have liked a fromstr template a lot better. (Lgb)
|
|
|
|
|
extern bool string2type(string const str, LyXAlignment & num);
|
|
|
|
|
extern bool string2type(string const str, LyXTabular::VAlignment & num);
|
|
|
|
|
extern bool string2type(string const str, LyXTabular::BoxType & num);
|
|
|
|
|
extern bool string2type(string const str, bool & num);
|
2001-12-20 17:23:17 +00:00
|
|
|
|
extern bool getTokenValue(string const & str, char const * token, string &ret);
|
|
|
|
|
extern bool getTokenValue(string const & str, char const * token, int & num);
|
|
|
|
|
extern bool getTokenValue(string const & str, char const * token,
|
2002-03-21 17:27:08 +00:00
|
|
|
|
LyXAlignment & num);
|
2001-12-20 17:23:17 +00:00
|
|
|
|
extern bool getTokenValue(string const & str, char const * token,
|
2002-03-21 17:27:08 +00:00
|
|
|
|
LyXTabular::VAlignment & num);
|
2001-12-20 17:23:17 +00:00
|
|
|
|
extern bool getTokenValue(string const & str, char const * token,
|
2002-03-21 17:27:08 +00:00
|
|
|
|
LyXTabular::BoxType & num);
|
2001-12-20 17:23:17 +00:00
|
|
|
|
extern bool getTokenValue(string const & str, char const * token, bool & flag);
|
|
|
|
|
extern bool getTokenValue(string const & str, char const * token,
|
2002-03-21 17:27:08 +00:00
|
|
|
|
LyXLength & len);
|
2001-12-20 17:23:17 +00:00
|
|
|
|
extern void l_getline(std::istream & is, string & str);
|
2001-12-20 14:52:15 +00:00
|
|
|
|
|
|
|
|
|
#endif
|