4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
23 Format(std::string const & n, std::string const & e, std::string const & p,
24 std::string const & s, std::string const & v, std::string const & ed);
28 bool isChildFormat() const;
30 std::string const parentFormat() const;
32 std::string const & name() const {
36 std::string const & extension() const {
40 std::string const & prettyname() const {
44 std::string const & shortcut() const {
48 std::string const & viewer() const {
52 void setViewer(std::string const & v) {
56 std::string const & editor() const {
62 std::string extension_;
64 std::string prettyname_;
66 std::string shortcut_;
74 bool operator<(Format const & a, Format const & b);
80 typedef std::vector<Format> FormatList;
82 typedef FormatList::const_iterator const_iterator;
84 Format const & get(FormatList::size_type i) const {
87 /// \returns format named \p name if it exists, otherwise 0
88 Format const * getFormat(std::string const & name) const;
90 * Get the format of \p filename from file contents or, if this
91 * fails, from file extension.
92 * \returns file format if it could be found, otherwise an empty
95 std::string getFormatFromFile(std::string const & filename) const;
97 int getNumber(std::string const & name) const;
99 void add(std::string const & name);
101 void add(std::string const & name, std::string const & extension,
102 std::string const & prettyname, std::string const & shortcut,
103 std::string const & viewer, std::string const & editor);
105 void erase(std::string const & name);
109 void setViewer(std::string const & name, std::string const & command);
111 bool view(Buffer const & buffer, std::string const & filename,
112 std::string const & format_name) const;
114 bool edit(Buffer const & buffer, std::string const & filename,
115 std::string const & format_name) const;
117 std::string const prettyName(std::string const & name) const;
119 std::string const extension(std::string const & name) const;
121 const_iterator begin() const {
122 return formatlist.begin();
125 const_iterator end() const {
126 return formatlist.end();
129 FormatList::size_type size() const {
130 return formatlist.size();
134 FormatList formatlist;
137 extern Formats formats;
139 extern Formats system_formats;