#include "InsetBibitem.h"
-#include "debug.h"
-
-#include "Biblio.h"
#include "Buffer.h"
#include "BufferParams.h"
#include "BufferView.h"
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")
{
}
-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;
}
break;
}
if (p["key"] != params()["key"])
- cur.bv().buffer()->changeRefsIfUnique(params()["key"],
+ cur.bv().buffer().changeRefsIfUnique(params()["key"],
p["key"], Inset::CITE_CODE);
setParams(p);
}
{
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);
}
}
void InsetBibitem::fillWithBibKeys(Buffer const & buf,
- biblio::BibKeyList & keys, InsetIterator const & it) const
+ BiblioInfo & keys, InsetIterator const & it) const
{
- string const key = to_utf8(getParam("key"));
- biblio::BibTeXInfo keyvalmap;
+ docstring const key = getParam("key");
+ BibTeXInfo keyvalmap;
keyvalmap[from_ascii("label")] = getParam("label");
DocIterator doc_it(it);
doc_it.forwardPos();
- keyvalmap [from_ascii("ref")] = doc_it.paragraph().asString(buf, false);
+ keyvalmap[from_ascii("ref")] = doc_it.paragraph().asString(buf, false);
keyvalmap.isBibTeX = false;
keys[key] = keyvalmap;
}
/// Update the counters of this inset and of its contents
-void InsetBibitem::updateLabels(Buffer const &buf, ParIterator const & pit)
+void InsetBibitem::updateLabels(Buffer const &buf, ParIterator const &)
{
- lyxerr << "update! " << to_utf8(getParam("key")) << std::endl;
Counters & counters = buf.params().getTextClass().counters();
docstring const bibitem = from_ascii("bibitem");
if (counters.hasCounter(bibitem) && getParam("label").empty()) {