+2004-01-07 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * text.C: reorder the using statements.
+ (translate_len): remove usage of a uninitialized variable.
+ (isLayout): make it adaptable and constify operator()
+ (findLayout): reformat slightly and dont use the same var for
+ different things.
+
2004-01-06 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* text.C: fix status tag output for ERT inset
#include <sstream>
#include <vector>
+using lyx::support::rtrim;
+using lyx::support::suffixIs;
+using lyx::support::contains;
+
using std::cerr;
using std::endl;
using std::string;
using std::vector;
-using lyx::support::rtrim;
-using lyx::support::suffixIs;
-using lyx::support::contains;
-
// thin wrapper around parse_text using a string
string parse_text(Parser & p, unsigned flags, const bool outer,
// a normal length
if (unit.empty() || unit[0] != '\\')
return true;
- const string::size_type i = unit.find(" ", i);
+ string::size_type const i = unit.find(' ');
string const endlen = (i == string::npos) ? string() : string(unit, i);
if (unit == "\\textwidth") {
valstring = percentval;
}
-struct isLayout {
+class isLayout : public std::unary_function<LyXLayout_ptr, bool> {
+public:
isLayout(string const name) : name_(name) {}
- bool operator()(LyXLayout_ptr const & ptr) {
- return ptr.get() && ptr->latexname() == name_;
+ bool operator()(LyXLayout_ptr const & ptr) const {
+ return ptr->latexname() == name_;
}
private:
string const name_;
LyXLayout_ptr findLayout(LyXTextClass const & textclass,
string const & name)
{
- LyXTextClass::const_iterator it = textclass.begin();
+ LyXTextClass::const_iterator beg = textclass.begin();
LyXTextClass::const_iterator end = textclass.end();
- it = std::find_if(it, end, isLayout(name));
+
+ LyXTextClass::const_iterator
+ it = std::find_if(beg, end, isLayout(name));
+
return (it == end) ? LyXLayout_ptr() : *it;
}