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 {
60 void setEditor(std::string const & v) {
66 std::string extension_;
68 std::string prettyname_;
70 std::string shortcut_;
78 bool operator<(Format const & a, Format const & b);
84 typedef std::vector<Format> FormatList;
86 typedef FormatList::const_iterator const_iterator;
88 Format const & get(FormatList::size_type i) const {
91 /// \returns format named \p name if it exists, otherwise 0
92 Format const * getFormat(std::string const & name) const;
94 * Get the format of \p filename from file contents or, if this
95 * fails, from file extension.
96 * \returns file format if it could be found, otherwise an empty
99 std::string getFormatFromFile(std::string const & filename) const;
100 /// Set editor and/or viewer to "auto" for formats that can be
101 /// opened by the OS.
104 int getNumber(std::string const & name) const;
106 void add(std::string const & name);
108 void add(std::string const & name, std::string const & extension,
109 std::string const & prettyname, std::string const & shortcut,
110 std::string const & viewer, std::string const & editor);
112 void erase(std::string const & name);
116 void setViewer(std::string const & name, std::string const & command);
118 bool view(Buffer const & buffer, std::string const & filename,
119 std::string const & format_name) const;
121 bool edit(Buffer const & buffer, std::string const & filename,
122 std::string const & format_name) const;
124 std::string const prettyName(std::string const & name) const;
126 std::string const extension(std::string const & name) const;
128 const_iterator begin() const {
129 return formatlist.begin();
132 const_iterator end() const {
133 return formatlist.end();
136 FormatList::size_type size() const {
137 return formatlist.size();
141 FormatList formatlist;
144 extern Formats formats;
146 extern Formats system_formats;