mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
cosmetics. mainly replace #include "dostring.h" by #include "strfwd.h"
in header files when possible. Adjust .cpp files. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21358 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f8147509ac
commit
a8cd9a4b8f
54
src/Author.h
54
src/Author.h
@ -15,65 +15,59 @@
|
||||
#include "support/docstring.h"
|
||||
|
||||
#include <map>
|
||||
#include <iosfwd>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
||||
class Author {
|
||||
public:
|
||||
///
|
||||
Author() {}
|
||||
|
||||
///
|
||||
Author(docstring const & name, docstring const & email)
|
||||
: name_(name), email_(email), used_(true) {}
|
||||
|
||||
docstring const name() const {
|
||||
return name_;
|
||||
}
|
||||
|
||||
docstring const email() const {
|
||||
return email_;
|
||||
}
|
||||
|
||||
void used(bool u) const {
|
||||
used_ = u;
|
||||
}
|
||||
|
||||
bool used() const {
|
||||
return used_;
|
||||
}
|
||||
|
||||
///
|
||||
docstring name() const { return name_; }
|
||||
///
|
||||
docstring email() const { return email_; }
|
||||
///
|
||||
void setUsed(bool u) const { used_ = u; }
|
||||
///
|
||||
bool used() const { return used_; }
|
||||
///
|
||||
friend std::istream & operator>>(std::istream & os, Author & a);
|
||||
|
||||
private:
|
||||
/// The author's name
|
||||
docstring name_;
|
||||
|
||||
/// The author's email address
|
||||
docstring email_;
|
||||
|
||||
///
|
||||
mutable bool used_;
|
||||
};
|
||||
|
||||
|
||||
class AuthorList {
|
||||
public:
|
||||
///
|
||||
AuthorList();
|
||||
|
||||
///
|
||||
int record(Author const & a);
|
||||
|
||||
///
|
||||
void record(int id, Author const & a);
|
||||
|
||||
///
|
||||
Author const & get(int id) const;
|
||||
|
||||
///
|
||||
typedef std::map<int, Author> Authors;
|
||||
|
||||
///
|
||||
Authors::const_iterator begin() const;
|
||||
|
||||
///
|
||||
Authors::const_iterator end() const;
|
||||
|
||||
///
|
||||
private:
|
||||
///
|
||||
int last_id_;
|
||||
|
||||
///
|
||||
Authors authors_;
|
||||
};
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "insets/InsetInclude.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
#include "support/docstream.h"
|
||||
|
||||
#include "boost/regex.hpp"
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "Bidi.h"
|
||||
#include "Buffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "Cursor.h"
|
||||
#include "Font.h"
|
||||
#include "Row.h"
|
||||
#include "LyXRC.h"
|
||||
@ -127,10 +128,11 @@ void Bidi::computeTables(Paragraph const & par,
|
||||
new_level = rtl_par ? 1 : 0;
|
||||
new_rtl0 = rtl_par;
|
||||
new_rtl = rtl_par;
|
||||
} else if (new_rtl0)
|
||||
} else if (new_rtl0) {
|
||||
new_level = new_rtl ? 1 : 2;
|
||||
else
|
||||
} else {
|
||||
new_level = rtl_par ? 2 : 0;
|
||||
}
|
||||
|
||||
if (is_space && new_level >= lev) {
|
||||
new_level = lev;
|
||||
@ -147,8 +149,9 @@ void Bidi::computeTables(Paragraph const & par,
|
||||
log2vis_list_[lpos - start_] = rtl ? -1 : 1;
|
||||
if (new_level > 0 && !rtl_par)
|
||||
same_direction_ = false;
|
||||
} else
|
||||
} else {
|
||||
log2vis_list_[lpos - start_] = new_rtl ? -1 : 1;
|
||||
}
|
||||
rtl = new_rtl;
|
||||
rtl0 = new_rtl0;
|
||||
levels_[lpos - start_] = new_level;
|
||||
|
@ -13,13 +13,14 @@
|
||||
#define BIDI_H
|
||||
|
||||
#include "support/types.h"
|
||||
#include "Cursor.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
class Buffer;
|
||||
class Cursor;
|
||||
class Paragraph;
|
||||
class Row;
|
||||
class Font;
|
||||
|
@ -12,7 +12,7 @@
|
||||
#ifndef BOX_H
|
||||
#define BOX_H
|
||||
|
||||
#include <iosfwd>
|
||||
#include "support/strfwd.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
@ -401,12 +401,15 @@ string Buffer::latexName(bool const no_path) const
|
||||
}
|
||||
|
||||
|
||||
pair<Buffer::LogType, string> Buffer::logName() const
|
||||
string Buffer::logName(LogType * type) const
|
||||
{
|
||||
string const filename = latexName(false);
|
||||
|
||||
if (filename.empty())
|
||||
return make_pair(Buffer::latexlog, string());
|
||||
if (filename.empty()) {
|
||||
if (type)
|
||||
*type = latexlog;
|
||||
return string();
|
||||
}
|
||||
|
||||
string const path = temppath();
|
||||
|
||||
@ -423,10 +426,14 @@ pair<Buffer::LogType, string> Buffer::logName() const
|
||||
if (bname.exists() &&
|
||||
(!fname.exists() || fname.lastModified() < bname.lastModified())) {
|
||||
LYXERR(Debug::FILES) << "Log name calculated as: " << bname << endl;
|
||||
return make_pair(Buffer::buildlog, bname.absFilename());
|
||||
if (type)
|
||||
*type = buildlog;
|
||||
return bname.absFilename();
|
||||
}
|
||||
LYXERR(Debug::FILES) << "Log name calculated as: " << fname << endl;
|
||||
return make_pair(Buffer::latexlog, fname.absFilename());
|
||||
if (type)
|
||||
*type = latexlog;
|
||||
return fname.absFilename();
|
||||
}
|
||||
|
||||
|
||||
@ -947,7 +954,7 @@ bool Buffer::write(ostream & ofs) const
|
||||
AuthorList::Authors::const_iterator a_it = params().authors().begin();
|
||||
AuthorList::Authors::const_iterator a_end = params().authors().end();
|
||||
for (; a_it != a_end; ++a_it)
|
||||
a_it->second.used(false);
|
||||
a_it->second.setUsed(false);
|
||||
|
||||
ParIterator const end = par_iterator_end();
|
||||
ParIterator it = par_iterator_begin();
|
||||
|
@ -15,13 +15,10 @@
|
||||
#include "insets/InsetCode.h"
|
||||
|
||||
#include "support/FileName.h"
|
||||
#include "support/docstring.h"
|
||||
#include "support/docstream.h"
|
||||
#include "support/strfwd.h"
|
||||
#include "support/types.h"
|
||||
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@ -252,7 +249,7 @@ public:
|
||||
std::string latexName(bool no_path = true) const;
|
||||
|
||||
/// Get thee name and type of the log.
|
||||
std::pair<LogType, std::string> logName() const;
|
||||
std::string logName(LogType * type = 0) const;
|
||||
|
||||
/// Change name of buffer. Updates "read-only" flag.
|
||||
void setFileName(std::string const & newfile);
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "insets/InsetListingsParams.h"
|
||||
|
||||
#include "support/convert.h"
|
||||
#include "support/docstream.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/Translator.h"
|
||||
#include "support/lstrings.h"
|
||||
|
@ -41,13 +41,11 @@ namespace lyx {
|
||||
|
||||
bool Change::isSimilarTo(Change const & change)
|
||||
{
|
||||
if (type != change.type) {
|
||||
if (type != change.type)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type == Change::UNCHANGED) {
|
||||
if (type == Change::UNCHANGED)
|
||||
return true;
|
||||
}
|
||||
|
||||
return author == change.author;
|
||||
}
|
||||
@ -55,17 +53,14 @@ bool Change::isSimilarTo(Change const & change)
|
||||
|
||||
bool operator==(Change const & l, Change const & r)
|
||||
{
|
||||
if (l.type != r.type) {
|
||||
if (l.type != r.type)
|
||||
return false;
|
||||
}
|
||||
|
||||
// two changes of type UNCHANGED are always equal
|
||||
if (l.type == Change::UNCHANGED) {
|
||||
if (l.type == Change::UNCHANGED)
|
||||
return true;
|
||||
}
|
||||
|
||||
return l.author == r.author &&
|
||||
l.changetime == r.changetime;
|
||||
return l.author == r.author && l.changetime == r.changetime;
|
||||
}
|
||||
|
||||
|
||||
@ -154,9 +149,8 @@ void Changes::set(Change const & change, pos_type const start, pos_type const en
|
||||
}
|
||||
|
||||
// new change precedes existing change
|
||||
if (it->range.start >= end) {
|
||||
if (it->range.start >= end)
|
||||
break;
|
||||
}
|
||||
|
||||
// new change intersects with existing change
|
||||
it->range.start = end;
|
||||
@ -179,13 +173,11 @@ void Changes::erase(pos_type const pos)
|
||||
|
||||
for (; it != end; ++it) {
|
||||
// range (pos,pos+x) becomes (pos,pos+x-1)
|
||||
if (it->range.start > pos) {
|
||||
if (it->range.start > pos)
|
||||
--(it->range.start);
|
||||
}
|
||||
// range (pos-x,pos) stays (pos-x,pos)
|
||||
if (it->range.end > pos) {
|
||||
if (it->range.end > pos)
|
||||
--(it->range.end);
|
||||
}
|
||||
}
|
||||
|
||||
merge();
|
||||
@ -204,14 +196,12 @@ void Changes::insert(Change const & change, lyx::pos_type pos)
|
||||
|
||||
for (; it != end; ++it) {
|
||||
// range (pos,pos+x) becomes (pos+1,pos+x+1)
|
||||
if (it->range.start >= pos) {
|
||||
if (it->range.start >= pos)
|
||||
++(it->range.start);
|
||||
}
|
||||
|
||||
// range (pos-x,pos) stays as it is
|
||||
if (it->range.end > pos) {
|
||||
if (it->range.end > pos)
|
||||
++(it->range.end);
|
||||
}
|
||||
}
|
||||
|
||||
set(change, pos, pos + 1); // set will call merge
|
||||
@ -362,7 +352,7 @@ void Changes::checkAuthors(AuthorList const & authorList)
|
||||
ChangeTable::const_iterator endit = table_.end();
|
||||
for ( ; it != endit ; ++it)
|
||||
if (it->change.type != Change::UNCHANGED)
|
||||
authorList.get(it->change.author).used(true);
|
||||
authorList.get(it->change.author).setUsed(true);
|
||||
}
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -15,7 +15,7 @@
|
||||
#ifndef CHANGES_H
|
||||
#define CHANGES_H
|
||||
|
||||
#include "support/docstream.h"
|
||||
#include "support/strfwd.h"
|
||||
#include "support/types.h"
|
||||
#include "support/lyxtime.h"
|
||||
|
||||
|
@ -14,11 +14,12 @@
|
||||
|
||||
#include "FuncRequest.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
#include "support/strfwd.h"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
@ -675,7 +675,7 @@ bool Cursor::openable(MathAtom const & t) const
|
||||
// we can't move into anything new during selection
|
||||
if (depth() >= anchor_.depth())
|
||||
return false;
|
||||
if (!ptr_cmp(t.nucleus(), &anchor_[depth()].inset()))
|
||||
if (t.nucleus() != &anchor_[depth()].inset())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Font.h"
|
||||
#include "Undo.h"
|
||||
|
||||
#include <iosfwd>
|
||||
#include <vector>
|
||||
|
||||
|
||||
|
@ -18,11 +18,9 @@
|
||||
#define CURSORSLICE_H
|
||||
|
||||
#include "support/types.h"
|
||||
#include "support/strfwd.h"
|
||||
#include "insets/Inset.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <iosfwd>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "CursorSlice.h"
|
||||
|
||||
#include <vector>
|
||||
#include <iosfwd>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
@ -25,14 +24,6 @@ class MathAtom;
|
||||
class Paragraph;
|
||||
|
||||
|
||||
// only needed for gcc 2.95, remove when support terminated
|
||||
template <typename A, typename B>
|
||||
bool ptr_cmp(A const * a, B const * b)
|
||||
{
|
||||
return a == b;
|
||||
}
|
||||
|
||||
|
||||
// The public inheritance should go in favour of a suitable data member
|
||||
// (or maybe private inheritance) at some point of time.
|
||||
class DocIterator // : public std::vector<CursorSlice>
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "ColorCode.h"
|
||||
#include "FontInfo.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
#include "support/strfwd.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
@ -31,7 +31,7 @@ class Paragraph;
|
||||
class TextMetrics;
|
||||
|
||||
|
||||
class FontIterator : std::iterator<std::forward_iterator_tag, Font>
|
||||
class FontIterator
|
||||
{
|
||||
public:
|
||||
///
|
||||
|
@ -17,8 +17,6 @@
|
||||
|
||||
#include "support/docstring.h"
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "LyXAction.h"
|
||||
#include "Lexer.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
#include "support/filetools.h"
|
||||
|
||||
#include <fstream>
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "frontends/KeyModifier.h"
|
||||
#include "frontends/KeySymbol.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
#include "support/strfwd.h"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
@ -19,8 +19,6 @@
|
||||
|
||||
#include "support/strfwd.h"
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
@ -652,7 +652,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
}
|
||||
}
|
||||
else if (name == "latexlog")
|
||||
enable = FileName(buf->logName().second).isFileReadable();
|
||||
enable = FileName(buf->logName()).isFileReadable();
|
||||
else if (name == "spellchecker")
|
||||
#if defined (USE_ASPELL) || defined (USE_ISPELL) || defined (USE_PSPELL)
|
||||
enable = !buf->isReadonly();
|
||||
@ -1456,9 +1456,9 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
if (!data.empty())
|
||||
lyx_view_->getDialogs().show("character", data);
|
||||
} else if (name == "latexlog") {
|
||||
pair<Buffer::LogType, string> const logfile =
|
||||
lyx_view_->buffer()->logName();
|
||||
switch (logfile.first) {
|
||||
Buffer::LogType type;
|
||||
string const logfile = lyx_view_->buffer()->logName(&type);
|
||||
switch (type) {
|
||||
case Buffer::latexlog:
|
||||
data = "latex ";
|
||||
break;
|
||||
@ -1466,7 +1466,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
data = "literate ";
|
||||
break;
|
||||
}
|
||||
data += Lexer::quoteString(logfile.second);
|
||||
data += Lexer::quoteString(logfile);
|
||||
lyx_view_->getDialogs().show("log", data);
|
||||
} else if (name == "vclog") {
|
||||
string const data = "vc " +
|
||||
|
@ -20,7 +20,8 @@
|
||||
|
||||
#include "paper.h"
|
||||
|
||||
#include <iosfwd>
|
||||
#include "support/strfwd.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
|
@ -72,8 +72,7 @@ class MenuNamesEqual : public std::unary_function<Menu, bool> {
|
||||
public:
|
||||
MenuNamesEqual(docstring const & name)
|
||||
: name_(name) {}
|
||||
bool operator()(Menu const & menu) const
|
||||
{
|
||||
bool operator()(Menu const & menu) const {
|
||||
return menu.name() == name_;
|
||||
}
|
||||
private:
|
||||
|
@ -160,8 +160,7 @@ public:
|
||||
///
|
||||
typedef ItemList::size_type size_type;
|
||||
///
|
||||
explicit Menu(docstring const & name = docstring())
|
||||
: name_(name) {}
|
||||
explicit Menu(docstring const & name = docstring()) : name_(name) {}
|
||||
/// Add the menu item unconditionally
|
||||
Menu & add(MenuItem const &);
|
||||
/// Checks the associated FuncRequest status before adding the
|
||||
@ -182,13 +181,9 @@ public:
|
||||
///
|
||||
bool hasFunc(FuncRequest const &) const;
|
||||
///
|
||||
const_iterator begin() const {
|
||||
return items_.begin();
|
||||
}
|
||||
const_iterator begin() const { return items_.begin(); }
|
||||
///
|
||||
const_iterator end() const {
|
||||
return items_.end();
|
||||
}
|
||||
const_iterator end() const { return items_.end(); }
|
||||
|
||||
// Check whether the menu shortcuts are unique
|
||||
void checkShortcuts() const;
|
||||
@ -247,21 +242,14 @@ public:
|
||||
void expand(Menu const & frommenu, Menu & tomenu,
|
||||
Buffer const *) const;
|
||||
///
|
||||
const_iterator begin() const {
|
||||
return menulist_.begin();
|
||||
}
|
||||
const_iterator begin() const { return menulist_.begin(); }
|
||||
///
|
||||
iterator begin() {
|
||||
return menulist_.begin();
|
||||
}
|
||||
iterator begin() { return menulist_.begin(); }
|
||||
///
|
||||
const_iterator end() const {
|
||||
return menulist_.end();
|
||||
}
|
||||
const_iterator end() const { return menulist_.end(); }
|
||||
///
|
||||
iterator end() {
|
||||
return menulist_.end();
|
||||
}
|
||||
iterator end() { return menulist_.end(); }
|
||||
|
||||
private:
|
||||
///
|
||||
MenuList menulist_;
|
||||
@ -277,4 +265,4 @@ extern MenuBackend menubackend;
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
#endif /* MENUBACKEND_H */
|
||||
#endif // MENUBACKEND_H
|
||||
|
@ -86,7 +86,7 @@ void PDFOptions::writeFile(ostream & os) const
|
||||
os << "\\pdf_quoted_options \"" << quoted_options << "\"\n";
|
||||
}
|
||||
|
||||
void PDFOptions::writeLaTeX(odocstringstream & os, bool hyper_required) const
|
||||
void PDFOptions::writeLaTeX(odocstream & os, bool hyper_required) const
|
||||
{
|
||||
if (!use_hyperref && !hyper_required)
|
||||
return;
|
||||
|
@ -12,7 +12,9 @@
|
||||
#ifndef PDFOPTIONS_H
|
||||
#define PDFOPTIONS_H
|
||||
|
||||
#include "support/docstream.h"
|
||||
#include "support/strfwd.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace lyx {
|
||||
|
||||
@ -28,7 +30,7 @@ public:
|
||||
/// output to lyx header
|
||||
void writeFile(std::ostream &) const;
|
||||
/// output to tex header
|
||||
void writeLaTeX(odocstringstream &, bool hyper_required) const;
|
||||
void writeLaTeX(odocstream &, bool hyper_required) const;
|
||||
/// read tokens from lyx header
|
||||
std::string readToken(Lexer &lex, std::string const & token);
|
||||
/// set implicit settings for hyperref
|
||||
|
@ -23,9 +23,6 @@
|
||||
|
||||
#include "support/strfwd.h"
|
||||
#include "support/types.h"
|
||||
// FIXME: would be nice to forward declare odocstream instead of
|
||||
// including this:
|
||||
#include "support/docstream.h"
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
@ -21,9 +21,6 @@
|
||||
#include "support/types.h"
|
||||
#include "support/docstring.h"
|
||||
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "tex2lyx/Spacing.h"
|
||||
#else
|
||||
|
||||
#include <iosfwd>
|
||||
#include "support/strfwd.h"
|
||||
#include <string>
|
||||
|
||||
|
||||
|
@ -63,6 +63,7 @@
|
||||
#include "insets/InsetSpecialChar.h"
|
||||
#include "insets/InsetTabular.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "support/textutils.h"
|
||||
#include "support/convert.h"
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include "ParIterator.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
#include "support/strfwd.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
@ -74,11 +74,10 @@ protected:
|
||||
///
|
||||
typedef std::vector<TocItem> Toc;
|
||||
typedef Toc::const_iterator TocIterator;
|
||||
|
||||
/// The ToC list.
|
||||
/// A class and no typedef because we want to forward declare it.
|
||||
class TocList : public std::map<std::string, Toc>
|
||||
{
|
||||
};
|
||||
class TocList : public std::map<std::string, Toc> {};
|
||||
|
||||
|
||||
///
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include "Paragraph.h"
|
||||
#include "TexRow.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
|
||||
#include <QTextCursor>
|
||||
#include <QTextDocument>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
@ -119,8 +119,10 @@ static TranslatorMap const build_translator()
|
||||
}
|
||||
|
||||
|
||||
Inset::Inset()
|
||||
{}
|
||||
docstring Inset::name() const
|
||||
{
|
||||
return from_ascii("unknown");
|
||||
}
|
||||
|
||||
|
||||
Dimension const Inset::dimension(BufferView const & bv) const
|
||||
|
@ -18,11 +18,8 @@
|
||||
#include "ColorCode.h"
|
||||
#include "InsetCode.h"
|
||||
|
||||
#include "Dimension.h"
|
||||
#include "support/strfwd.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace lyx {
|
||||
@ -34,6 +31,7 @@ class BufferView;
|
||||
class Change;
|
||||
class Cursor;
|
||||
class CursorSlice;
|
||||
class Dimension;
|
||||
class FuncRequest;
|
||||
class FuncStatus;
|
||||
class InsetIterator;
|
||||
@ -280,7 +278,7 @@ public:
|
||||
virtual bool hasFixedWidth() const { return false; }
|
||||
|
||||
///
|
||||
virtual docstring name() const { return from_ascii("unknown"); }
|
||||
virtual docstring name() const;
|
||||
///
|
||||
virtual InsetLayout const & getLayout(BufferParams const & bp) const;
|
||||
/// used to toggle insets
|
||||
@ -339,12 +337,12 @@ public:
|
||||
/// pit is the ParConstIterator of the paragraph containing the inset
|
||||
virtual void addToToc(TocList &, Buffer const &, ParConstIterator const &) const {}
|
||||
/// report files that can be embedded with the lyx file
|
||||
virtual void registerEmbeddedFiles(Buffer const &, EmbeddedFiles &) const {};
|
||||
virtual void registerEmbeddedFiles(Buffer const &, EmbeddedFiles &) const {}
|
||||
/// use embedded or external file after the embedding status of a file is changed
|
||||
virtual void updateEmbeddedFile(Buffer const &, EmbeddedFile const &) {}
|
||||
/// Fill keys with BibTeX information
|
||||
virtual void fillWithBibKeys(Buffer const &,
|
||||
BiblioInfo &, InsetIterator const &) const { return; }
|
||||
BiblioInfo &, InsetIterator const &) const {}
|
||||
/// Update the counters of this inset and of its contents
|
||||
virtual void updateLabels(Buffer const &, ParIterator const &) {}
|
||||
|
||||
@ -393,7 +391,7 @@ public:
|
||||
enum { TEXT_TO_INSET_OFFSET = 4 };
|
||||
|
||||
protected:
|
||||
Inset();
|
||||
Inset() {}
|
||||
|
||||
/// replicate ourselves
|
||||
friend class InsetList;
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include "support/lstrings.h"
|
||||
#include "support/std_ostream.h"
|
||||
#include "support/docstream.h"
|
||||
#include "support/convert.h"
|
||||
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "frontends/alert.h"
|
||||
|
||||
#include "support/ExceptionMessage.h"
|
||||
#include "support/docstream.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "support/lyxlib.h"
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "OutputParams.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
#include "support/docstream.h"
|
||||
#include "support/convert.h"
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "BufferParams.h"
|
||||
#include "MetricsInfo.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace lyx {
|
||||
|
||||
@ -58,8 +59,7 @@ void InsetFootlike::write(Buffer const & buf, std::ostream & os) const
|
||||
|
||||
bool InsetFootlike::insetAllowed(InsetCode code) const
|
||||
{
|
||||
if (code == FOOT_CODE || code == MARGIN_CODE
|
||||
|| code == FLOAT_CODE)
|
||||
if (code == FOOT_CODE || code == MARGIN_CODE || code == FLOAT_CODE)
|
||||
return false;
|
||||
return InsetCollapsable::insetAllowed(code);
|
||||
}
|
||||
|
@ -76,6 +76,7 @@ TODO
|
||||
#include "frontends/alert.h"
|
||||
|
||||
#include "support/convert.h"
|
||||
#include "support/docstream.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/lyxlib.h" // sum
|
||||
#include "support/lstrings.h"
|
||||
@ -449,7 +450,8 @@ docstring const InsetGraphics::createDocBookAttributes() const
|
||||
// Calculate the options part of the command, we must do it to a string
|
||||
// stream since we copied the code from createLatexParams() ;-)
|
||||
|
||||
// FIXME: av: need to translate spec -> Docbook XSL spec (http://www.sagehill.net/docbookxsl/ImageSizing.html)
|
||||
// FIXME: av: need to translate spec -> Docbook XSL spec
|
||||
// (http://www.sagehill.net/docbookxsl/ImageSizing.html)
|
||||
// Right now it only works with my version of db2latex :-)
|
||||
|
||||
odocstringstream options;
|
||||
|
@ -20,8 +20,7 @@
|
||||
#include "OutputParams.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include "support/std_ostream.h"
|
||||
#include "support/docstream.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
@ -88,7 +87,7 @@ int InsetHyperlink::latex(Buffer const &, odocstream & os,
|
||||
if (!url.empty()) {
|
||||
// the chars_url[] characters must be handled for both, url and href
|
||||
for (int k = 0; k < 2; k++) {
|
||||
for (int i = 0, pos;
|
||||
for (size_t i = 0, pos;
|
||||
(pos = url.find(chars_url[k], i)) != string::npos;
|
||||
i = pos + 2) {
|
||||
url.replace(pos,1,backslash + chars_url[k]);
|
||||
@ -104,14 +103,14 @@ int InsetHyperlink::latex(Buffer const &, odocstream & os,
|
||||
|
||||
// handle the "\" character, but only when the following character
|
||||
// is not also a "\", because "\\" is valid code
|
||||
for (int i = 0, pos;
|
||||
for (size_t i = 0, pos;
|
||||
(pos = name.find("\\", i)) != string::npos;
|
||||
i = pos + 2) {
|
||||
if (name[pos+1] != '\\')
|
||||
name.replace(pos,1,"\\textbackslash{}");
|
||||
}
|
||||
for (int k = 0; k < 6; k++) {
|
||||
for (int i = 0, pos;
|
||||
for (size_t i = 0, pos;
|
||||
(pos = name.find(chars_name[k], i)) != string::npos;
|
||||
i = pos + 2) {
|
||||
name.replace(pos,1,backslash + chars_name[k] + braces);
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "insets/RenderPreview.h"
|
||||
#include "insets/InsetListingsParams.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h" // contains
|
||||
#include "support/lyxalgo.h"
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include "MetricsInfo.h"
|
||||
#include "ParagraphParameters.h"
|
||||
#include "TextClassList.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "support/ExceptionMessage.h"
|
||||
|
||||
|
@ -13,12 +13,15 @@
|
||||
#include "InsetLine.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "Dimension.h"
|
||||
#include "Font.h"
|
||||
#include "MetricsInfo.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "OutputParams.h"
|
||||
#include "Text.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
|
||||
#include "frontends/Painter.h"
|
||||
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "Language.h"
|
||||
#include "MetricsInfo.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <sstream>
|
||||
@ -220,8 +221,7 @@ int InsetListings::latex(Buffer const & buf, odocstream & os,
|
||||
os << from_utf8(param_string) << "]\n";
|
||||
}
|
||||
lines += 4;
|
||||
os << code
|
||||
<< "\n\\end{lstlisting}\n\\endgroup\n";
|
||||
os << code << "\n\\end{lstlisting}\n\\endgroup\n";
|
||||
lines += 3;
|
||||
}
|
||||
|
||||
@ -296,7 +296,7 @@ bool InsetListings::showInsetDialog(BufferView * bv) const
|
||||
|
||||
|
||||
docstring InsetListings::getCaption(Buffer const & buf,
|
||||
OutputParams const & runparams) const
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
if (paragraphs().empty())
|
||||
return docstring();
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "InsetNewline.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "Dimension.h"
|
||||
#include "MetricsInfo.h"
|
||||
#include "OutputParams.h"
|
||||
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include "MetricsInfo.h"
|
||||
#include "sgml.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "MetricsInfo.h"
|
||||
#include "OutputParams.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
#include "support/Translator.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -15,6 +15,8 @@
|
||||
#include "debug.h"
|
||||
#include "gettext.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "frontends/FontMetrics.h"
|
||||
#include "frontends/Painter.h"
|
||||
|
||||
#include "support/docstring.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
|
||||
@ -59,23 +60,27 @@ char const * const quote_char = ",'`<>";
|
||||
// Index of chars used for the quote. Index is [side, language]
|
||||
int quote_index[2][6] = {
|
||||
{ 2, 1, 0, 0, 3, 4 }, // "'',,<>"
|
||||
{ 1, 1, 2, 1, 4, 3 } }; // "`'`'><"
|
||||
{ 1, 1, 2, 1, 4, 3 } // "`'`'><"
|
||||
};
|
||||
|
||||
// Corresponding LaTeX code, for double and single quotes.
|
||||
char const * const latex_quote_t1[2][5] =
|
||||
{ { "\\quotesinglbase ", "'", "`",
|
||||
char const * const latex_quote_t1[2][5] = {
|
||||
{ "\\quotesinglbase ", "'", "`",
|
||||
"\\guilsinglleft{}", "\\guilsinglright{}" },
|
||||
{ ",,", "''", "``", "<<", ">>" } };
|
||||
{ ",,", "''", "``", "<<", ">>" }
|
||||
};
|
||||
|
||||
char const * const latex_quote_ot1[2][5] =
|
||||
{ { "\\quotesinglbase ", "'", "`",
|
||||
char const * const latex_quote_ot1[2][5] = {
|
||||
{ "\\quotesinglbase ", "'", "`",
|
||||
"\\guilsinglleft{}", "\\guilsinglright{}" },
|
||||
{ "\\quotedblbase ", "''", "``",
|
||||
"\\guillemotleft{}", "\\guillemotright{}" } };
|
||||
"\\guillemotleft{}", "\\guillemotright{}" }
|
||||
};
|
||||
|
||||
char const * const latex_quote_babel[2][5] =
|
||||
{ { "\\glq ", "'", "`", "\\flq{}", "\\frq{}" },
|
||||
{ "\\glqq ", "''", "``", "\\flqq{}", "\\frqq{}" } };
|
||||
char const * const latex_quote_babel[2][5] = {
|
||||
{ "\\glq ", "'", "`", "\\flq{}", "\\frq{}" },
|
||||
{ "\\glqq ", "''", "``", "\\flqq{}", "\\frqq{}" }
|
||||
};
|
||||
|
||||
} // namespace anon
|
||||
|
||||
@ -106,11 +111,19 @@ InsetQuotes::InsetQuotes(char_type c, quote_language l, quote_times t)
|
||||
}
|
||||
|
||||
|
||||
docstring InsetQuotes::name() const
|
||||
{
|
||||
return from_ascii("Quotes");
|
||||
}
|
||||
|
||||
|
||||
void InsetQuotes::getPosition(char_type c)
|
||||
{
|
||||
// Decide whether left or right
|
||||
switch (c) {
|
||||
case ' ': case '(': case '[':
|
||||
case ' ':
|
||||
case '(':
|
||||
case '[':
|
||||
side_ = LeftQ; // left quote
|
||||
break;
|
||||
default:
|
||||
@ -201,14 +214,14 @@ docstring const InsetQuotes::dispString(Language const * loclang) const
|
||||
retdisp = docstring(1, 0x2018);
|
||||
#endif
|
||||
else
|
||||
retdisp = lyx::from_ascii(disp);
|
||||
retdisp = from_ascii(disp);
|
||||
|
||||
// in french, spaces are added inside double quotes
|
||||
if (times_ == DoubleQ && prefixIs(loclang->code(), "fr")) {
|
||||
if (side_ == LeftQ)
|
||||
retdisp += ' ';
|
||||
else
|
||||
retdisp.insert(docstring::size_type(0), 1, ' ');
|
||||
retdisp.insert(size_t(0), 1, ' ');
|
||||
}
|
||||
|
||||
return retdisp;
|
||||
@ -355,7 +368,7 @@ void InsetQuotes::validate(LaTeXFeatures & features) const
|
||||
&& lyxrc.fontenc != "T1") {
|
||||
if (times_ == SingleQ)
|
||||
switch (type) {
|
||||
case ',': features.require("quotesinglbase"); break;
|
||||
case ',': features.require("quotesinglbase"); break;
|
||||
case '<': features.require("guilsinglleft"); break;
|
||||
case '>': features.require("guilsinglright"); break;
|
||||
default: break;
|
||||
|
@ -67,14 +67,13 @@ public:
|
||||
\item etc.
|
||||
\end{itemize}
|
||||
*/
|
||||
explicit
|
||||
InsetQuotes(std::string const & str = "eld");
|
||||
explicit InsetQuotes(std::string const & str = "eld");
|
||||
/// Create the right quote inset after character c
|
||||
InsetQuotes(char_type c, BufferParams const & params);
|
||||
/// Direct access to inner/outer quotation marks
|
||||
InsetQuotes(char_type c, quote_language l, quote_times t);
|
||||
///
|
||||
docstring name() const { return from_ascii("Quotes"); }
|
||||
docstring name() const;
|
||||
///
|
||||
void metrics(MetricsInfo &, Dimension &) const;
|
||||
///
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "OutputParams.h"
|
||||
#include "sgml.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
|
||||
|
@ -64,14 +64,14 @@ public:
|
||||
///
|
||||
static bool isCompatibleCommand(std::string const & s);
|
||||
protected:
|
||||
///
|
||||
InsetRef(InsetRef const &);
|
||||
|
||||
///
|
||||
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
|
||||
private:
|
||||
virtual Inset * clone() const {
|
||||
return new InsetRef(*this);
|
||||
}
|
||||
///
|
||||
Inset * clone() const { return new InsetRef(*this); }
|
||||
///
|
||||
bool isLatex;
|
||||
};
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "InsetSpace.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "Dimension.h"
|
||||
#include "Lexer.h"
|
||||
#include "MetricsInfo.h"
|
||||
#include "OutputParams.h"
|
||||
@ -48,8 +49,7 @@ InsetSpace::Kind InsetSpace::kind() const
|
||||
|
||||
void InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
frontend::FontMetrics const & fm =
|
||||
theFontMetrics(mi.base.font);
|
||||
frontend::FontMetrics const & fm = theFontMetrics(mi.base.font);
|
||||
dim.asc = fm.maxAscent();
|
||||
dim.des = fm.maxDescent();
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "InsetSpecialChar.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "Dimension.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "Lexer.h"
|
||||
#include "MetricsInfo.h"
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "TextMetrics.h"
|
||||
|
||||
#include "support/convert.h"
|
||||
#include "support/docstream.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include "frontends/alert.h"
|
||||
@ -3068,7 +3069,7 @@ void InsetTabular::drawSelection(PainterInfo & pi, int x, int y) const
|
||||
|
||||
if (!cur.selection())
|
||||
return;
|
||||
if (!ptr_cmp(&cur.inset(), this))
|
||||
if (&cur.inset() != this)
|
||||
return;
|
||||
|
||||
//resetPos(cur);
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "Buffer.h"
|
||||
#include "Cursor.h"
|
||||
#include "Dimension.h"
|
||||
#include "DispatchResult.h"
|
||||
#include "FuncRequest.h"
|
||||
#include "gettext.h"
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "TocBackend.h"
|
||||
|
||||
#include "support/convert.h"
|
||||
#include "support/docstream.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
@ -16,7 +16,7 @@
|
||||
#ifndef LFUNS_H
|
||||
#define LFUNS_H
|
||||
|
||||
#include <iosfwd>
|
||||
#include "support/strfwd.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "InsetMathComment.h"
|
||||
#include "InsetMathDelim.h"
|
||||
#include "InsetMathHull.h"
|
||||
//#include "InsetMathMBox.h"
|
||||
#include "InsetMathRef.h"
|
||||
#include "InsetMathScript.h"
|
||||
#include "InsetMathSpace.h"
|
||||
@ -111,7 +110,7 @@ void InsetMathNest::cursorPos(BufferView const & bv,
|
||||
// to touch all (math)inset's draw() methods. Right now, we'll store
|
||||
// absolute value, and make them here relative, only to make them
|
||||
// absolute again when actually drawing the cursor. What a mess.
|
||||
BOOST_ASSERT(ptr_cmp(&sl.inset(), this));
|
||||
BOOST_ASSERT(&sl.inset() == this);
|
||||
MathData const & ar = sl.cell();
|
||||
CoordCache const & coord_cache = bv.coordCache();
|
||||
if (!coord_cache.getArrays().has(&ar)) {
|
||||
@ -156,7 +155,7 @@ void InsetMathNest::metrics(MetricsInfo const & mi) const
|
||||
|
||||
bool InsetMathNest::idxNext(Cursor & cur) const
|
||||
{
|
||||
BOOST_ASSERT(ptr_cmp(&cur.inset(), this));
|
||||
BOOST_ASSERT(&cur.inset() == this);
|
||||
if (cur.idx() == cur.lastidx())
|
||||
return false;
|
||||
++cur.idx();
|
||||
@ -173,7 +172,7 @@ bool InsetMathNest::idxRight(Cursor & cur) const
|
||||
|
||||
bool InsetMathNest::idxPrev(Cursor & cur) const
|
||||
{
|
||||
BOOST_ASSERT(ptr_cmp(&cur.inset(), this));
|
||||
BOOST_ASSERT(&cur.inset() == this);
|
||||
if (cur.idx() == 0)
|
||||
return false;
|
||||
--cur.idx();
|
||||
@ -190,7 +189,7 @@ bool InsetMathNest::idxLeft(Cursor & cur) const
|
||||
|
||||
bool InsetMathNest::idxFirst(Cursor & cur) const
|
||||
{
|
||||
BOOST_ASSERT(ptr_cmp(&cur.inset(), this));
|
||||
BOOST_ASSERT(&cur.inset() == this);
|
||||
if (nargs() == 0)
|
||||
return false;
|
||||
cur.idx() = 0;
|
||||
@ -201,7 +200,7 @@ bool InsetMathNest::idxFirst(Cursor & cur) const
|
||||
|
||||
bool InsetMathNest::idxLast(Cursor & cur) const
|
||||
{
|
||||
BOOST_ASSERT(ptr_cmp(&cur.inset(), this));
|
||||
BOOST_ASSERT(&cur.inset() == this);
|
||||
if (nargs() == 0)
|
||||
return false;
|
||||
cur.idx() = cur.lastidx();
|
||||
@ -242,7 +241,7 @@ void InsetMathNest::drawSelection(PainterInfo & pi, int x, int y) const
|
||||
Cursor & cur = bv.cursor();
|
||||
if (!cur.selection())
|
||||
return;
|
||||
if (!ptr_cmp(&cur.inset(), this))
|
||||
if (&cur.inset() != this)
|
||||
return;
|
||||
|
||||
// FIXME: hack to get position cache warm
|
||||
|
@ -13,7 +13,7 @@
|
||||
#ifndef OUTPUT_DOCBOOK_H
|
||||
#define OUTPUT_DOCBOOK_H
|
||||
|
||||
#include "support/docstream.h"
|
||||
#include "support/strfwd.h"
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#ifndef OUTPUT_PLAINTEXT_H
|
||||
#define OUTPUT_PLAINTEXT_H
|
||||
|
||||
#include "support/docstream.h"
|
||||
#include "support/strfwd.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
25
src/pch.h
25
src/pch.h
@ -1,31 +1,6 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <boost/any.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/crc.hpp>
|
||||
#include <boost/cregex.hpp>
|
||||
#include <boost/current_function.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/iterator/indirect_iterator.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/scoped_array.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/tokenizer.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/version.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cerrno>
|
||||
#include <clocale>
|
||||
#include <cmath>
|
||||
#include <csignal>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <deque>
|
||||
#include <exception>
|
||||
#include <fstream>
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "OutputParams.h"
|
||||
#include "Paragraph.h"
|
||||
|
||||
#include "support/docstring.h"
|
||||
#include "support/docstream.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "support/std_ostream.h"
|
||||
#include "support/convert.h"
|
||||
|
@ -14,12 +14,7 @@
|
||||
#define SGML_H
|
||||
|
||||
#include "support/types.h"
|
||||
#include "support/docstream.h"
|
||||
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "support/docstring.h"
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
@ -22,6 +22,70 @@ namespace lyx {
|
||||
/// String type for storing the main text in UCS4 encoding
|
||||
typedef std::basic_string<char_type> docstring;
|
||||
|
||||
/// Creates a docstring from a C string of ASCII characters
|
||||
docstring const from_ascii(char const *);
|
||||
|
||||
/// Creates a docstring from a std::string of ASCII characters
|
||||
docstring const from_ascii(std::string const &);
|
||||
|
||||
/// Creates a std::string of ASCII characters from a docstring
|
||||
std::string const to_ascii(docstring const &);
|
||||
|
||||
/// Creates a docstring from a UTF8 string. This should go eventually.
|
||||
docstring const from_utf8(std::string const &);
|
||||
|
||||
/// Creates a UTF8 string from a docstring. This should go eventually.
|
||||
std::string const to_utf8(docstring const &);
|
||||
|
||||
/// convert \p s from the encoding of the locale to ucs4.
|
||||
docstring const from_local8bit(std::string const & s);
|
||||
|
||||
/**
|
||||
* Convert \p s from ucs4 to the encoding of the locale.
|
||||
* This may fail and throw an exception, the caller is expected to act
|
||||
* appropriately.
|
||||
*/
|
||||
std::string const to_local8bit(docstring const & s);
|
||||
|
||||
/// convert \p s from the encoding of the file system to ucs4.
|
||||
docstring const from_filesystem8bit(std::string const & s);
|
||||
|
||||
/// convert \p s from ucs4 to the encoding of the file system.
|
||||
std::string const to_filesystem8bit(docstring const & s);
|
||||
|
||||
/// normalize \p s to precomposed form c
|
||||
docstring const normalize_c(docstring const & s);
|
||||
|
||||
/// Compare a docstring with a C string of ASCII characters
|
||||
bool operator==(docstring const &, char const *);
|
||||
|
||||
/// Compare a C string of ASCII characters with a docstring
|
||||
inline bool operator==(char const * l, docstring const & r) { return r == l; }
|
||||
|
||||
/// Compare a docstring with a C string of ASCII characters
|
||||
inline bool operator!=(docstring const & l, char const * r) { return !(l == r); }
|
||||
|
||||
/// Compare a C string of ASCII characters with a docstring
|
||||
inline bool operator!=(char const * l, docstring const & r) { return !(r == l); }
|
||||
|
||||
/// Concatenate a docstring and a C string of ASCII characters
|
||||
docstring operator+(docstring const &, char const *);
|
||||
|
||||
/// Concatenate a C string of ASCII characters and a docstring
|
||||
docstring operator+(char const *, docstring const &);
|
||||
|
||||
/// Concatenate a docstring and a single ASCII character
|
||||
docstring operator+(docstring const & l, char r);
|
||||
|
||||
/// Concatenate a single ASCII character and a docstring
|
||||
docstring operator+(char l, docstring const & r);
|
||||
|
||||
/// Append a C string of ASCII characters to a docstring
|
||||
docstring & operator+=(docstring &, char const *);
|
||||
|
||||
/// Append a single ASCII character to a docstring
|
||||
docstring & operator+=(docstring & l, char r);
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "support/environment.h"
|
||||
|
||||
#include "support/docstring.h"
|
||||
#include "support/os.h"
|
||||
|
||||
#include <boost/tokenizer.hpp>
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "support/lyxlib.h"
|
||||
#include "support/docstring.h"
|
||||
#include "support/os.h"
|
||||
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
@ -13,21 +13,6 @@
|
||||
#ifndef STRFWD_H
|
||||
#define STRFWD_H
|
||||
|
||||
namespace std {
|
||||
|
||||
template<typename Char> struct char_traits;
|
||||
template<> struct char_traits<char>;
|
||||
template<> struct char_traits<wchar_t>;
|
||||
|
||||
template<typename Alloc> class allocator;
|
||||
|
||||
template<typename Char, typename Traits, typename Alloc> class basic_string;
|
||||
|
||||
typedef basic_string<char, char_traits<char>, allocator<char> > string;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_WCHAR_T
|
||||
|
||||
// Prefer this if possible because GNU libstdc++ has usable
|
||||
@ -44,74 +29,40 @@ namespace lyx { typedef boost::uint32_t char_type; }
|
||||
#endif
|
||||
|
||||
|
||||
namespace std {
|
||||
|
||||
template<typename Char> struct char_traits;
|
||||
template<> struct char_traits<char>;
|
||||
template<> struct char_traits<wchar_t>;
|
||||
|
||||
template<typename Alloc> class allocator;
|
||||
|
||||
template<typename Char, typename Traits, typename Alloc> class basic_string;
|
||||
|
||||
typedef basic_string<char, char_traits<char>, allocator<char> > string;
|
||||
|
||||
template<class Char, class Traits> class basic_istream;
|
||||
template<class Char, class Traits> class basic_ostream;
|
||||
|
||||
typedef basic_istream<char, char_traits<char> > istream;
|
||||
typedef basic_ostream<char, char_traits<char> > ostream;
|
||||
|
||||
}
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
typedef std::basic_string<char_type, std::char_traits<char_type>,
|
||||
std::allocator<char_type> > docstring;
|
||||
|
||||
/// Creates a docstring from a C string of ASCII characters
|
||||
docstring const from_ascii(char const *);
|
||||
/// Base class for UCS4 input streams
|
||||
typedef std::basic_istream<char_type, std::char_traits<char_type> >
|
||||
idocstream;
|
||||
|
||||
/// Creates a docstring from a std::string of ASCII characters
|
||||
docstring const from_ascii(std::string const &);
|
||||
/// Base class for UCS4 output streams
|
||||
typedef std::basic_ostream<char_type, std::char_traits<char_type> >
|
||||
odocstream;
|
||||
|
||||
/// Creates a std::string of ASCII characters from a docstring
|
||||
std::string const to_ascii(docstring const &);
|
||||
|
||||
/// Creates a docstring from a UTF8 string. This should go eventually.
|
||||
docstring const from_utf8(std::string const &);
|
||||
|
||||
/// Creates a UTF8 string from a docstring. This should go eventually.
|
||||
std::string const to_utf8(docstring const &);
|
||||
|
||||
/// convert \p s from the encoding of the locale to ucs4.
|
||||
docstring const from_local8bit(std::string const & s);
|
||||
|
||||
/**
|
||||
* Convert \p s from ucs4 to the encoding of the locale.
|
||||
* This may fail and throw an exception, the caller is expected to act
|
||||
* appropriately.
|
||||
*/
|
||||
std::string const to_local8bit(docstring const & s);
|
||||
|
||||
/// convert \p s from the encoding of the file system to ucs4.
|
||||
docstring const from_filesystem8bit(std::string const & s);
|
||||
|
||||
/// convert \p s from ucs4 to the encoding of the file system.
|
||||
std::string const to_filesystem8bit(docstring const & s);
|
||||
|
||||
/// normalize \p s to precomposed form c
|
||||
docstring const normalize_c(docstring const & s);
|
||||
|
||||
/// Compare a docstring with a C string of ASCII characters
|
||||
bool operator==(docstring const &, char const *);
|
||||
|
||||
/// Compare a C string of ASCII characters with a docstring
|
||||
inline bool operator==(char const * l, docstring const & r) { return r == l; }
|
||||
|
||||
/// Compare a docstring with a C string of ASCII characters
|
||||
inline bool operator!=(docstring const & l, char const * r) { return !(l == r); }
|
||||
|
||||
/// Compare a C string of ASCII characters with a docstring
|
||||
inline bool operator!=(char const * l, docstring const & r) { return !(r == l); }
|
||||
|
||||
/// Concatenate a docstring and a C string of ASCII characters
|
||||
docstring operator+(docstring const &, char const *);
|
||||
|
||||
/// Concatenate a C string of ASCII characters and a docstring
|
||||
docstring operator+(char const *, docstring const &);
|
||||
|
||||
/// Concatenate a docstring and a single ASCII character
|
||||
docstring operator+(docstring const & l, char r);
|
||||
|
||||
/// Concatenate a single ASCII character and a docstring
|
||||
docstring operator+(char l, docstring const & r);
|
||||
|
||||
/// Append a C string of ASCII characters to a docstring
|
||||
docstring & operator+=(docstring &, char const *);
|
||||
|
||||
/// Append a single ASCII character to a docstring
|
||||
docstring & operator+=(docstring & l, char r);
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "support/userinfo.h"
|
||||
#include "support/environment.h"
|
||||
#include "support/docstring.h"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
@ -44,7 +45,7 @@ docstring const user_name()
|
||||
return _("Unknown user");
|
||||
return from_local8bit(name);
|
||||
#else
|
||||
struct passwd * pw(getpwuid(geteuid()));
|
||||
struct passwd * pw = getpwuid(geteuid());
|
||||
BOOST_ASSERT(pw);
|
||||
|
||||
string name = pw->pw_gecos;
|
||||
|
Loading…
Reference in New Issue
Block a user