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, "
}
-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();
}
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