2003-02-28 09:49:49 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file format.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Dekel Tsur
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-02-28 09:49:49 +00:00
|
|
|
*/
|
|
|
|
|
2003-08-23 00:17:00 +00:00
|
|
|
#ifndef FORMAT_H
|
|
|
|
#define FORMAT_H
|
2003-02-28 09:49:49 +00:00
|
|
|
|
|
|
|
|
2003-09-05 17:23:11 +00:00
|
|
|
#include "support/std_string.h"
|
2003-02-28 09:49:49 +00:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2003-05-23 13:54:09 +00:00
|
|
|
class Buffer;
|
|
|
|
|
2003-02-28 09:49:49 +00:00
|
|
|
class Format {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
Format(string const & n, string const & e, string const & p,
|
|
|
|
string const & s, string const & v);
|
|
|
|
///
|
|
|
|
bool dummy() const;
|
|
|
|
///
|
|
|
|
bool isChildFormat() const;
|
|
|
|
///
|
|
|
|
string const parentFormat() const;
|
|
|
|
///
|
|
|
|
string const & name() const {
|
|
|
|
return name_;
|
|
|
|
}
|
|
|
|
///
|
|
|
|
string const & extension() const {
|
|
|
|
return extension_;
|
|
|
|
}
|
|
|
|
///
|
|
|
|
string const & prettyname() const {
|
|
|
|
return prettyname_;
|
|
|
|
}
|
|
|
|
///
|
|
|
|
string const & shortcut() const {
|
|
|
|
return shortcut_;
|
|
|
|
}
|
|
|
|
///
|
|
|
|
string const & viewer() const {
|
|
|
|
return viewer_;
|
|
|
|
}
|
|
|
|
///
|
|
|
|
void setViewer(string const & v) {
|
|
|
|
viewer_ = v;
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
string name_;
|
|
|
|
///
|
|
|
|
string extension_;
|
|
|
|
///
|
|
|
|
string prettyname_;
|
|
|
|
///
|
|
|
|
string shortcut_;
|
|
|
|
///
|
|
|
|
string viewer_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
bool operator<(Format const & a, Format const & b);
|
|
|
|
|
|
|
|
///
|
|
|
|
class Formats {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
typedef std::vector<Format> FormatList;
|
|
|
|
///
|
|
|
|
typedef FormatList::const_iterator const_iterator;
|
|
|
|
///
|
|
|
|
Format const & get(FormatList::size_type i) const {
|
|
|
|
return formatlist[i];
|
|
|
|
}
|
|
|
|
///
|
|
|
|
Format const * getFormat(string const & name) const;
|
|
|
|
///
|
|
|
|
int getNumber(string const & name) const;
|
|
|
|
///
|
|
|
|
void add(string const & name);
|
|
|
|
///
|
|
|
|
void add(string const & name, string const & extension,
|
|
|
|
string const & prettyname, string const & shortcut);
|
|
|
|
///
|
|
|
|
void erase(string const & name);
|
|
|
|
///
|
|
|
|
void sort();
|
|
|
|
///
|
|
|
|
void setViewer(string const & name, string const & command);
|
|
|
|
///
|
2003-08-28 07:41:31 +00:00
|
|
|
bool view(Buffer const & buffer, string const & filename,
|
2003-02-28 09:49:49 +00:00
|
|
|
string const & format_name) const;
|
|
|
|
///
|
|
|
|
string const prettyName(string const & name) const;
|
|
|
|
///
|
|
|
|
string const extension(string const & name) const;
|
|
|
|
///
|
|
|
|
const_iterator begin() const {
|
|
|
|
return formatlist.begin();
|
|
|
|
}
|
|
|
|
///
|
|
|
|
const_iterator end() const {
|
|
|
|
return formatlist.end();
|
|
|
|
}
|
|
|
|
///
|
|
|
|
FormatList::size_type size() const {
|
|
|
|
return formatlist.size();
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
FormatList formatlist;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern Formats formats;
|
|
|
|
|
|
|
|
extern Formats system_formats;
|
|
|
|
|
|
|
|
#endif //FORMAT_H
|