mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Get rid of the boost::shared_ptr's in TextClass.{h,cpp}. It's not clear what these were really doing here now, and they will cause bugs now that DocumentClass objects are more dynamic.
Abdel suggested it might be worth pimpl'ing the FloatList and Counter objects, to get the header dependencies back down. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23530 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2222b3f367
commit
ac6e5b871c
@ -37,6 +37,8 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "boost/assert.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace lyx::support;
|
||||
|
||||
@ -114,8 +116,6 @@ InsetLayout DocumentClass::empty_insetlayout_;
|
||||
|
||||
TextClass::TextClass()
|
||||
{
|
||||
floatlist_ = boost::shared_ptr<FloatList>(new FloatList);
|
||||
counters_ = boost::shared_ptr<Counters>(new Counters);
|
||||
outputType_ = LATEX;
|
||||
columns_ = 1;
|
||||
sides_ = OneSide;
|
||||
@ -470,7 +470,7 @@ bool TextClass::read(FileName const & filename, ReadType rt)
|
||||
case TC_NOFLOAT:
|
||||
if (lexrc.next()) {
|
||||
string const nofloat = lexrc.getString();
|
||||
floatlist_->erase(nofloat);
|
||||
floatlist_.erase(nofloat);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -712,8 +712,8 @@ void TextClass::readFloat(Lexer & lexrc)
|
||||
case FT_TYPE:
|
||||
lexrc.next();
|
||||
type = lexrc.getString();
|
||||
if (floatlist_->typeExist(type)) {
|
||||
Floating const & fl = floatlist_->getType(type);
|
||||
if (floatlist_.typeExist(type)) {
|
||||
Floating const & fl = floatlist_.getType(type);
|
||||
placement = fl.placement();
|
||||
ext = fl.ext();
|
||||
within = fl.within();
|
||||
@ -763,13 +763,13 @@ void TextClass::readFloat(Lexer & lexrc)
|
||||
if (getout) {
|
||||
Floating fl(type, placement, ext, within,
|
||||
style, name, listName, builtin);
|
||||
floatlist_->newFloat(fl);
|
||||
floatlist_.newFloat(fl);
|
||||
// each float has its own counter
|
||||
counters_->newCounter(from_ascii(type), from_ascii(within),
|
||||
counters_.newCounter(from_ascii(type), from_ascii(within),
|
||||
docstring(), docstring());
|
||||
// also define sub-float counters
|
||||
docstring const subtype = "sub-" + from_ascii(type);
|
||||
counters_->newCounter(subtype, from_ascii(type),
|
||||
counters_.newCounter(subtype, from_ascii(type),
|
||||
"\\alph{" + subtype + "}", docstring());
|
||||
}
|
||||
|
||||
@ -816,7 +816,7 @@ void TextClass::readCounter(Lexer & lexrc)
|
||||
case CT_NAME:
|
||||
lexrc.next();
|
||||
name = lexrc.getDocString();
|
||||
if (counters_->hasCounter(name))
|
||||
if (counters_.hasCounter(name))
|
||||
LYXERR(Debug::TCLASS, "Reading existing counter " << to_utf8(name));
|
||||
else
|
||||
LYXERR(Debug::TCLASS, "Reading new counter " << to_utf8(name));
|
||||
@ -844,7 +844,7 @@ void TextClass::readCounter(Lexer & lexrc)
|
||||
|
||||
// Here if have a full counter if getout == true
|
||||
if (getout)
|
||||
counters_->newCounter(name, within,
|
||||
counters_.newCounter(name, within,
|
||||
labelstring, labelstring_appendix);
|
||||
|
||||
lexrc.popTable();
|
||||
@ -950,9 +950,11 @@ bool TextClass::load(string const & path) const
|
||||
InsetLayout const & DocumentClass::insetLayout(docstring const & name) const
|
||||
{
|
||||
docstring n = name;
|
||||
InsetLayouts::const_iterator cen = insetlayoutlist_.end();
|
||||
while (!n.empty()) {
|
||||
if (insetlayoutlist_.count(n) > 0)
|
||||
return insetlayoutlist_[n];
|
||||
InsetLayouts::const_iterator cit = insetlayoutlist_.lower_bound(n);
|
||||
if (cit != cen && cit->first == n)
|
||||
return cit->second;
|
||||
size_t i = n.find(':');
|
||||
if (i == string::npos)
|
||||
break;
|
||||
|
@ -11,6 +11,8 @@
|
||||
#define TEXTCLASS_H
|
||||
|
||||
#include "ColorCode.h"
|
||||
#include "Counters.h"
|
||||
#include "FloatList.h"
|
||||
#include "FontInfo.h"
|
||||
#include "Layout.h"
|
||||
#include "LayoutEnums.h"
|
||||
@ -21,7 +23,6 @@
|
||||
#include "support/types.h"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
@ -167,9 +168,9 @@ protected:
|
||||
/// document class description
|
||||
std::string description_;
|
||||
/// available types of float, eg. figure, algorithm.
|
||||
boost::shared_ptr<FloatList> floatlist_;
|
||||
mutable FloatList floatlist_;
|
||||
/// Types of counters, eg. sections, eqns, figures, avail. in document class.
|
||||
boost::shared_ptr<Counters> counters_;
|
||||
mutable Counters counters_;
|
||||
/// Has this layout file been loaded yet?
|
||||
mutable bool loaded_;
|
||||
/// Is the TeX class available?
|
||||
@ -219,7 +220,7 @@ protected:
|
||||
/// The name of the title command
|
||||
std::string titlename_;
|
||||
/// Input layouts available to this layout
|
||||
mutable InsetLayouts insetlayoutlist_;
|
||||
InsetLayouts insetlayoutlist_;
|
||||
/// The minimal TocLevel of sectioning layouts
|
||||
int min_toclevel_;
|
||||
/// The maximal TocLevel of sectioning layouts
|
||||
@ -269,7 +270,7 @@ public:
|
||||
/// A DocumentClass nevers count as loaded, since it is dynamic
|
||||
virtual bool loaded() { return false; }
|
||||
/// Inset layouts of this doc class
|
||||
InsetLayouts & insetLayouts() const { return insetlayoutlist_; };
|
||||
InsetLayouts const & insetLayouts() const { return insetlayoutlist_; };
|
||||
/// \return the layout object of an inset given by name. If the name
|
||||
/// is not found as such, the part after the ':' is stripped off, and
|
||||
/// searched again. In this way, an error fallback can be provided:
|
||||
@ -286,11 +287,10 @@ public:
|
||||
// accessors
|
||||
///////////////////////////////////////////////////////////////////
|
||||
/// the list of floats defined in the document class
|
||||
FloatList & floats() { return *floatlist_.get(); }
|
||||
/// the list of floats defined in the document class
|
||||
FloatList const & floats() const { return *floatlist_.get(); }
|
||||
/// The Counters present in this document class.
|
||||
Counters & counters() const { return *counters_.get(); }
|
||||
FloatList const & floats() const { return floatlist_; }
|
||||
///
|
||||
Counters & counters() const { return counters_; }
|
||||
///
|
||||
std::string const & opt_fontsize() const { return opt_fontsize_; }
|
||||
///
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include "support/convert.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
|
Loading…
Reference in New Issue
Block a user