mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-28 12:26:59 +00:00
36 lines
718 B
C++
36 lines
718 B
C++
|
// -*- C++ -*-
|
||
|
/* This file is part of
|
||
|
* ======================================================
|
||
|
*
|
||
|
* LyX, The Document Processor
|
||
|
*
|
||
|
* Copyright 2000 Jean-Marc Lasgouttes
|
||
|
*
|
||
|
* ======================================================*/
|
||
|
|
||
|
#ifdef __GNUG__
|
||
|
#pragma implementation
|
||
|
#endif
|
||
|
|
||
|
#include <config.h>
|
||
|
#include "StrPool.h"
|
||
|
|
||
|
StrPool::~StrPool()
|
||
|
{
|
||
|
for (Pool::const_iterator cit = pool_.begin() ;
|
||
|
cit != pool_.end() ; ++cit) {
|
||
|
delete[] (*cit);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
char const * StrPool::add(string const & str)
|
||
|
{
|
||
|
int s = str.length();
|
||
|
char * buf = new char [s + 1];
|
||
|
str.copy(buf, s);
|
||
|
buf[s] = '\0';
|
||
|
pool_.push_back(buf);
|
||
|
return buf;
|
||
|
}
|
||
|
|