move code in file

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1891 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-04-04 21:37:14 +00:00
parent 67d3d47194
commit f879ff4b47
2 changed files with 27 additions and 35 deletions

View File

@ -1020,6 +1020,7 @@ LyXText * BufferView::getParentText(Inset * inset) const
return text; return text;
} }
Language const * BufferView::getParentLanguage(Inset * inset) const Language const * BufferView::getParentLanguage(Inset * inset) const
{ {
LyXText * text = getParentText(inset); LyXText * text = getParentText(inset);

View File

@ -3,9 +3,9 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* Copyright 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright 1995-2000 The LyX Team * Copyright 1995-2001 The LyX Team
* *
* This file is Copyright 2000 * This file is Copyright 2000-2001
* Lars Gullik Bjønnes * Lars Gullik Bjønnes
* *
* ====================================================== */ * ====================================================== */
@ -31,6 +31,8 @@ using std::make_pair;
extern BufferList bufferlist; extern BufferList bufferlist;
namespace {
class text_fits { class text_fits {
public: public:
text_fits(Buffer * b, int p) text_fits(Buffer * b, int p)
@ -46,6 +48,28 @@ private:
}; };
class show_text {
public:
show_text(ostream & o) : os(o) {}
void operator()(TextCache::value_type const & vt) {
os << "\tBuffer: " << vt.first
<< "\tWidth: " << vt.second.first << endl;
}
private:
ostream & os;
};
class delete_text {
public:
void operator()(TextCache::value_type & vt) {
delete vt.second.second;
}
};
} // namespace anon
LyXText * TextCache::findFit(Buffer * b, int p) LyXText * TextCache::findFit(Buffer * b, int p)
{ {
Cache::iterator it = find_if(cache.begin(), cache.end(), Cache::iterator it = find_if(cache.begin(), cache.end(),
@ -59,18 +83,6 @@ LyXText * TextCache::findFit(Buffer * b, int p)
} }
class show_text {
public:
show_text(ostream & o) : os(o) {}
void operator()(TextCache::value_type const & vt) {
os << "\tBuffer: " << vt.first
<< "\tWidth: " << vt.second.first << endl;
}
private:
ostream & os;
};
void TextCache::show(ostream & os, string const & str) void TextCache::show(ostream & os, string const & str)
{ {
os << "TextCache: " << str << endl; os << "TextCache: " << str << endl;
@ -98,14 +110,6 @@ void TextCache::add(Buffer * buf, int workwidth, LyXText * text)
} }
class delete_text {
public:
void operator()(TextCache::value_type & vt) {
delete vt.second.second;
}
};
void TextCache::clear() void TextCache::clear()
{ {
for_each(cache.begin(), cache.end(), delete_text()); for_each(cache.begin(), cache.end(), delete_text());
@ -113,19 +117,6 @@ void TextCache::clear()
} }
class has_buffer {
public:
has_buffer(Buffer * b)
: buf(b) {}
bool operator()(TextCache::value_type const & vt) const{
if (vt.first == buf) return true;
return false;
}
private:
Buffer const * buf;
};
void TextCache::removeAllWithBuffer(Buffer * buf) void TextCache::removeAllWithBuffer(Buffer * buf)
{ {
cache.erase(buf); cache.erase(buf);