mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
Compare commits
6 Commits
54601b5578
...
a47d66df34
Author | SHA1 | Date | |
---|---|---|---|
|
a47d66df34 | ||
|
291d2db18e | ||
|
100075c890 | ||
|
951cb62f47 | ||
|
716e20ae1b | ||
|
3f5b836aa9 |
@ -341,6 +341,7 @@ public:
|
|||||||
Impl();
|
Impl();
|
||||||
|
|
||||||
AuthorList authorlist;
|
AuthorList authorlist;
|
||||||
|
AuthorMap authormap;
|
||||||
BranchList branchlist;
|
BranchList branchlist;
|
||||||
WordLangTable spellignore;
|
WordLangTable spellignore;
|
||||||
Bullet temp_bullets[4];
|
Bullet temp_bullets[4];
|
||||||
@ -494,7 +495,7 @@ BufferParams::BufferParams()
|
|||||||
use_lineno = false;
|
use_lineno = false;
|
||||||
|
|
||||||
// map current author
|
// map current author
|
||||||
author_map_[pimpl_->authorlist.get(0).bufferId()] = 0;
|
pimpl_->authormap[pimpl_->authorlist.get(0).bufferId()] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -578,9 +579,21 @@ AuthorList const & BufferParams::authors() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferParams::AuthorMap & BufferParams::authormap()
|
||||||
|
{
|
||||||
|
return pimpl_->authormap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferParams::AuthorMap const & BufferParams::authormap() const
|
||||||
|
{
|
||||||
|
return pimpl_->authormap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferParams::addAuthor(Author const & a)
|
void BufferParams::addAuthor(Author const & a)
|
||||||
{
|
{
|
||||||
author_map_[a.bufferId()] = pimpl_->authorlist.record(a);
|
pimpl_->authormap[a.bufferId()] = pimpl_->authorlist.record(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -494,7 +494,8 @@ public:
|
|||||||
|
|
||||||
/// map of the file's author IDs to AuthorList indexes
|
/// map of the file's author IDs to AuthorList indexes
|
||||||
typedef std::map<int, int> AuthorMap;
|
typedef std::map<int, int> AuthorMap;
|
||||||
AuthorMap author_map_;
|
AuthorMap & authormap();
|
||||||
|
AuthorMap const & authormap() const;
|
||||||
|
|
||||||
/// the buffer's active font encoding
|
/// the buffer's active font encoding
|
||||||
std::string const main_font_encoding() const;
|
std::string const main_font_encoding() const;
|
||||||
|
@ -594,7 +594,7 @@ void Text::readParToken(Paragraph & par, Lexer & lex,
|
|||||||
int aid;
|
int aid;
|
||||||
time_t ct;
|
time_t ct;
|
||||||
is >> aid >> ct;
|
is >> aid >> ct;
|
||||||
BufferParams::AuthorMap const & am = bp.author_map_;
|
BufferParams::AuthorMap & am = bp.authormap();
|
||||||
if (am.find(aid) == am.end()) {
|
if (am.find(aid) == am.end()) {
|
||||||
errorList.push_back(ErrorItem(
|
errorList.push_back(ErrorItem(
|
||||||
_("Change tracking author index missing"),
|
_("Change tracking author index missing"),
|
||||||
@ -609,9 +609,9 @@ void Text::readParToken(Paragraph & par, Lexer & lex,
|
|||||||
bp.addAuthor(Author(aid));
|
bp.addAuthor(Author(aid));
|
||||||
}
|
}
|
||||||
if (token == "\\change_inserted")
|
if (token == "\\change_inserted")
|
||||||
change = Change(Change::INSERTED, am.find(aid)->second, ct);
|
change = Change(Change::INSERTED, am[aid], ct);
|
||||||
else
|
else
|
||||||
change = Change(Change::DELETED, am.find(aid)->second, ct);
|
change = Change(Change::DELETED, am[aid], ct);
|
||||||
} else {
|
} else {
|
||||||
lex.eatLine();
|
lex.eatLine();
|
||||||
errorList.push_back(ErrorItem(_("Unknown token"),
|
errorList.push_back(ErrorItem(_("Unknown token"),
|
||||||
|
@ -196,7 +196,7 @@ docstring InsetPrintNomencl::screenLabel() const
|
|||||||
|
|
||||||
struct NomenclEntry {
|
struct NomenclEntry {
|
||||||
NomenclEntry() : par(nullptr) {}
|
NomenclEntry() : par(nullptr) {}
|
||||||
NomenclEntry(docstring s, docstring d, Paragraph const * p)
|
NomenclEntry(docstring const & s, docstring const & d, Paragraph const * p)
|
||||||
: symbol(s), desc(d), par(p)
|
: symbol(s), desc(d), par(p)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -470,7 +470,7 @@ bool getTokenValue(string const & str, char const * token, Change & change, Buff
|
|||||||
"is incomplete. I will ignore this."));
|
"is incomplete. I will ignore this."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
BufferParams::AuthorMap const & am = bp.author_map_;
|
BufferParams::AuthorMap & am = bp.authormap();
|
||||||
int aid = convert<int>(changedata[1]);
|
int aid = convert<int>(changedata[1]);
|
||||||
if (am.find(aid) == am.end()) {
|
if (am.find(aid) == am.end()) {
|
||||||
// FIXME Use ErrorList
|
// FIXME Use ErrorList
|
||||||
@ -488,10 +488,10 @@ bool getTokenValue(string const & str, char const * token, Change & change, Buff
|
|||||||
time_t ct;
|
time_t ct;
|
||||||
is >> ct;
|
is >> ct;
|
||||||
if (changedata[0] == "inserted") {
|
if (changedata[0] == "inserted") {
|
||||||
change = Change(Change::INSERTED, am.find(aid)->second, ct);
|
change = Change(Change::INSERTED, am[aid], ct);
|
||||||
return true;
|
return true;
|
||||||
} else if (changedata[0] == "deleted") {
|
} else if (changedata[0] == "deleted") {
|
||||||
change = Change(Change::DELETED, am.find(aid)->second, ct);
|
change = Change(Change::DELETED, am[aid], ct);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,11 +59,12 @@ static docstring verboseHLine(int n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// read a number to be used as an iteration count (limited arbitrary to 1000)
|
||||||
static int extractInt(istream & is)
|
static int extractInt(istream & is)
|
||||||
{
|
{
|
||||||
int num = 1;
|
int num = 1;
|
||||||
is >> num;
|
is >> num;
|
||||||
return (num == 0) ? 1 : num;
|
return min(max(num, 1), 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -176,28 +176,28 @@ ADD_FRAMEWORKS = \
|
|||||||
-Wl,-headerpad_max_install_names
|
-Wl,-headerpad_max_install_names
|
||||||
endif
|
endif
|
||||||
|
|
||||||
check_convert_LDADD = liblyxsupport.a $(LIBICONV) $(ZLIB_LIBS) $(QT_CORE_LIBS) $(LIBSHLWAPI) @LIBS@
|
check_convert_LDADD = liblyxsupport.a $(LIBICONV) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI) @LIBS@
|
||||||
check_convert_LDFLAGS = $(QT_CORE_LDFLAGS) $(ADD_FRAMEWORKS)
|
check_convert_LDFLAGS = $(QT_CORE_LDFLAGS) $(ADD_FRAMEWORKS)
|
||||||
check_convert_SOURCES = \
|
check_convert_SOURCES = \
|
||||||
tests/check_convert.cpp \
|
tests/check_convert.cpp \
|
||||||
tests/dummy_functions.cpp \
|
tests/dummy_functions.cpp \
|
||||||
tests/boost.cpp
|
tests/boost.cpp
|
||||||
|
|
||||||
check_filetools_LDADD = liblyxsupport.a $(LIBICONV) $(ZLIB_LIBS) $(QT_CORE_LIBS) $(LIBSHLWAPI) @LIBS@
|
check_filetools_LDADD = liblyxsupport.a $(LIBICONV) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI) @LIBS@
|
||||||
check_filetools_LDFLAGS = $(QT_CORE_LDFLAGS) $(ADD_FRAMEWORKS)
|
check_filetools_LDFLAGS = $(QT_CORE_LDFLAGS) $(ADD_FRAMEWORKS)
|
||||||
check_filetools_SOURCES = \
|
check_filetools_SOURCES = \
|
||||||
tests/check_filetools.cpp \
|
tests/check_filetools.cpp \
|
||||||
tests/dummy_functions.cpp \
|
tests/dummy_functions.cpp \
|
||||||
tests/boost.cpp
|
tests/boost.cpp
|
||||||
|
|
||||||
check_lstrings_LDADD = liblyxsupport.a $(LIBICONV) $(ZLIB_LIBS) $(QT_CORE_LIBS) $(LIBSHLWAPI) @LIBS@
|
check_lstrings_LDADD = liblyxsupport.a $(LIBICONV) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI) @LIBS@
|
||||||
check_lstrings_LDFLAGS = $(QT_CORE_LDFLAGS) $(ADD_FRAMEWORKS)
|
check_lstrings_LDFLAGS = $(QT_CORE_LDFLAGS) $(ADD_FRAMEWORKS)
|
||||||
check_lstrings_SOURCES = \
|
check_lstrings_SOURCES = \
|
||||||
tests/check_lstrings.cpp \
|
tests/check_lstrings.cpp \
|
||||||
tests/dummy_functions.cpp \
|
tests/dummy_functions.cpp \
|
||||||
tests/boost.cpp
|
tests/boost.cpp
|
||||||
|
|
||||||
check_trivstring_LDADD = liblyxsupport.a $(LIBICONV) $(ZLIB_LIBS) $(QT_CORE_LIBS) $(LIBSHLWAPI) @LIBS@
|
check_trivstring_LDADD = liblyxsupport.a $(LIBICONV) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI) @LIBS@
|
||||||
check_trivstring_LDFLAGS = $(QT_CORE_LDFLAGS) $(ADD_FRAMEWORKS)
|
check_trivstring_LDFLAGS = $(QT_CORE_LDFLAGS) $(ADD_FRAMEWORKS)
|
||||||
check_trivstring_SOURCES = \
|
check_trivstring_SOURCES = \
|
||||||
tests/check_trivstring.cpp \
|
tests/check_trivstring.cpp \
|
||||||
|
@ -24,63 +24,63 @@ using namespace std;
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
string convert<string>(bool b)
|
string convert<string>(bool const & b)
|
||||||
{
|
{
|
||||||
return (b ? "true" : "false");
|
return (b ? "true" : "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
string convert<string>(char c)
|
string convert<string>(char const & c)
|
||||||
{
|
{
|
||||||
return string(1, c);
|
return string(1, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
string convert<string>(short unsigned int sui)
|
string convert<string>(short unsigned int const & sui)
|
||||||
{
|
{
|
||||||
return to_string(sui);
|
return to_string(sui);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
string convert<string>(int i)
|
string convert<string>(int const & i)
|
||||||
{
|
{
|
||||||
return to_string(i);
|
return to_string(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
docstring convert<docstring>(int i)
|
docstring convert<docstring>(int const & i)
|
||||||
{
|
{
|
||||||
return from_ascii(to_string(i));
|
return from_ascii(to_string(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
string convert<string>(unsigned int ui)
|
string convert<string>(unsigned int const & ui)
|
||||||
{
|
{
|
||||||
return to_string(ui);
|
return to_string(ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
docstring convert<docstring>(unsigned int ui)
|
docstring convert<docstring>(unsigned int const & ui)
|
||||||
{
|
{
|
||||||
return from_ascii(to_string(ui));
|
return from_ascii(to_string(ui));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
string convert<string>(unsigned long ul)
|
string convert<string>(unsigned long const & ul)
|
||||||
{
|
{
|
||||||
return to_string(ul);
|
return to_string(ul);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
docstring convert<docstring>(unsigned long ul)
|
docstring convert<docstring>(unsigned long const & ul)
|
||||||
{
|
{
|
||||||
return from_ascii(to_string(ul));
|
return from_ascii(to_string(ul));
|
||||||
}
|
}
|
||||||
@ -88,35 +88,35 @@ docstring convert<docstring>(unsigned long ul)
|
|||||||
|
|
||||||
#ifdef HAVE_LONG_LONG_INT
|
#ifdef HAVE_LONG_LONG_INT
|
||||||
template<>
|
template<>
|
||||||
string convert<string>(unsigned long long ull)
|
string convert<string>(unsigned long long const & ull)
|
||||||
{
|
{
|
||||||
return to_string(ull);
|
return to_string(ull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
docstring convert<docstring>(unsigned long long ull)
|
docstring convert<docstring>(unsigned long long const & ull)
|
||||||
{
|
{
|
||||||
return from_ascii(to_string(ull));
|
return from_ascii(to_string(ull));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
string convert<string>(long long ll)
|
string convert<string>(long long const & ll)
|
||||||
{
|
{
|
||||||
return to_string(ll);
|
return to_string(ll);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
docstring convert<docstring>(long long ll)
|
docstring convert<docstring>(long long const & ll)
|
||||||
{
|
{
|
||||||
return from_ascii(to_string(ll));
|
return from_ascii(to_string(ll));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
unsigned long long convert<unsigned long long>(string const s)
|
unsigned long long convert<unsigned long long>(string const & s)
|
||||||
{
|
{
|
||||||
return strtoull(s.c_str(), nullptr, 10);
|
return strtoull(s.c_str(), nullptr, 10);
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ unsigned long long convert<unsigned long long>(string const s)
|
|||||||
|
|
||||||
/* not presently needed
|
/* not presently needed
|
||||||
template<>
|
template<>
|
||||||
long long convert<long long>(string const s)
|
long long convert<long long>(string const & s)
|
||||||
{
|
{
|
||||||
return strtoll(s.c_str(), nullptr, 10);
|
return strtoll(s.c_str(), nullptr, 10);
|
||||||
}
|
}
|
||||||
@ -133,21 +133,21 @@ long long convert<long long>(string const s)
|
|||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
string convert<string>(long l)
|
string convert<string>(long const & l)
|
||||||
{
|
{
|
||||||
return to_string(l);
|
return to_string(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
docstring convert<docstring>(long l)
|
docstring convert<docstring>(long const & l)
|
||||||
{
|
{
|
||||||
return from_ascii(to_string(l));
|
return from_ascii(to_string(l));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
string convert<string>(float f)
|
string convert<string>(float const & f)
|
||||||
{
|
{
|
||||||
ostringstream val;
|
ostringstream val;
|
||||||
val << f;
|
val << f;
|
||||||
@ -156,7 +156,7 @@ string convert<string>(float f)
|
|||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
string convert<string>(double d)
|
string convert<string>(double const & d)
|
||||||
{
|
{
|
||||||
ostringstream val;
|
ostringstream val;
|
||||||
val << d;
|
val << d;
|
||||||
@ -165,14 +165,14 @@ string convert<string>(double d)
|
|||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
docstring convert<docstring>(double d)
|
docstring convert<docstring>(double const & d)
|
||||||
{
|
{
|
||||||
return from_ascii(convert<string>(d));
|
return from_ascii(convert<string>(d));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
int convert<int>(string const s)
|
int convert<int>(string const & s)
|
||||||
{
|
{
|
||||||
return int(strtol(s.c_str(), nullptr, 10));
|
return int(strtol(s.c_str(), nullptr, 10));
|
||||||
}
|
}
|
||||||
@ -185,28 +185,28 @@ int convert(string const & s, int base)
|
|||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
int convert<int>(docstring const s)
|
int convert<int>(docstring const & s)
|
||||||
{
|
{
|
||||||
return int(strtol(to_ascii(s).c_str(), nullptr, 10));
|
return int(strtol(to_ascii(s).c_str(), nullptr, 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
unsigned int convert<unsigned int>(string const s)
|
unsigned int convert<unsigned int>(string const & s)
|
||||||
{
|
{
|
||||||
return static_cast<unsigned int>(strtoul(s.c_str(), nullptr, 10));
|
return static_cast<unsigned int>(strtoul(s.c_str(), nullptr, 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
unsigned long convert<unsigned long>(string const s)
|
unsigned long convert<unsigned long>(string const & s)
|
||||||
{
|
{
|
||||||
return strtoul(s.c_str(), nullptr, 10);
|
return strtoul(s.c_str(), nullptr, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
double convert<double>(string const s)
|
double convert<double>(string const & s)
|
||||||
{
|
{
|
||||||
return strtod(s.c_str(), nullptr);
|
return strtod(s.c_str(), nullptr);
|
||||||
}
|
}
|
||||||
|
@ -21,36 +21,40 @@
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
|
|
||||||
template <class Target, class Source>
|
template <class Target, class Source>
|
||||||
Target convert(Source arg);
|
Target convert(Source const & arg);
|
||||||
|
|
||||||
|
|
||||||
template<> std::string convert<std::string>(bool b);
|
template<> std::string convert<std::string>(bool const & b);
|
||||||
template<> std::string convert<std::string>(char c);
|
template<> std::string convert<std::string>(char const & c);
|
||||||
template<> std::string convert<std::string>(short unsigned int sui);
|
template<> std::string convert<std::string>(short unsigned int const & sui);
|
||||||
template<> std::string convert<std::string>(int i);
|
template<> std::string convert<std::string>(int const & i);
|
||||||
template<> docstring convert<docstring>(int i);
|
template<> docstring convert<docstring>(int const & i);
|
||||||
template<> std::string convert<std::string>(unsigned int ui);
|
template<> std::string convert<std::string>(unsigned int const & ui);
|
||||||
template<> docstring convert<docstring>(unsigned int ui);
|
template<> docstring convert<docstring>(unsigned int const & ui);
|
||||||
template<> std::string convert<std::string>(unsigned long ul);
|
template<> std::string convert<std::string>(unsigned long const & ul);
|
||||||
template<> docstring convert<docstring>(unsigned long ul);
|
template<> docstring convert<docstring>(unsigned long const & ul);
|
||||||
#ifdef HAVE_LONG_LONG_INT
|
#ifdef HAVE_LONG_LONG_INT
|
||||||
template<> std::string convert<std::string>(unsigned long long ull);
|
template<> std::string convert<std::string>(unsigned long long const & ull);
|
||||||
template<> docstring convert<docstring>(unsigned long long ull);
|
template<> docstring convert<docstring>(unsigned long long const & ull);
|
||||||
template<> std::string convert<std::string>(long long ll);
|
template<> std::string convert<std::string>(long long const & ll);
|
||||||
template<> docstring convert<docstring>(long long ll);
|
template<> docstring convert<docstring>(long long const & ll);
|
||||||
template<> unsigned long long convert<unsigned long long>(std::string const & s);
|
template<> unsigned long long convert<unsigned long long>(std::string const & s);
|
||||||
// not presently needed
|
// not presently needed
|
||||||
// template<> long long convert<long long>(std::string const & s);
|
// template<> long long convert<long long>(std::string const & s);
|
||||||
#endif
|
#endif
|
||||||
template<> std::string convert<std::string>(long l);
|
template<> std::string convert<std::string>(long const & l);
|
||||||
template<> docstring convert<docstring>(long l);
|
template<> docstring convert<docstring>(long const & l);
|
||||||
template<> std::string convert<std::string>(float f);
|
template<> std::string convert<std::string>(float const & f);
|
||||||
template<> std::string convert<std::string>(double d);
|
template<> std::string convert<std::string>(double const & d);
|
||||||
template<> int convert<int>(std::string const & s);
|
template<> int convert<int>(std::string const & s);
|
||||||
template<> int convert<int>(docstring const & s);
|
template<> int convert<int>(docstring const & s);
|
||||||
template<> unsigned int convert<unsigned int>(std::string const & s);
|
template<> unsigned int convert<unsigned int>(std::string const & s);
|
||||||
template<> unsigned long convert<unsigned long>(std::string const & s);
|
template<> unsigned long convert<unsigned long>(std::string const & s);
|
||||||
template<> double convert<double>(std::string const & s);
|
template<> double convert<double>(std::string const & s);
|
||||||
|
|
||||||
|
template <class Target>
|
||||||
|
Target convert(char const * arg);
|
||||||
|
|
||||||
template<> int convert<int>(char const * cptr);
|
template<> int convert<int>(char const * cptr);
|
||||||
template<> double convert<double>(char const * cptr);
|
template<> double convert<double>(char const * cptr);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user