- 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::erase(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);
-}
-
-
-void Formats::sort()
-{
- std::sort(formatlist.begin(), formatlist.end());
-}
-
-
-void Formats::setViewer(string const & name, string const & command)
-{
- add(name);
- FormatList::iterator it =
- find_if(formatlist.begin(), formatlist.end(),
- lyx::compare_memfun(&Format::name, name));
- if (it != formatlist.end())
- it->setViewer(command);
-}
-
-
-bool Formats::view(Buffer const * buffer, string const & filename,
- string const & format_name) const
-{
- if (filename.empty())
- return false;