X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FTextCache.h;h=410e94eafc2e268cfc0ae096ce0af16ee939e6b3;hb=98c966c64594611e469313314abd1e59524adb4a;hp=256d49bca17e70f0e0bbb8eff89faf13a3f840bc;hpb=b374f06ded019b774fa9e122cf068bb7032f24e6;p=lyx.git diff --git a/src/TextCache.h b/src/TextCache.h index 256d49bca1..410e94eafc 100644 --- a/src/TextCache.h +++ b/src/TextCache.h @@ -1,12 +1,12 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * - * LyX, The Document Processor + * ====================================================== + * + * LyX, The Document Processor * 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 * * ====================================================== */ @@ -19,10 +19,12 @@ #endif #include "LString.h" -#include "support/LOstream.h" #include "lyxtext.h" +#include "buffer.h" + +#include +#include -class Buffer; // This is only the very first implemetation and use of the TextCache, // operations on it needs to be put into a class or a namespace, that part @@ -35,7 +37,7 @@ class Buffer; // // Q. What are we caching? // A. We are caching the screen representations (LyXText) of the -// documents (Buffer,LyXParagraph) for specific BufferView widths. +// documents (Buffer,Paragraph) for specific BufferView widths. // Q. Why the cache? // A. It is not really needed, but it speeds things up a lot // when you have more than one document loaded at once since a total @@ -57,7 +59,7 @@ class Buffer; // I believe there are only three possible scenarios where the two first // are also covered by the third. // - The simplest scenario is what we have now, a single -// BufferView only. +// BufferView only. // o Opening // Nothing to do with the TextCache is done when opening a file. // o Switching @@ -111,21 +113,22 @@ class Buffer; class TextCache { public: /// - typedef vector Cache; + typedef std::map > Cache; + /// - typedef LyXText * value_type; + typedef Cache::value_type value_type; /** Returns a pointer to a LyXText that fits the provided buffer and width. Of there is no match 0 is returned. */ - LyXText * findFit(Buffer * b, unsigned short p); + LyXText * findFit(Buffer * b, int p); /** Lists all the LyXText's currently in the cache. Uses msg as header for the list. */ - void show(ostream & o, string const & msg); + void show(std::ostream & o, string const & msg); /// Gives info on a single LyXText (buffer and width) - static void show(ostream & o, LyXText *); + static void show(std::ostream & o, value_type const &); /** Adds a LyXText to the cache iff its buffer is present in bufferlist. */ - void add(LyXText *); + void add(Buffer *, int witdth, LyXText *); /** Clears the cache. Deletes all LyXText's and releases the allocated memory. */ void clear(); @@ -136,6 +139,6 @@ private: Cache cache; }; -// bla bla +/// extern TextCache textcache; #endif