use bald pointers in clone()

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19920 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-08-30 18:03:17 +00:00
parent b45bc7944d
commit ed858d73e5
207 changed files with 382 additions and 627 deletions

View File

@ -1083,7 +1083,7 @@ Paragraph::Paragraph(Paragraph const & par)
InsetList::iterator it = insetlist.begin();
InsetList::iterator end = insetlist.end();
for (; it != end; ++it)
it->inset = it->inset->clone().release();
it->inset = it->inset->clone();
}
@ -1097,7 +1097,7 @@ Paragraph & Paragraph::operator=(Paragraph const & par)
InsetList::iterator it = insetlist.begin();
InsetList::iterator end = insetlist.end();
for (; it != end; ++it)
it->inset = it->inset->clone().release();
it->inset = it->inset->clone();
layout_ = par.layout();
text_ = par.text_;

View File

@ -565,3 +565,6 @@ void Template::Format::readFormat(Lexer & lex)
} // namespace external
} // namespace lyx

View File

@ -123,14 +123,6 @@ Inset::Inset()
{}
std::auto_ptr<Inset> Inset::clone() const
{
std::auto_ptr<Inset> b = doClone();
BOOST_ASSERT(typeid(*b) == typeid(*this));
return b;
}
Inset::Code Inset::translate(std::string const & name)
{
static TranslatorMap const translator = build_translator();

View File

@ -15,8 +15,6 @@
#ifndef INSETBASE_H
#define INSETBASE_H
//#include "BiblioInfo.h"
#include "Changes.h"
#include "Dimension.h"
#include "support/docstream.h"
@ -30,24 +28,26 @@ class BiblioInfo;
class Buffer;
class BufferParams;
class BufferView;
class ParIterator;
class ParConstIterator;
class Change;
class Color_color;
class Cursor;
class CursorSlice;
class InsetIterator;
class FuncRequest;
class FuncStatus;
class InsetIterator;
class InsetLayout;
class InsetMath;
class InsetText;
class LaTeXFeatures;
class Color_color;
class Cursor;
class Lexer;
class Text;
class MathAtom;
class MetricsInfo;
class Dimension;
class PainterInfo;
class OutputParams;
class PainterInfo;
class Paragraph;
class ParConstIterator;
class ParIterator;
class Text;
class TocList;
@ -77,8 +77,6 @@ public:
/// virtual base class destructor
virtual ~Inset() {}
/// replicate ourselves
std::auto_ptr<Inset> clone() const;
/// identification as math inset
virtual InsetMath * asInsetMath() { return 0; }
@ -499,6 +497,11 @@ public:
protected:
Inset();
/// replicate ourselves
friend class Paragraph;
friend class MathAtom;
virtual Inset * clone() const = 0;
/** The real dispatcher.
* Gets normally called from Cursor::dispatch(). Cursor::dispatch()
* assumes the common case of 'LFUN handled, need update'.
@ -514,8 +517,6 @@ protected:
/// Cached dimensions of the inset.
mutable Dimension dim_;
private:
virtual std::auto_ptr<Inset> doClone() const = 0;
};

View File

@ -31,16 +31,13 @@
namespace lyx {
using support::prefixIs;
using std::max;
using std::string;
using std::auto_ptr;
using std::ostream;
int InsetBibitem::key_counter = 0;
docstring const key_prefix = from_ascii("key-");
InsetBibitem::InsetBibitem(InsetCommandParams const & p)
: InsetCommand(p, "bibitem")
{
@ -49,11 +46,11 @@ InsetBibitem::InsetBibitem(InsetCommandParams const & p)
}
auto_ptr<Inset> InsetBibitem::doClone() const
Inset * InsetBibitem::clone() const
{
auto_ptr<InsetBibitem> b(new InsetBibitem(params()));
InsetBibitem * b = new InsetBibitem(params());
b->autolabel_ = autolabel_;
return auto_ptr<Inset>(b);
return b;
}
@ -85,9 +82,9 @@ void InsetBibitem::read(Buffer const & buf, Lexer & lex)
{
InsetCommand::read(buf, lex);
if (prefixIs(getParam("key"), key_prefix)) {
if (support::prefixIs(getParam("key"), key_prefix)) {
int const key = convert<int>(getParam("key").substr(key_prefix.length()));
key_counter = max(key_counter, key);
key_counter = std::max(key_counter, key);
}
}

View File

@ -50,7 +50,7 @@ protected:
///
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
/// The label that is set by updateLabels
docstring autolabel_;

View File

@ -78,9 +78,9 @@ InsetBibtex::InsetBibtex(InsetCommandParams const & p)
{}
std::auto_ptr<Inset> InsetBibtex::doClone() const
Inset * InsetBibtex::clone() const
{
return std::auto_ptr<Inset>(new InsetBibtex(*this));
return new InsetBibtex(*this);
}

View File

@ -51,7 +51,7 @@ public:
protected:
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
};

View File

@ -34,7 +34,6 @@
namespace lyx {
using std::auto_ptr;
using std::string;
using std::istringstream;
using std::ostream;
@ -113,9 +112,9 @@ InsetBox::~InsetBox()
}
auto_ptr<Inset> InsetBox::doClone() const
Inset * InsetBox::clone() const
{
return auto_ptr<Inset>(new InsetBox(*this));
return new InsetBox(*this);
}

View File

@ -114,7 +114,7 @@ protected:
private:
friend class InsetBoxParams;
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
/// used by the constructors
void init();

View File

@ -31,7 +31,6 @@
namespace lyx {
using std::string;
using std::auto_ptr;
using std::istringstream;
using std::ostream;
using std::ostringstream;
@ -64,9 +63,9 @@ InsetBranch::~InsetBranch()
}
auto_ptr<Inset> InsetBranch::doClone() const
Inset * InsetBranch::clone() const
{
return auto_ptr<Inset>(new InsetBranch(*this));
return new InsetBranch(*this);
}

View File

@ -92,7 +92,7 @@ protected:
private:
friend class InsetBranchParams;
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
/// used by the constructors
void init();

View File

@ -40,7 +40,6 @@
#include <sstream>
using std::auto_ptr;
using std::endl;
using std::string;
using std::ostream;
@ -48,7 +47,6 @@ using std::ostream;
namespace lyx {
using support::bformat;
InsetCaption::InsetCaption(InsetCaption const & ic)
: InsetText(ic), textclass_(ic.textclass_)
@ -288,6 +286,7 @@ int InsetCaption::getOptArg(Buffer const & buf, odocstream & os,
void InsetCaption::updateLabels(Buffer const & buf, ParIterator const & it)
{
using support::bformat;
TextClass const & tclass = buf.params().getTextClass();
Counters & cnts = tclass.counters();
string const & type = cnts.current_float();
@ -315,9 +314,9 @@ void InsetCaption::updateLabels(Buffer const & buf, ParIterator const & it)
}
auto_ptr<Inset> InsetCaption::doClone() const
Inset * InsetCaption::clone() const
{
return auto_ptr<Inset>(new InsetCaption(*this));
return new InsetCaption(*this);
}

View File

@ -88,7 +88,7 @@ public:
private:
///
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
///
mutable docstring full_label_;
///

View File

@ -41,12 +41,7 @@
namespace lyx {
using std::string;
using std::auto_ptr;
using std::istringstream;
using std::max;
using std::ostream;
using std::ostringstream;
InsetCharStyle::InsetCharStyle(BufferParams const & bp, string const s)
@ -70,9 +65,9 @@ InsetCharStyle::InsetCharStyle(InsetCharStyle const & in)
{}
auto_ptr<Inset> InsetCharStyle::doClone() const
Inset * InsetCharStyle::clone() const
{
return auto_ptr<Inset>(new InsetCharStyle(*this));
return new InsetCharStyle(*this);
}

View File

@ -88,7 +88,7 @@ protected:
private:
friend class InsetCharStyleParams;
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
///
InsetCharStyleParams params_;

View File

@ -33,8 +33,6 @@
namespace lyx {
using support::ascii_lowercase;
using support::contains;
using support::FileName;
using support::getStringFromVector;
using support::getVectorFromString;
@ -45,11 +43,8 @@ using support::split;
using support::tokenPos;
using std::endl;
using std::replace;
using std::string;
using std::ostream;
using std::vector;
using std::map;
namespace fs = boost::filesystem;
@ -371,6 +366,8 @@ docstring const getNatbibLabel(Buffer const & buffer,
docstring const getBasicLabel(docstring const & keyList, docstring const & after)
{
using support::contains;
docstring keys(keyList);
docstring label;
@ -548,7 +545,7 @@ void InsetCitation::replaceContents(string const & from, string const & to)
{
if (tokenPos(getContents(), ',', from) != -1) {
vector<string> items = getVectorFromString(getContents());
replace(items.begin(), items.end(), from, to);
std::replace(items.begin(), items.end(), from, to);
setContents(getStringFromVector(items));
}
}

View File

@ -52,9 +52,9 @@ public:
void replaceContents(std::string const & from, std::string const & to);
private:
virtual std::auto_ptr<Inset> doClone() const
virtual Inset * clone() const
{
return std::auto_ptr<Inset>(new InsetCitation(params()));
return new InsetCitation(params());
}
/// This function does the donkey work of creating the pretty label

View File

@ -35,12 +35,8 @@
namespace lyx {
using graphics::PreviewLoader;
using std::endl;
using std::string;
using std::max;
using std::min;
using std::ostream;
@ -176,6 +172,8 @@ Dimension InsetCollapsable::dimensionCollapsed() const
bool InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
{
using std::max;
autoOpen_ = mi.base.bv->cursor().isInside(this);
mi.base.textwidth -= (int) (1.5 * TEXT_TO_INSET_OFFSET);
@ -423,7 +421,7 @@ docstring const InsetCollapsable::getNewLabel(docstring const & l) const
docstring label;
pos_type const max_length = 15;
pos_type const p_siz = paragraphs().begin()->size();
pos_type const n = min(max_length, p_siz);
pos_type const n = std::min(max_length, p_siz);
pos_type i = 0;
pos_type j = 0;
for (; i < n && j < p_siz; ++j) {

View File

@ -29,7 +29,6 @@ namespace lyx {
using std::string;
using std::istringstream;
using std::ostream;
using std::ostringstream;

View File

@ -43,7 +43,6 @@ using support::token;
using std::endl;
using std::min;
using std::auto_ptr;
using std::istringstream;
using std::ostream;
using std::ostringstream;
@ -74,9 +73,9 @@ InsetERT::InsetERT(InsetERT const & in)
}
auto_ptr<Inset> InsetERT::doClone() const
Inset * InsetERT::clone() const
{
return auto_ptr<Inset>(new InsetERT(*this));
return new InsetERT(*this);
}

View File

@ -83,7 +83,7 @@ protected:
///
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
///
void init();
///

View File

@ -21,10 +21,6 @@
namespace lyx {
using std::string;
using std::auto_ptr;
using std::ostream;
InsetEnvironment::InsetEnvironment
(BufferParams const & bp, docstring const & name)
@ -40,13 +36,13 @@ InsetEnvironment::InsetEnvironment(InsetEnvironment const & in)
{}
auto_ptr<Inset> InsetEnvironment::doClone() const
Inset * InsetEnvironment::clone() const
{
return auto_ptr<Inset>(new InsetEnvironment(*this));
return new InsetEnvironment(*this);
}
void InsetEnvironment::write(Buffer const & buf, ostream & os) const
void InsetEnvironment::write(Buffer const & buf, std::ostream & os) const
{
os << "Environment " << to_utf8(name()) << "\n";
InsetText::write(buf, os);

View File

@ -49,7 +49,7 @@ public:
protected:
InsetEnvironment(InsetEnvironment const &);
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
/// the layout
LayoutPtr layout_;
///

View File

@ -44,9 +44,7 @@
#include <sstream>
using std::endl;
using std::string;
using std::auto_ptr;
using std::istringstream;
using std::ostream;
using std::ostringstream;
@ -413,9 +411,9 @@ InsetExternal::InsetExternal(InsetExternal const & other)
{}
auto_ptr<Inset> InsetExternal::doClone() const
Inset * InsetExternal::clone() const
{
return auto_ptr<Inset>(new InsetExternal(*this));
return new InsetExternal(*this);
}

View File

@ -153,7 +153,7 @@ protected:
///
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
/** This method is connected to the graphics loader, so we are
* informed when the image has been loaded.

View File

@ -35,11 +35,8 @@
namespace lyx {
using support::contains;
using std::endl;
using std::string;
using std::auto_ptr;
using std::istringstream;
using std::ostream;
using std::ostringstream;
@ -267,7 +264,7 @@ void InsetFloat::read(Buffer const & buf, Lexer & lex)
void InsetFloat::validate(LaTeXFeatures & features) const
{
if (contains(params_.placement, 'H')) {
if (support::contains(params_.placement, 'H')) {
features.require("float");
}
@ -279,9 +276,9 @@ void InsetFloat::validate(LaTeXFeatures & features) const
}
auto_ptr<Inset> InsetFloat::doClone() const
Inset * InsetFloat::clone() const
{
return auto_ptr<Inset>(new InsetFloat(*this));
return new InsetFloat(*this);
}

View File

@ -91,7 +91,7 @@ protected:
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
private:
///
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
///
InsetFloatParams params_;
///

View File

@ -50,9 +50,9 @@ public:
///
void validate(LaTeXFeatures & features) const;
private:
virtual std::auto_ptr<Inset> doClone() const
virtual Inset * clone() const
{
return std::auto_ptr<Inset>(new InsetFloatList(to_ascii(getParam("type"))));
return new InsetFloatList(to_ascii(getParam("type")));
}
};

View File

@ -45,9 +45,9 @@ InsetFoot::InsetFoot(InsetFoot const & in)
{}
auto_ptr<Inset> InsetFoot::doClone() const
Inset * InsetFoot::clone() const
{
return auto_ptr<Inset>(new InsetFoot(*this));
return new InsetFoot(*this);
}
@ -74,6 +74,7 @@ void InsetFoot::updateLabels(Buffer const & buf, ParIterator const & it)
InsetCollapsable::updateLabels(buf, it);
}
int InsetFoot::latex(Buffer const & buf, odocstream & os,
OutputParams const & runparams_in) const
{

View File

@ -46,7 +46,7 @@ public:
protected:
InsetFoot(InsetFoot const &);
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
};

View File

@ -17,8 +17,10 @@
#include "BufferParams.h"
#include "MetricsInfo.h"
namespace lyx {
InsetFootlike::InsetFootlike(BufferParams const & bp)
: InsetCollapsable(bp)
{}

View File

@ -112,7 +112,6 @@ using support::unzippedFileName;
using std::endl;
using std::string;
using std::auto_ptr;
using std::istringstream;
using std::ostream;
using std::ostringstream;
@ -165,9 +164,9 @@ InsetGraphics::InsetGraphics(InsetGraphics const & ig)
}
auto_ptr<Inset> InsetGraphics::doClone() const
Inset * InsetGraphics::clone() const
{
return auto_ptr<Inset>(new InsetGraphics(*this));
return new InsetGraphics(*this);
}

View File

@ -85,7 +85,7 @@ protected:
private:
friend class InsetGraphicsMailer;
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
/// Read the inset native format
void readInsetGraphics(Lexer & lex, std::string const & bufpath);

View File

@ -289,7 +289,7 @@ graphics::Params InsetGraphicsParams::as_grfxParams() const
unsigned int const bb_orig_yb = convert<int>(token(tmp, ' ', 1));
// new pars.bb values must be >= zero
if (pars.bb.xl > bb_orig_xl)
if (pars.bb.xl > bb_orig_xl)
pars.bb.xl -= bb_orig_xl;
else
pars.bb.xl = 0;

View File

@ -18,17 +18,15 @@
namespace lyx {
using std::ostream;
InsetHFill::InsetHFill()
: InsetCommand(InsetCommandParams("hfill"), std::string())
{}
std::auto_ptr<Inset> InsetHFill::doClone() const
Inset * InsetHFill::clone() const
{
return std::auto_ptr<Inset>(new InsetHFill);
return new InsetHFill;
}
@ -65,7 +63,7 @@ int InsetHFill::docbook(Buffer const &, odocstream & os,
}
void InsetHFill::write(Buffer const &, ostream & os) const
void InsetHFill::write(Buffer const &, std::ostream & os) const
{
os << "\n\\hfill\n";
}

View File

@ -42,7 +42,7 @@ public:
// a line separator)?
bool isSpace() const;
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
};

View File

@ -81,7 +81,6 @@ using support::sum;
using std::endl;
using std::string;
using std::auto_ptr;
using std::istringstream;
using std::ostream;
using std::ostringstream;
@ -279,9 +278,9 @@ void InsetInclude::set(InsetCommandParams const & p, Buffer const & buffer)
}
auto_ptr<Inset> InsetInclude::doClone() const
Inset * InsetInclude::clone() const
{
return auto_ptr<Inset>(new InsetInclude(*this));
return new InsetInclude(*this);
}

View File

@ -108,7 +108,7 @@ protected:
///
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
/** Slot receiving a signal that the external file has changed
* and the preview should be regenerated.

View File

@ -32,11 +32,6 @@ InsetIndex::InsetIndex(InsetCommandParams const & p)
{}
// InsetIndex::InsetIndex(InsetCommandParams const & p, bool)
// : InsetCommand(p, false)
// {}
docstring const InsetIndex::getScreenLabel(Buffer const &) const
{
return _("Idx");
@ -65,11 +60,6 @@ InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p)
{}
// InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p, bool)
// : InsetCommand(p, false)
// {}
docstring const InsetPrintIndex::getScreenLabel(Buffer const &) const
{
return _("Index");

View File

@ -36,8 +36,8 @@ public:
int docbook(Buffer const &, odocstream &,
OutputParams const &) const;
private:
virtual std::auto_ptr<Inset> doClone() const {
return std::auto_ptr<Inset>(new InsetIndex(params()));
virtual Inset * clone() const {
return new InsetIndex(params());
}
};
@ -57,8 +57,8 @@ public:
///
docstring const getScreenLabel(Buffer const &) const;
private:
virtual std::auto_ptr<Inset> doClone() const {
return std::auto_ptr<Inset>(new InsetPrintIndex(params()));
virtual Inset * clone() const {
return new InsetPrintIndex(params());
}
};

View File

@ -25,20 +25,15 @@
namespace lyx {
using support::escape;
using std::string;
using std::vector;
InsetLabel::InsetLabel(InsetCommandParams const & p)
: InsetCommand(p, "label")
{}
std::auto_ptr<Inset> InsetLabel::doClone() const
Inset * InsetLabel::clone() const
{
return std::auto_ptr<Inset>(new InsetLabel(params()));
return new InsetLabel(params());
}
@ -83,7 +78,7 @@ void InsetLabel::doDispatch(Cursor & cur, FuncRequest & cmd)
int InsetLabel::latex(Buffer const &, odocstream & os,
OutputParams const &) const
{
os << escape(getCommand());
os << support::escape(getCommand());
return 0;
}

View File

@ -38,7 +38,7 @@ public:
protected:
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
};

View File

@ -26,7 +26,6 @@ namespace lyx {
using frontend::Painter;
using std::endl;
using std::ostream;

View File

@ -48,9 +48,9 @@ public:
///
void validate(LaTeXFeatures & features) const;
private:
virtual std::auto_ptr<Inset> doClone() const
virtual Inset * clone() const
{
return std::auto_ptr<Inset>(new InsetLine);
return new InsetLine;
}
};

View File

@ -34,13 +34,13 @@ using support::token;
using support::contains;
using support::subst;
using std::auto_ptr;
using std::istringstream;
using std::ostream;
using std::ostringstream;
using std::string;
char const lstinline_delimiters[] = "!*()-=+|;:'\"`,<.>/?QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm";
char const lstinline_delimiters[] =
"!*()-=+|;:'\"`,<.>/?QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm";
void InsetListings::init()
{
@ -69,9 +69,9 @@ InsetListings::InsetListings(InsetListings const & in)
}
auto_ptr<Inset> InsetListings::doClone() const
Inset * InsetListings::clone() const
{
return auto_ptr<Inset>(new InsetListings(*this));
return new InsetListings(*this);
}

View File

@ -67,7 +67,7 @@ protected:
///
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
///
void init();
///

View File

@ -30,8 +30,7 @@ using std::ostream;
using std::string;
using std::exception;
namespace lyx
{
namespace lyx {
using support::bformat;
using support::trim;

View File

@ -22,10 +22,6 @@
namespace lyx {
using std::string;
using std::auto_ptr;
using std::ostream;
InsetMarginal::InsetMarginal(BufferParams const & bp)
: InsetFootlike(bp)
@ -39,9 +35,9 @@ InsetMarginal::InsetMarginal(InsetMarginal const & in)
{}
auto_ptr<Inset> InsetMarginal::doClone() const
Inset * InsetMarginal::clone() const
{
return auto_ptr<Inset>(new InsetMarginal(*this));
new InsetMarginal(*this);
}

View File

@ -44,7 +44,7 @@ public:
protected:
InsetMarginal(InsetMarginal const &);
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
};

View File

@ -44,9 +44,9 @@ public:
// a line separator)?
bool isSpace() const;
private:
virtual std::auto_ptr<Inset> doClone() const
virtual Inset * clone() const
{
return std::auto_ptr<Inset>(new InsetNewline);
return new InsetNewline;
}
};

View File

@ -41,8 +41,8 @@ public:
///
int docbookGlossary(odocstream &) const;
private:
virtual std::auto_ptr<Inset> doClone() const {
return std::auto_ptr<Inset>(new InsetNomencl(params()));
virtual Inset * clone() const {
return new InsetNomencl(params());
}
/// unique id for this nomenclature entry for docbook export
docstring nomenclature_entry_id;
@ -71,8 +71,8 @@ public:
///
docstring const getScreenLabel(Buffer const &) const;
private:
virtual std::auto_ptr<Inset> doClone() const {
return std::auto_ptr<Inset>(new InsetPrintNomencl(params()));
virtual Inset * clone() const {
return new InsetPrintNomencl(params());
}
};

View File

@ -40,7 +40,6 @@
namespace lyx {
using std::string;
using std::auto_ptr;
using std::istringstream;
using std::ostream;
using std::ostringstream;
@ -134,9 +133,9 @@ InsetNote::~InsetNote()
}
auto_ptr<Inset> InsetNote::doClone() const
Inset * InsetNote::clone() const
{
return auto_ptr<Inset>(new InsetNote(*this));
return new InsetNote(*this);
}

View File

@ -84,7 +84,7 @@ protected:
private:
friend class InsetNoteParams;
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
/// used by the constructors
void init();

View File

@ -18,10 +18,6 @@
namespace lyx {
using std::string;
using std::auto_ptr;
using std::ostream;
InsetOptArg::InsetOptArg(BufferParams const & ins)
: InsetCollapsable(ins)
@ -43,9 +39,9 @@ InsetOptArg::InsetOptArg(InsetOptArg const & in)
}
auto_ptr<Inset> InsetOptArg::doClone() const
Inset * InsetOptArg::clone() const
{
return auto_ptr<Inset>(new InsetOptArg(*this));
return new InsetOptArg(*this);
}
@ -55,7 +51,7 @@ docstring const InsetOptArg::editMessage() const
}
void InsetOptArg::write(Buffer const & buf, ostream & os) const
void InsetOptArg::write(Buffer const & buf, std::ostream & os) const
{
os << "OptArg" << "\n";
InsetCollapsable::write(buf, os);

View File

@ -53,7 +53,7 @@ public:
protected:
InsetOptArg(InsetOptArg const &);
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
};

View File

@ -28,9 +28,6 @@ namespace lyx {
using frontend::Painter;
using std::endl;
using std::ostream;
void InsetPagebreak::read(Buffer const &, Lexer &)
{
@ -38,7 +35,7 @@ void InsetPagebreak::read(Buffer const &, Lexer &)
}
void InsetPagebreak::write(Buffer const &, ostream & os) const
void InsetPagebreak::write(Buffer const &, std::ostream & os) const
{
os << "\n" << getCmdName() << '\n';
}

View File

@ -51,9 +51,9 @@ public:
virtual std::string getCmdName() const { return "\\newpage"; }
private:
virtual std::auto_ptr<Inset> doClone() const
virtual Inset * clone() const
{
return std::auto_ptr<Inset>(new InsetPagebreak);
return new InsetPagebreak;
}
};
@ -67,9 +67,9 @@ public:
std::string getCmdName() const { return "\\clearpage"; }
private:
virtual std::auto_ptr<Inset> doClone() const
virtual Inset * clone() const
{
return std::auto_ptr<Inset>(new InsetClearPage);
return new InsetClearPage;
}
};
@ -83,9 +83,9 @@ public:
std::string getCmdName() const { return "\\cleardoublepage"; }
private:
virtual std::auto_ptr<Inset> doClone() const
virtual Inset * clone() const
{
return std::auto_ptr<Inset>(new InsetClearDoublePage);
return new InsetClearDoublePage;
}
};

View File

@ -34,7 +34,6 @@ using support::prefixIs;
using std::endl;
using std::string;
using std::auto_ptr;
using std::ostream;
@ -384,9 +383,9 @@ void InsetQuotes::validate(LaTeXFeatures & features) const
}
auto_ptr<Inset> InsetQuotes::doClone() const
Inset * InsetQuotes::clone() const
{
return auto_ptr<Inset>(new InsetQuotes(language_, side_, times_));
return new InsetQuotes(language_, side_, times_);
}

View File

@ -105,7 +105,7 @@ public:
bool isChar() const { return true; }
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
///
quote_language language_;

View File

@ -63,8 +63,8 @@ protected:
///
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
private:
virtual std::auto_ptr<Inset> doClone() const {
return std::auto_ptr<Inset>(new InsetRef(*this));
virtual Inset * clone() const {
return new InsetRef(*this);
}
///
bool isLatex;

View File

@ -29,7 +29,6 @@ namespace lyx {
using std::string;
using std::max;
using std::auto_ptr;
using std::ostream;
@ -235,9 +234,9 @@ int InsetSpace::textString(Buffer const & buf, odocstream & os,
}
auto_ptr<Inset> InsetSpace::doClone() const
Inset * InsetSpace::clone() const
{
return auto_ptr<Inset>(new InsetSpace(kind_));
return new InsetSpace(kind_);
}

View File

@ -88,7 +88,7 @@ public:
// a line separator)?
bool isSpace() const;
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
/// And which kind is this?
Kind kind_;

View File

@ -27,7 +27,6 @@
namespace lyx {
using std::string;
using std::auto_ptr;
using std::ostream;
@ -240,17 +239,16 @@ int InsetSpecialChar::textString(Buffer const & buf, odocstream & os,
}
auto_ptr<Inset> InsetSpecialChar::doClone() const
Inset * InsetSpecialChar::clone() const
{
return auto_ptr<Inset>(new InsetSpecialChar(kind_));
return new InsetSpecialChar(kind_);
}
void InsetSpecialChar::validate(LaTeXFeatures & features) const
{
if (kind_ == MENU_SEPARATOR) {
if (kind_ == MENU_SEPARATOR)
features.require("lyxarrow");
}
}

View File

@ -81,7 +81,7 @@ public:
// should we break lines after this inset?
bool isLineSeparator() const;
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
/// And which kind is this?
Kind kind_;

View File

@ -34,9 +34,9 @@ InsetTOC::InsetTOC(InsetCommandParams const & p)
{}
std::auto_ptr<Inset> InsetTOC::doClone() const
Inset * InsetTOC::clone() const
{
return std::auto_ptr<Inset>(new InsetTOC(*this));
return new InsetTOC(*this);
}

View File

@ -38,7 +38,7 @@ public:
int docbook(Buffer const &, odocstream &,
OutputParams const &) const;
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
};

View File

@ -59,7 +59,6 @@
#include <limits>
using std::abs;
using std::auto_ptr;
using std::endl;
using std::getline;
using std::istream;
@ -515,20 +514,18 @@ Tabular::cellstruct::cellstruct(cellstruct const & cs)
rotate(cs.rotate),
align_special(cs.align_special),
p_width(cs.p_width),
inset(dynamic_cast<InsetText*>(cs.inset->clone().release()))
inset(dynamic_cast<InsetText*>(cs.inset->clone()))
{}
Tabular::cellstruct &
Tabular::cellstruct::operator=(cellstruct cs)
Tabular::cellstruct & Tabular::cellstruct::operator=(cellstruct cs)
{
swap(cs);
return *this;
}
void
Tabular::cellstruct::swap(cellstruct & rhs)
void Tabular::cellstruct::swap(cellstruct & rhs)
{
std::swap(cellno, rhs.cellno);
std::swap(width_of_cell, rhs.width_of_cell);
@ -2902,9 +2899,9 @@ InsetTabular::~InsetTabular()
}
auto_ptr<Inset> InsetTabular::doClone() const
Inset * InsetTabular::clone() const
{
return auto_ptr<Inset>(new InsetTabular(*this));
return new InsetTabular(*this);
}

View File

@ -777,7 +777,7 @@ protected:
int scroll() const { return scx_; }
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
///
void drawCellLines(frontend::Painter &, int x, int y, row_type row,

View File

@ -70,7 +70,6 @@ using std::endl;
using std::for_each;
using std::max;
using std::string;
using std::auto_ptr;
using std::ostream;
using std::vector;
@ -130,9 +129,9 @@ void InsetText::clear()
}
auto_ptr<Inset> InsetText::doClone() const
Inset * InsetText::clone() const
{
return auto_ptr<Inset>(new InsetText(*this));
return new InsetText(*this);
}

View File

@ -30,6 +30,7 @@ class CursorSlice;
class Dimension;
class Color_color;
class ParagraphList;
class InsetTabular;
/**
@ -135,14 +136,14 @@ public:
// Update the counters of this inset and of its contents
virtual void updateLabels(Buffer const &, ParIterator const &);
///
virtual Inset * clone() const;
protected:
///
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
private:
///
virtual std::auto_ptr<Inset> doClone() const;
///
void init();

View File

@ -58,15 +58,15 @@ void Inset.heorem::write(Buffer const * buf, ostream & os) const
}
auto_ptr<Inset> Inset.heorem::doClone() const
Inset * InsetTheorem::clone() const
{
// FIXME: Is this inset used? If YES this is WRONG!!! (Jug)
auto_ptr<Inset.heorem> result(new InsetTheorem);
InsetTheorem * result = new InsetTheorem;
result->setCollapsed(!isOpen());
return result;
}
bool Inset.heorem::metrics(MetricsInfo & mi, Dimension & dim) const
{
InsetCollapsable::metrics(mi, dim);

View File

@ -39,7 +39,7 @@ public:
///
virtual docstring const editMessage() const;
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
///
mutable unsigned int center_indent_;

View File

@ -50,8 +50,8 @@ public:
virtual int textString(Buffer const &, odocstream &,
OutputParams const &) const;
private:
virtual std::auto_ptr<Inset> doClone() const {
return std::auto_ptr<Inset>(new InsetUrl(params()));
virtual Inset * clone() const {
return new InsetUrl(params());
}
};

View File

@ -57,9 +57,9 @@ InsetVSpace::~InsetVSpace()
}
std::auto_ptr<Inset> InsetVSpace::doClone() const
Inset * InsetVSpace::clone() const
{
return std::auto_ptr<Inset>(new InsetVSpace(*this));
return new InsetVSpace(*this);
}

View File

@ -55,7 +55,7 @@ protected:
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
///
docstring const label() const;

View File

@ -37,7 +37,6 @@ namespace lyx {
using std::string;
using std::endl;
using std::auto_ptr;
using std::istringstream;
using std::ostream;
using std::ostringstream;
@ -181,9 +180,9 @@ void InsetWrap::validate(LaTeXFeatures & features) const
}
auto_ptr<Inset> InsetWrap::doClone() const
Inset * InsetWrap::clone() const
{
return auto_ptr<Inset>(new InsetWrap(*this));
return new InsetWrap(*this);
}

View File

@ -79,7 +79,7 @@ protected:
///
virtual docstring name() const { return name_; }
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
///
InsetWrapParams params_;

View File

@ -32,7 +32,7 @@ class RenderBase {
public:
virtual ~RenderBase() {}
virtual std::auto_ptr<RenderBase> clone(Inset const *) const = 0;
virtual RenderBase * clone(Inset const *) const = 0;
/// compute the size of the object returned in dim.
/// \retval true if the metrics has changed.

View File

@ -21,18 +21,15 @@
namespace lyx {
using std::string;
using std::auto_ptr;
RenderButton::RenderButton()
: editable_(false)
{}
auto_ptr<RenderBase> RenderButton::clone(Inset const *) const
RenderBase * RenderButton::clone(Inset const *) const
{
return auto_ptr<RenderBase>(new RenderButton(*this));
return new RenderButton(*this);
}

View File

@ -25,7 +25,7 @@ class RenderButton : public RenderBase
public:
RenderButton();
std::auto_ptr<RenderBase> clone(Inset const *) const;
RenderBase * clone(Inset const *) const;
/// compute the size of the object returned in dim
virtual bool metrics(MetricsInfo & mi, Dimension & dim) const;

View File

@ -35,7 +35,6 @@ namespace lyx {
using support::onlyFilename;
using std::string;
using std::auto_ptr;
RenderGraphic::RenderGraphic(Inset const * inset)
@ -56,9 +55,9 @@ RenderGraphic::RenderGraphic(RenderGraphic const & other,
}
auto_ptr<RenderBase> RenderGraphic::clone(Inset const * inset) const
RenderBase * RenderGraphic::clone(Inset const * inset) const
{
return auto_ptr<RenderBase>(new RenderGraphic(*this, inset));
return new RenderGraphic(*this, inset);
}

View File

@ -26,7 +26,7 @@ class RenderGraphic : public RenderBase
public:
RenderGraphic(Inset const *);
RenderGraphic(RenderGraphic const &, Inset const *);
std::auto_ptr<RenderBase> clone(Inset const *) const;
RenderBase * clone(Inset const *) const;
/// compute the size of the object returned in dim
bool metrics(MetricsInfo & mi, Dimension & dim) const;

View File

@ -39,7 +39,6 @@ namespace lyx {
using support::FileName;
using std::string;
using std::auto_ptr;
LyXRC_PreviewStatus RenderPreview::status()
@ -69,9 +68,9 @@ RenderPreview::~RenderPreview()
}
auto_ptr<RenderBase> RenderPreview::clone(Inset const * inset) const
RenderBase * RenderPreview::clone(Inset const * inset) const
{
return auto_ptr<RenderBase>(new RenderPreview(*this, inset));
return new RenderPreview(*this, inset);
}

View File

@ -50,7 +50,7 @@ public:
RenderPreview(Inset const *);
RenderPreview(RenderPreview const &, Inset const *);
~RenderPreview();
std::auto_ptr<RenderBase> clone(Inset const *) const;
RenderBase * clone(Inset const *) const;
/// Compute the size of the object, returned in dim
bool metrics(MetricsInfo &, Dimension & dim) const;

View File

@ -21,7 +21,6 @@
namespace lyx {
using std::auto_ptr;
using std::string;
CommandInset::CommandInset(docstring const & name)
@ -31,9 +30,9 @@ CommandInset::CommandInset(docstring const & name)
}
auto_ptr<Inset> CommandInset::doClone() const
Inset * CommandInset::clone() const
{
return auto_ptr<Inset>(new CommandInset(*this));
return new CommandInset(*this);
}

View File

@ -44,7 +44,7 @@ public:
bool isActive() const { return false; }
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
///
docstring name_;

View File

@ -31,7 +31,6 @@
#include <sstream>
using std::string;
using std::auto_ptr;
using std::ostream;
using std::endl;
@ -61,9 +60,9 @@ InsetFormulaMacro::InsetFormulaMacro(string const & s)
}
auto_ptr<Inset> InsetFormulaMacro::clone() const
Inset * InsetFormulaMacro::clone() const
{
return auto_ptr<Inset>(new InsetFormulaMacro(*this));
return new InsetFormulaMacro(*this);
}

View File

@ -53,8 +53,6 @@ public:
int docbook(Buffer const &, odocstream &,
OutputParams const &) const;
///
std::auto_ptr<Inset> clone() const;
///
Inset::Code lyxCode() const { return MATHMACRO_CODE; }
///
@ -70,6 +68,8 @@ private:
docstring prefix() const;
///
docstring name_;
///
Inset * clone() const;
};

View File

@ -24,7 +24,6 @@
#include "support/lstrings.h"
#include "support/std_ostream.h"
using std::auto_ptr;
namespace lyx {
@ -41,9 +40,9 @@ InsetMathAMSArray::InsetMathAMSArray(docstring const & name)
{}
auto_ptr<Inset> InsetMathAMSArray::doClone() const
Inset * InsetMathAMSArray::clone() const
{
return auto_ptr<Inset>(new InsetMathAMSArray(*this));
return new InsetMathAMSArray(*this);
}

View File

@ -45,7 +45,7 @@ public:
///
void validate(LaTeXFeatures & features) const;
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
///
char const * name_left() const;
///

View File

@ -25,7 +25,6 @@
namespace lyx {
using std::getline;
using std::auto_ptr;
using std::istringstream;
using std::istream_iterator;
using std::vector;
@ -73,9 +72,9 @@ InsetMathArray::InsetMathArray(docstring const & name, docstring const & str)
}
auto_ptr<Inset> InsetMathArray::doClone() const
Inset * InsetMathArray::clone() const
{
return auto_ptr<Inset>(new InsetMathArray(*this));
return new InsetMathArray(*this);
}

View File

@ -50,7 +50,7 @@ public:
///
void validate(LaTeXFeatures & features) const;
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
///
docstring name_;
};

View File

@ -22,8 +22,6 @@
namespace lyx {
using std::auto_ptr;
InsetMathBig::InsetMathBig(docstring const & name, docstring const & delim)
: name_(name), delim_(delim)
@ -36,9 +34,9 @@ docstring InsetMathBig::name() const
}
auto_ptr<Inset> InsetMathBig::doClone() const
Inset * InsetMathBig::clone() const
{
return auto_ptr<Inset>(new InsetMathBig(*this));
return new InsetMathBig(*this);
}

View File

@ -40,7 +40,7 @@ public:
static bool isBigInsetDelim(docstring const &);
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
///
size_type size() const;
///

View File

@ -18,19 +18,14 @@
namespace lyx {
using std::max;
using std::auto_ptr;
InsetMathBinom::InsetMathBinom(bool choose)
: choose_(choose)
{}
auto_ptr<Inset> InsetMathBinom::doClone() const
Inset * InsetMathBinom::clone() const
{
return auto_ptr<Inset>(new InsetMathBinom(*this));
return new InsetMathBinom(*this);
}
@ -52,7 +47,7 @@ bool InsetMathBinom::metrics(MetricsInfo & mi, Dimension & dim) const
cell(1).metrics(mi);
dim.asc = cell(0).height() + 4 + 5;
dim.des = cell(1).height() + 4 - 5;
dim.wid = max(cell(0).width(), cell(1).width()) + 2 * dw() + 4;
dim.wid = std::max(cell(0).width(), cell(1).width()) + 2 * dw() + 4;
metricsMarkers2(dim);
bool const changed = dim_ != dim;
dim_ = dim;

View File

@ -37,7 +37,7 @@ public:
///
bool extraBraces() const;
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
///
int dw() const;
///

View File

@ -19,17 +19,14 @@
namespace lyx {
using std::auto_ptr;
InsetMathBoldSymbol::InsetMathBoldSymbol()
: InsetMathNest(1)
{}
auto_ptr<Inset> InsetMathBoldSymbol::doClone() const
Inset * InsetMathBoldSymbol::clone() const
{
return auto_ptr<Inset>(new InsetMathBoldSymbol(*this));
return new InsetMathBoldSymbol(*this);
}

View File

@ -38,7 +38,7 @@ public:
///
void infoize(odocstream & os) const;
private:
virtual std::auto_ptr<Inset> doClone() const;
virtual Inset * clone() const;
};

View File

@ -19,18 +19,14 @@
namespace lyx {
using std::string;
using std::auto_ptr;
InsetMathBox::InsetMathBox(docstring const & name)
: InsetMathNest(1), name_(name)
{}
auto_ptr<Inset> InsetMathBox::doClone() const
Inset * InsetMathBox::clone() const
{
return auto_ptr<Inset>(new InsetMathBox(*this));
return new InsetMathBox(*this);
}

Some files were not shown because too many files have changed in this diff Show More