X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fformat.h;h=240d5d8a4cc9acbb932a822dca0f803ab822eeab;hb=35204f8f33d7400a5fefeffea533fb4cb4097211;hp=1b025a60e8281d68dbfaf9e2c3c51954607534db;hpb=5b83287abe01f137a737350abece586c4c81c04b;p=lyx.git diff --git a/src/format.h b/src/format.h index 1b025a60e8..240d5d8a4c 100644 --- a/src/format.h +++ b/src/format.h @@ -12,17 +12,32 @@ #ifndef FORMAT_H #define FORMAT_H +#include "support/docstring.h" + #include #include + +namespace lyx { + class Buffer; class Format { public: + /// Flags for some format properties + enum Flags { + none = 0, + /// Set if this format is a document format (as opposed to + /// e.g. image formats). + /// Some formats are both (e.g. pdf), they have this flag set. + document = 1, + /// Set if this format can contain vector graphics. + vector = 2, + }; /// Format(std::string const & n, std::string const & e, std::string const & p, std::string const & s, std::string const & v, std::string const & ed, - bool ex); + int); /// bool dummy() const; /// Tell whether this format is a child format. @@ -64,7 +79,11 @@ public: } /// bool documentFormat() const { - return document_; + return flags_ & document; + } + /// + bool vectorFormat() const { + return flags_ & vector; } private: /// Internal name. Needs to be unique. @@ -85,14 +104,14 @@ private: std::string viewer_; /// Editor for this format. \sa viewer_. std::string editor_; - /// Is this format a document format? (as opposed to e.g. image formats) - /// Some formats are both (e.g. pdf), they have this flag set. - bool document_; + /// + int flags_; }; bool operator<(Format const & a, Format const & b); + /// class Formats { public: @@ -124,7 +143,7 @@ public: void add(std::string const & name, std::string const & extension, std::string const & prettyname, std::string const & shortcut, std::string const & viewer, std::string const & editor, - bool document); + int flags); /// void erase(std::string const & name); /// @@ -138,21 +157,15 @@ public: bool edit(Buffer const & buffer, std::string const & filename, std::string const & format_name) const; /// - std::string const prettyName(std::string const & name) const; + docstring const prettyName(std::string const & name) const; /// std::string const extension(std::string const & name) const; /// - const_iterator begin() const { - return formatlist.begin(); - } + const_iterator begin() const { return formatlist.begin(); } /// - const_iterator end() const { - return formatlist.end(); - } + const_iterator end() const { return formatlist.end(); } /// - FormatList::size_type size() const { - return formatlist.size(); - } + FormatList::size_type size() const { return formatlist.size(); } private: /// FormatList formatlist; @@ -162,4 +175,7 @@ extern Formats formats; extern Formats system_formats; + +} // namespace lyx + #endif //FORMAT_H