-} // namespace anon
-
-//////////////////////////////////////////////////////////////////////////////
-
-bool Format::dummy() const
-{
- return extension().empty();
-}
-
-
-bool Format::IsChildFormat() const
-{
- if (name_.empty())
- return false;
- return isdigit(name_[name_.length() - 1]);
-}
-
-
-string const Format::ParentFormat() const
-{
- return name_.substr(0, name_.length() - 1);
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-// This method should return a reference, and throw an exception
-// if the format named name cannot be found (Lgb)
-Format const * Formats::GetFormat(string const & name) const
-{
- FormatList::const_iterator cit =
- find_if(formatlist.begin(), formatlist.end(),
- lyx::compare_memfun(&Format::name, name));
- if (cit != formatlist.end())
- return &(*cit);
- else
- return 0;
-}
-
-
-int Formats::GetNumber(string const & name) const
-{
- FormatList::const_iterator cit =
- find_if(formatlist.begin(), formatlist.end(),
- lyx::compare_memfun(&Format::name, name));
- if (cit != formatlist.end())
- return cit - formatlist.begin();
- else
- return -1;
-}
-
-
-void Formats::Add(string const & name)
-{
- if (!GetFormat(name))
- Add(name, name, name, string());
-}
-
-
-void Formats::Add(string const & name, string const & extension,
- string const & prettyname, string const & shortcut)
-{
- FormatList::iterator it =
- find_if(formatlist.begin(), formatlist.end(),
- lyx::compare_memfun(&Format::name, name));
- if (it == formatlist.end())
- formatlist.push_back(Format(name, extension, prettyname,
- shortcut, ""));
- else {
- string viewer = it->viewer();
- *it = Format(name, extension, prettyname, shortcut, viewer);
- }
-}
-
-
-void Formats::Delete(string const & name)
-{
- FormatList::iterator it =
- find_if(formatlist.begin(), formatlist.end(),
- lyx::compare_memfun(&Format::name, name));
- if (it != formatlist.end())
- formatlist.erase(it);
-}
-