mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fixes to Format.{h,cpp} following advices from Richard and Vincent.
Caching the string value of extensions is not necessary. It was a nice textbook exercise in getter/setter methods but it is cause for confusion and prone to mistakes in maintenance. Also, extension_list_ doesn't need to be mutable. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39714 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c7bdd29088
commit
b31f0cfc4d
@ -93,7 +93,7 @@ bool operator<(Format const & a, Format const & b)
|
||||
Format::Format(string const & n, string const & e, string const & p,
|
||||
string const & s, string const & v, string const & ed,
|
||||
int flags)
|
||||
: name_(n), extensions_(e), prettyname_(p), shortcut_(s), viewer_(v),
|
||||
: name_(n), prettyname_(p), shortcut_(s), viewer_(v),
|
||||
editor_(ed), flags_(flags)
|
||||
{
|
||||
extension_list_ = getVectorFromString(e, ",");
|
||||
@ -107,6 +107,12 @@ bool Format::dummy() const
|
||||
}
|
||||
|
||||
|
||||
string const Format::extensions() const
|
||||
{
|
||||
return getStringFromVector(extension_list_, ", ");
|
||||
}
|
||||
|
||||
|
||||
bool Format::hasExtension(string const & e) const
|
||||
{
|
||||
return (find(extension_list_.begin(), extension_list_.end(), e)
|
||||
@ -130,7 +136,6 @@ string const Format::parentFormat() const
|
||||
|
||||
void Format::setExtensions(string const & e)
|
||||
{
|
||||
extensions_ = e;
|
||||
extension_list_ = getVectorFromString(e, ",");
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
return extension_list_.empty() ? empty_string() : extension_list_[0];
|
||||
}
|
||||
///
|
||||
std::string const & extensions() const { return extensions_; }
|
||||
std::string const extensions() const;
|
||||
///
|
||||
void setExtensions(std::string const & v);
|
||||
///
|
||||
@ -96,9 +96,7 @@ private:
|
||||
/// Internal name. Needs to be unique.
|
||||
std::string name_;
|
||||
/// Filename extensions, the first one being the default
|
||||
mutable std::vector<std::string> extension_list_;
|
||||
/// All filename extensions
|
||||
std::string extensions_;
|
||||
std::vector<std::string> extension_list_;
|
||||
/// Name presented to the user. Needs to be unique.
|
||||
std::string prettyname_;
|
||||
/// Keyboard shortcut for the View and Export menu.
|
||||
|
Loading…
Reference in New Issue
Block a user