Buffer::Buffer(string const & file, bool ronly)
: niceFile(true), lyx_clean(true), bak_clean(true),
- unnamed(false), dep_clean(0), read_only(ronly),
+ unnamed(false), read_only(ronly),
filename_(file), users(0)
{
lyxerr[Debug::INFO] << "Buffer::Buffer()" << endl;
// changed to be public and have one parameter
// if par = 0 normal behavior
// else insert behavior
-// Returns false if "\the_end" is not read for formats >= 2.13. (Asger)
+// Returns false if "\the_end" is not read (Asger)
bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par)
{
unknown_layouts = 0;
bool Buffer::isDepClean(string const & name) const
{
- DEPCLEAN * item = dep_clean;
- while (item && item->master != name)
- item = item->next;
- if (!item) return true;
- return item->clean;
+ DepClean::const_iterator it = dep_clean_.find(name);
+ if (it == dep_clean_.end())
+ return true;
+ return it->second;
}
void Buffer::markDepClean(string const & name)
{
- if (!dep_clean) {
- dep_clean = new DEPCLEAN;
- dep_clean->clean = true;
- dep_clean->master = name;
- dep_clean->next = 0;
- } else {
- DEPCLEAN * item = dep_clean;
- while (item && item->master != name)
- item = item->next;
- if (item) {
- item->clean = true;
- } else {
- item = new DEPCLEAN;
- item->clean = true;
- item->master = name;
- item->next = 0;
- }
- }
+ dep_clean_[name] = true;
}
updateTitles();
}
bak_clean = false;
- DEPCLEAN * tmp = dep_clean;
- while (tmp) {
- tmp->clean = false;
- tmp = tmp->next;
+
+ DepClean::iterator it = dep_clean_.begin();
+ DepClean::const_iterator const end = dep_clean_.end();
+
+ for (; it != end; ++it) {
+ it->second = false;
}
}
class ParConstIterator;
-///
-struct DEPCLEAN {
- ///
- bool clean;
- ///
- string master;
- ///
- DEPCLEAN * next;
-};
-
/** The buffer object.
This is the buffer object. It contains all the informations about
a document loaded into LyX. I am not sure if the class is complete or
AuthorList & authors();
private:
+ typedef std::map<string, bool> DepClean;
+
+ /// need to regenerate .tex ?
+ DepClean dep_clean_;
+
/// the author list
AuthorList authorlist;
/// is this a unnamed file (New...)
bool unnamed;
- /// is regenerating #.tex# necessary
- DEPCLEAN * dep_clean;
-
/// buffer is r/o
bool read_only;