2003-08-23 00:17:00 +00:00
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
* \file FloatList.cpp
|
2003-08-23 00:17:00 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2003-08-23 00:17:00 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2000-06-28 13:35:52 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "FloatList.h"
|
2003-09-04 03:54:04 +00:00
|
|
|
#include "Floating.h"
|
2000-06-28 13:35:52 +00:00
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2007-07-17 17:46:54 +00:00
|
|
|
namespace lyx {
|
2003-10-06 15:43:21 +00:00
|
|
|
|
2000-07-04 19:16:35 +00:00
|
|
|
FloatList::FloatList()
|
2008-03-07 03:42:39 +00:00
|
|
|
{}
|
2000-12-29 12:48:02 +00:00
|
|
|
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
FloatList::const_iterator FloatList::begin() const
|
2000-12-29 12:48:02 +00:00
|
|
|
{
|
|
|
|
return list.begin();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
FloatList::const_iterator FloatList::end() const
|
2000-12-29 12:48:02 +00:00
|
|
|
{
|
|
|
|
return list.end();
|
2000-07-04 19:16:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FloatList::newFloat(Floating const & fl)
|
|
|
|
{
|
2010-03-04 13:42:05 +00:00
|
|
|
list[fl.floattype()] = fl;
|
2000-07-04 19:16:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
string const FloatList::defaultPlacement(string const & t) const
|
2000-07-04 19:16:35 +00:00
|
|
|
{
|
|
|
|
List::const_iterator cit = list.find(t);
|
|
|
|
if (cit != list.end())
|
2001-07-12 11:11:10 +00:00
|
|
|
return cit->second.placement();
|
2000-07-04 19:16:35 +00:00
|
|
|
return string();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-22 08:37:14 +00:00
|
|
|
string const FloatList::allowedPlacement(string const & t) const
|
|
|
|
{
|
|
|
|
List::const_iterator cit = list.find(t);
|
|
|
|
if (cit != list.end())
|
|
|
|
return cit->second.allowedPlacement();
|
|
|
|
return string();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-15 23:51:46 +00:00
|
|
|
bool FloatList::typeExist(string const & t) const
|
|
|
|
{
|
|
|
|
List::const_iterator cit = list.find(t);
|
|
|
|
return cit != list.end();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-22 16:59:17 +00:00
|
|
|
bool FloatList::allowsWide(string const & t) const
|
|
|
|
{
|
|
|
|
List::const_iterator cit = list.find(t);
|
|
|
|
if (cit != list.end())
|
|
|
|
return cit->second.allowsWide();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool FloatList::allowsSideways(string const & t) const
|
|
|
|
{
|
|
|
|
List::const_iterator cit = list.find(t);
|
|
|
|
if (cit != list.end())
|
|
|
|
return cit->second.allowsSideways();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-15 23:51:46 +00:00
|
|
|
Floating const & FloatList::getType(string const & t) const
|
|
|
|
{
|
|
|
|
// I wish we could use exceptions
|
|
|
|
List::const_iterator cit = list.find(t);
|
|
|
|
if (cit != list.end())
|
2001-07-12 11:11:10 +00:00
|
|
|
return cit->second;
|
2000-07-15 23:51:46 +00:00
|
|
|
#ifdef HAVE_EXCEPTIONS
|
|
|
|
throw UnknownFloatType(t);
|
|
|
|
#else
|
2013-10-07 22:59:05 +00:00
|
|
|
static Floating const empty_float;
|
2000-07-15 23:51:46 +00:00
|
|
|
return empty_float;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2000-12-29 12:48:02 +00:00
|
|
|
|
2002-09-11 07:39:55 +00:00
|
|
|
void FloatList::erase(string const & t)
|
|
|
|
{
|
|
|
|
list.erase(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-12-29 12:48:02 +00:00
|
|
|
FloatList::const_iterator FloatList::operator[](string const & t) const
|
|
|
|
{
|
|
|
|
return list.find(t);
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|