]> git.lyx.org Git - lyx.git/blobdiff - src/TextCache.h
Indentation change + small #ifndef NEW_INSETS fix.
[lyx.git] / src / TextCache.h
index f2fa9ffc31936c669a9cca522a8b27ce2c83b0a3..b18aabf3ca7ebebc2abc03fea2e52588538c989e 100644 (file)
 #endif
 
 #include <iosfwd>
+#include <map>
 
 #include "LString.h"
 #include "lyxtext.h"
-
-using std::ostream;
-using std::vector;
-
-class Buffer;
+#include "buffer.h"
 
 // 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
@@ -115,21 +112,22 @@ class Buffer;
 class TextCache {
 public:
        ///
-       typedef vector<LyXText*> Cache;
+       typedef std::map<Buffer *, std::pair<int,LyXText *> > 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();
@@ -140,6 +138,6 @@ private:
        Cache cache;
 };
 
-// bla bla
+///
 extern TextCache textcache;
 #endif