]> git.lyx.org Git - lyx.git/blob - src/support/StrPool.C
noncopyable + read ChangeLog
[lyx.git] / src / support / StrPool.C
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  * 
5  *           LyX, The Document Processor
6  *       
7  *           Copyright 2000 Jean-Marc Lasgouttes
8  *
9  * ======================================================*/
10
11 #ifdef __GNUG__
12 #pragma implementation
13 #endif
14
15 #include <config.h>
16 #include "StrPool.h"
17
18 StrPool::~StrPool()
19 {
20         for (Pool::const_iterator cit = pool_.begin() ; 
21              cit != pool_.end() ; ++cit) {
22                 delete[] (*cit);
23         }
24 }
25
26 char const * StrPool::add(string const & str)
27 {
28         int s = str.length();
29         char * buf = new char [s + 1];
30         str.copy(buf, s);
31         buf[s] = '\0';
32         pool_.push_back(buf);
33         return buf;
34 }
35