mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Improve these.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24038 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
eae4e41141
commit
f4c88d4f34
@ -494,8 +494,8 @@ void EmbeddedFileList::registerFile(EmbeddedFile const & file,
|
||||
BOOST_ASSERT(!buffer.embedded() || file.enabled());
|
||||
|
||||
string newfile = file.absFilename();
|
||||
EmbeddedFile * efp = findFile(newfile);
|
||||
if (efp) {
|
||||
iterator efp = findFile(newfile);
|
||||
if (efp != end()) {
|
||||
if (efp->embedded() != file.embedded()) {
|
||||
Alert::error(_("Wrong embedding status."),
|
||||
bformat(_("File %1$s is included in more than one insets, "
|
||||
@ -514,27 +514,29 @@ void EmbeddedFileList::registerFile(EmbeddedFile const & file,
|
||||
}
|
||||
|
||||
|
||||
EmbeddedFile const * EmbeddedFileList::findFile(std::string const & filename) const
|
||||
EmbeddedFileList::const_iterator
|
||||
EmbeddedFileList::findFile(std::string const & filename) const
|
||||
{
|
||||
// try to find this file from the list
|
||||
std::vector<EmbeddedFile>::const_iterator it = begin();
|
||||
std::vector<EmbeddedFile>::const_iterator it_end = end();
|
||||
for (; it != it_end; ++it)
|
||||
if (it->absFilename() == filename)
|
||||
return &*it;
|
||||
return 0;
|
||||
return it;
|
||||
return end();
|
||||
}
|
||||
|
||||
|
||||
EmbeddedFile * EmbeddedFileList::findFile(std::string const & filename)
|
||||
EmbeddedFileList::iterator
|
||||
EmbeddedFileList::findFile(std::string const & filename)
|
||||
{
|
||||
// try to find this file from the list
|
||||
std::vector<EmbeddedFile>::iterator it = begin();
|
||||
std::vector<EmbeddedFile>::iterator it_end = end();
|
||||
for (; it != it_end; ++it)
|
||||
if (it->absFilename() == filename)
|
||||
return &*it;
|
||||
return 0;
|
||||
return it;
|
||||
return end();
|
||||
}
|
||||
|
||||
|
||||
|
@ -211,8 +211,8 @@ public:
|
||||
Buffer const & buffer);
|
||||
/// returns a pointer to the Embedded file representing this object,
|
||||
/// or null if not found. The filename should be absolute.
|
||||
EmbeddedFile const * findFile(std::string const & filename) const;
|
||||
EmbeddedFile * findFile(std::string const & filename);
|
||||
const_iterator findFile(std::string const & filename) const;
|
||||
iterator findFile(std::string const & filename);
|
||||
/// validate embedded fies after a file is read.
|
||||
void validate(Buffer const & buffer);
|
||||
/// scan the buffer and get a list of EmbeddedFile
|
||||
|
Loading…
Reference in New Issue
Block a user