cit != edgepath.end(); ++cit) {
Converter const & conv = converterlist_[*cit];
bool dummy = conv.To->dummy() && conv.to != "program";
- if (!dummy)
+ if (!dummy) {
LYXERR(Debug::FILES) << "Converting from "
<< conv.from << " to " << conv.to << endl;
+ }
infile = outfile;
outfile = FileName(conv.result_dir.empty()
? changeExtension(from_file.absFilename(), conv.To->extension())
item->checksum = checksum;
}
if (!mover.copy(converted_file, item->cache_name,
- support::onlyFilename(item->cache_name.absFilename()), 0600))
+ support::onlyFilename(item->cache_name.absFilename()), 0600)) {
LYXERR(Debug::FILES) << "ConverterCache::add("
<< orig_from << "):\n"
"Could not copy file."
<< std::endl;
+ }
} else {
CacheItem new_item(orig_from, to_format, timestamp,
support::sum(orig_from));
data_.clear();
}
- bool const empty() const
+ bool empty() const
{
return data_.empty();
}
BOOST_ASSERT(!empty());
if (pos() == 0)
return 0;
- if (inMathed())
+ if (inMathed()) {
if (cell().empty())
// FIXME: this should not happen but it does.
// See bug 3189
return 0;
else
return prevAtom().nucleus();
+ }
return paragraph().isInset(pos() - 1) ? paragraph().getInset(pos() - 1) : 0;
}
#include <boost/filesystem/operations.hpp>
+using std::find_if;
using std::string;
using std::distance;
// The check only outputs a debug message, because it triggers
// a bug in compaq cxx 6.2, where is_open() returns 'true' for
// a fresh new filebuf. (JMarc)
- if (fb_.is_open() || istream::off_type(is.tellg()) > 0)
+ if (fb_.is_open() || istream::off_type(is.tellg()) > 0) {
LYXERR(Debug::LYXLEX) << "Error in Lexer::setFile: "
"file or stream already set." << endl;
+ }
fb_.open(filename.toFilesystemEncoding().c_str(), ios::in);
is.rdbuf(&fb_);
name = filename.absFilename();
void Lexer::Pimpl::setStream(istream & i)
{
- if (fb_.is_open() || istream::off_type(is.tellg()) > 0)
+ if (fb_.is_open() || istream::off_type(is.tellg()) > 0) {
LYXERR(Debug::LYXLEX) << "Error in Lexer::setStream: "
"file or stream already set." << endl;
+ }
is.rdbuf(i.rdbuf());
lineno = 0;
}
}
-Buffer const * const LyX::updateInset(Inset const * inset) const
+Buffer const * LyX::updateInset(Inset const * inset) const
{
if (quitting || !inset)
return 0;
/** redraw \c inset in all the BufferViews in which it is currently
* visible. If successful return a pointer to the owning Buffer.
*/
- Buffer const * const updateInset(Inset const *) const;
+ Buffer const * updateInset(Inset const *) const;
void hideDialogs(std::string const & name, Inset * inset) const;
using std::ostringstream;
-ParagraphMetrics::ParagraphMetrics(Paragraph const & par): par_(&par), position_(-1)
+ParagraphMetrics::ParagraphMetrics(Paragraph const & par): position_(-1), par_(&par)
{
}
Row::Row()
- : changed_(false), crc_(0), pos_(0), end_(0), separator(0), hfill(0),
- label_hfill(0), x(0), sel_beg(-1), sel_end(-1)
+ : separator(0), hfill(0), label_hfill(0), x(0),
+ sel_beg(-1), sel_end(-1), changed_(false), crc_(0), pos_(0), end_(0)
{}
Row::Row(pos_type pos)
- : changed_(false), crc_(0), pos_(pos), end_(0), separator(0), hfill(0),
- label_hfill(0), x(0), sel_beg(-1), sel_end(-1)
+ : separator(0), hfill(0), label_hfill(0), x(0),
+ sel_beg(-1), sel_end(-1), changed_(false), crc_(0), pos_(pos), end_(0)
{}
}
-void Row::dump(const char * s) const
+void Row::dump(char const * s) const
{
lyxerr << s << " pos: " << pos_ << " end: " << end_
<< " width: " << dim_.wid
int descent() const { return dim_.des; }
/// current debugging only
- void dump(const char * = "") const;
+ void dump(char const * = "") const;
/// width of a separator (i.e. space)
double separator;
pos_type sel_beg;
///
pos_type sel_end;
-
-
private:
/// has the Row appearance changed since last drawing?
bool changed_;
}
-int const TocItem::id() const
+int TocItem::id() const
{
return par_it_->id();
}
-int const TocItem::depth() const
+int TocItem::depth() const
{
return depth_;
}
///
~TocItem() {}
///
- int const id() const;
+ int id() const;
///
- int const depth() const;
+ int depth() const;
///
docstring const & str() const;
///
}
-Buffer const * const LyXView::updateInset(Inset const * inset)
+Buffer const * LyXView::updateInset(Inset const * inset)
{
WorkArea * work_area = currentWorkArea();
if (!work_area)
virtual ~LyXView();
- int const id() const { return id_; }
+ int id() const { return id_; }
virtual void close() = 0;
/** redraw \c inset in all the BufferViews in which it is currently
* visible. If successful return a pointer to the owning Buffer.
*/
- Buffer const * const updateInset(Inset const *);
+ Buffer const * updateInset(Inset const *);
/// returns true if this view has the focus.
virtual bool hasFocus() const = 0;
}
-static char const * const printState(ButtonPolicy::State const & state)
+static char const * printState(ButtonPolicy::State const & state)
{
switch (state) {
case ButtonPolicy::INITIAL:
}
-static char const * const printInput(ButtonPolicy::SMInput const & input)
+static char const * printInput(ButtonPolicy::SMInput const & input)
{
switch (input) {
case ButtonPolicy::SMI_VALID:
}
-biblio::CiteEngine const ControlCitation::getEngine() const
+biblio::CiteEngine ControlCitation::getEngine() const
{
return buffer().params().getEngine();
}
void filterByEntryType(
std::vector<docstring> & keyVector, docstring entryType);
///
- biblio::CiteEngine const getEngine() const;
+ biblio::CiteEngine getEngine() const;
/// \return information for this key.
docstring const getInfo(docstring const & key) const;
#include <sstream>
using std::ostringstream;
+using std::sort;
using std::string;
using std::vector;
{}
-bool ControlDocument::initialiseParams(std::string const &)
+bool ControlDocument::initialiseParams(string const &)
{
bp_.reset(new BufferParams);
*bp_ = buffer().params();
}
-string ControlDocument::getModuleDescription(string modName) const
+string ControlDocument::getModuleDescription(string const & modName) const
{
LyXModule const * const mod = moduleList[modName];
if (!mod)
}
-std::vector<std::string>
- ControlDocument::getPackageList(std::string modName) const {
+vector<string>
+ControlDocument::getPackageList(string const & modName) const
+{
LyXModule const * const mod = moduleList[modName];
- if (!mod)
- return std::vector<std::string>(); //empty such thing
+ if (!mod)
+ return vector<string>(); //empty such thing
return mod->packageList;
}
if (buffer().params().language == newL)
return;
- string const lang_name = newL->lang();
+ string const & lang_name = newL->lang();
dispatch(FuncRequest(LFUN_BUFFER_LANGUAGE, lang_name));
}
}
-bool const ControlDocument::isFontAvailable(std::string const & font) const
+bool ControlDocument::isFontAvailable(string const & font) const
{
if (font == "default" || font == "cmr"
|| font == "cmss" || font == "cmtt")
}
-bool const ControlDocument::providesOSF(std::string const & font) const
+bool ControlDocument::providesOSF(string const & font) const
{
if (font == "cmr")
return isFontAvailable("eco");
}
-bool const ControlDocument::providesSC(std::string const & font) const
+bool ControlDocument::providesSC(string const & font) const
{
if (font == "palatino")
return isFontAvailable("mathpazo");
}
-bool const ControlDocument::providesScale(std::string const & font) const
+bool ControlDocument::providesScale(string const & font) const
{
return (font == "helvet" || font == "luximono"
|| font == "berasans" || font == "beramono");
class TextClass;
namespace frontend {
-
+
///
typedef void const * BufferId;
///
/// Modules in use in current buffer
std::vector<std::string> const & getSelectedModules();
///
- std::string getModuleDescription(std::string modName) const;
+ std::string getModuleDescription(std::string const & modName) const;
///
- std::vector<std::string> getPackageList(std::string modName) const;
+ std::vector<std::string> getPackageList(std::string const & modName) const;
///
void setLanguage() const;
///
void saveAsDefault() const;
///
- bool const isFontAvailable(std::string const & font) const;
+ bool isFontAvailable(std::string const & font) const;
/// does this font provide Old Style figures?
- bool const providesOSF(std::string const & font) const;
+ bool providesOSF(std::string const & font) const;
/// does this font provide true Small Caps?
- bool const providesSC(std::string const & font) const;
+ bool providesSC(std::string const & font) const;
/// does this font provide size adjustment?
- bool const providesScale(std::string const & font) const;
+ bool providesScale(std::string const & font) const;
private:
///
void loadModuleNames();
}
-bool const ControlParagraph::haveMulitParSelection()
+bool ControlParagraph::haveMulitParSelection()
{
Cursor cur = bufferview()->cursor();
return cur.selection() && cur.selBegin().pit() != cur.selEnd().pit();
///
ParagraphParameters const & params() const;
///
- bool const haveMulitParSelection();
+ bool haveMulitParSelection();
///
bool inInset() const;
///
// We support less paper sizes than the document dialog
// Therefore this adjustment is needed.
-PAPER_SIZE const ControlPrefs::toPaperSize(int i) const
+PAPER_SIZE ControlPrefs::toPaperSize(int i) const
{
switch (i) {
case 0:
}
-int const ControlPrefs::fromPaperSize(PAPER_SIZE papersize) const
+int ControlPrefs::fromPaperSize(PAPER_SIZE papersize) const
{
switch (papersize) {
case PAPER_DEFAULT:
void updateScreenFonts();
/// adjust the prefs paper sizes
- PAPER_SIZE const toPaperSize(int i) const;
+ PAPER_SIZE toPaperSize(int i) const;
/// adjust the prefs paper sizes
- int const fromPaperSize(PAPER_SIZE papersize) const;
+ int fromPaperSize(PAPER_SIZE papersize) const;
private:
/// temporary lyxrc
using lyx::docstring;
+using std::find;
using std::vector;
using std::string;
using lyx::support::os::internal_path;
+using std::find;
+
#ifndef CXX_GLOBAL_CSTD
using std::floor;
#endif
using std::vector;
using std::string;
-
+using std::transform;
namespace lyx {
namespace frontend {
template<class Pair>
-std::vector<typename Pair::first_type> const
-getFirst(std::vector<Pair> const & pr)
+vector<typename Pair::first_type> const
+getFirst(vector<Pair> const & pr)
{
- std::vector<typename Pair::first_type> tmp(pr.size());
- std::transform(pr.begin(), pr.end(), tmp.begin(),
- boost::bind(&Pair::first, _1));
+ vector<typename Pair::first_type> tmp(pr.size());
+ transform(pr.begin(), pr.end(), tmp.begin(),
+ boost::bind(&Pair::first, _1));
return tmp;
}
///
template<class Pair>
-std::vector<typename Pair::second_type> const
-getSecond(std::vector<Pair> const & pr)
+vector<typename Pair::second_type> const
+getSecond(vector<Pair> const & pr)
{
- std::vector<typename Pair::second_type> tmp(pr.size());
- std::transform(pr.begin(), pr.end(), tmp.begin(),
- boost::bind(&Pair::second, _1));
+ vector<typename Pair::second_type> tmp(pr.size());
+ transform(pr.begin(), pr.end(), tmp.begin(),
+ boost::bind(&Pair::second, _1));
return tmp;
}
{
docstring const str =
controller().browse(qstring_to_ucs4(filename->text()));
- if(!str.empty()){
+ if (!str.empty()) {
filename->setText(toqstr(str));
embedCB->setCheckState(Qt::Unchecked);
changed();
#include "GuiGraphics_moc.cpp"
-
LYXERR(Debug::GRAPHICS)
<< "\nThe image loader can load the following directly:\n";
- if (qt_formats.empty())
+ if (qt_formats.empty()) {
LYXERR(Debug::GRAPHICS)
<< "\nQt4 Problem: No Format available!" << endl;
+ }
for (QList<QByteArray>::const_iterator it =qt_formats.begin(); it != qt_formats.end(); ++it) {
FormatList::const_iterator fbegin = fmts.begin();
FormatList::const_iterator fend = fmts.end();
for (FormatList::const_iterator fit = fbegin; fit != fend; ++fit) {
- if (fit != fbegin)
+ if (fit != fbegin) {
LYXERR(Debug::GRAPHICS) << ", ";
+ }
LYXERR(Debug::GRAPHICS) << *fit;
}
LYXERR(Debug::GRAPHICS) << '\n' << endl;
#include "debug.h"
+#include <climits>
+
#include <vector>
#include <string>
params.filename, from_format, to_format, el,
Converters::try_default | Converters::try_cache);
- if (!success)
+ if (!success) {
LYXERR(Debug::EXTERNAL)
<< "external::updateExternal. "
<< "Unable to convert from "
<< from_format << " to " << to_format << endl;
+ }
// return success
}
}
}
int i = InsetText::latex(buf, os, runparams);
- if (!layout_.latexname.empty())
+ if (!layout_.latexname.empty()) {
if (layout_.latextype == "command") {
os << "}";
} else if (layout_.latextype == "environment") {
os << "\n\\end{" << from_utf8(layout_.latexname) << "}\n";
i += 4;
}
+ }
return i;
}
namespace lyx {
-
+
// Implementation is in LyX.cpp
extern void dispatch(FuncRequest const & action);
using support::sum;
using std::endl;
+using std::find;
using std::string;
using std::istringstream;
using std::ostream;
incfile = mangled;
else if (!isValidLaTeXFilename(incfile)) {
frontend::Alert::warning(_("Invalid filename"),
- _("The following filename is likely to cause trouble "
+ _("The following filename is likely to cause trouble "
"when running the exported file through LaTeX: ") +
from_utf8(incfile));
}
Alert::warning(_("Different textclasses"), text);
//return 0;
}
-
+
// Make sure modules used in child are all included in master
//FIXME It might be worth loading the children's modules into the master
//over in BufferParams rather than doing this check.
vector<string>::const_iterator end = childModules.end();
for (; it != end; ++it) {
string const module = *it;
- vector<string>::const_iterator found =
+ vector<string>::const_iterator found =
find(masterModules.begin(), masterModules.end(), module);
if (found != masterModules.end()) {
docstring text = bformat(_("Included file `%1$s'\n"
"uses module `%2$s'\n"
"which is not used in parent file."),
- makeDisplayPath(included_file.absFilename()), from_utf8(module));
+ makeDisplayPath(included_file.absFilename()), from_utf8(module));
Alert::warning(_("Module not found"), text);
}
}
Toc & toc = toclist["listing"];
docstring const str = convert<docstring>(toc.size() + 1)
+ ". " + from_utf8(caption);
- // This inset does not have a valid ParConstIterator
+ // This inset does not have a valid ParConstIterator
// so it has to use the iterator of its parent paragraph
toc.push_back(TocItem(pit, 0, str));
}
}
-void InsetInclude::updateLabels(Buffer const & buffer,
+void InsetInclude::updateLabels(Buffer const & buffer,
ParIterator const &)
{
Buffer const * const childbuffer = getChildBuffer(buffer, params_);
if (params_.find(key) != params_.end())
// key=value,key=value1 is allowed in listings
// use key_, key__, key___ etc to avoid name conflict
- while (params_.find(keyname += '_') != params_.end());
+ while (params_.find(keyname += '_') != params_.end()) { }
// check onoff flag
// onoff parameter with value false
if (!par_validator)
row_type row = cellRow(cell);
while (--column &&
(cell_info[row][column].multicolumn ==
- Tabular::CELL_PART_OF_MULTICOLUMN));
+ Tabular::CELL_PART_OF_MULTICOLUMN)) { }
if (getAdditionalWidth(cell_info[row][column].cellno))
return false;
return rightLine(cell_info[row][column].cellno);
from_utf8(N_("Unknown tabular feature '%1$s'")), lyx::from_ascii(s)));
}
- status.setOnOff(s == "align-left" && halign(cur.col()) == 'l'
- || s == "align-right" && halign(cur.col()) == 'r'
- || s == "align-center" && halign(cur.col()) == 'c'
- || s == "valign-top" && valign() == 't'
- || s == "valign-bottom" && valign() == 'b'
- || s == "valign-middle" && valign() == 'm');
+ status.setOnOff((s == "align-left" && halign(cur.col()) == 'l')
+ || (s == "align-right" && halign(cur.col()) == 'r')
+ || (s == "align-center" && halign(cur.col()) == 'c')
+ || (s == "valign-top" && valign() == 't')
+ || (s == "valign-bottom" && valign() == 'b')
+ || (s == "valign-middle" && valign() == 'm'));
#if 0
// FIXME: What did this code do?
texrow.newline();
}
- if (par != paragraphs.end())
+ if (par != paragraphs.end()) {
LYXERR(Debug::LATEX) << "TeXEnvironment...done " << &*par << endl;
+ }
return par;
}
texrow.newline();
}
- if (boost::next(pit) != paragraphs.end())
+ if (boost::next(pit) != paragraphs.end()) {
LYXERR(Debug::LATEX) << "TeXOnePar...done " << &*boost::next(pit) << endl;
+ }
return ++pit;
}
#include "support/docstring.h"
+#include <cstring>
#include <vector>
* This does only exist because of performance reasons (a real conversion
* using iconv is too slow on windows).
*/
-inline char_type const qchar_to_ucs4(QChar const & qchar)
+inline char_type qchar_to_ucs4(QChar const & qchar)
{
BOOST_ASSERT(is_utf16(static_cast<char_type>(qchar.unicode())));
return static_cast<char_type>(qchar.unicode());
bool rename(FileName const & from, FileName const & to)
{
- if (::rename(from.toFilesystemEncoding().c_str(), to.toFilesystemEncoding().c_str()) == -1)
+ if (::rename(from.toFilesystemEncoding().c_str(), to.toFilesystemEncoding().c_str()) == -1) {
if (copy(from, to)) {
unlink(from);
return true;
} else
return false;
+ }
return true;
}
using std::vector;
using std::cerr;
using std::endl;
+using std::find;
using support::FileName;
using support::libFileSearch;
if (opts.empty())
return;
- for ( ; *what; ++what) {
+ for (; *what; ++what) {
vector<string>::iterator it = find(opts.begin(), opts.end(), *what);
if (it != opts.end()) {
//cerr << "### found option '" << *what << "'\n";