mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Compare commits
6 Commits
54601b5578
...
a47d66df34
Author | SHA1 | Date | |
---|---|---|---|
|
a47d66df34 | ||
|
291d2db18e | ||
|
100075c890 | ||
|
951cb62f47 | ||
|
716e20ae1b | ||
|
3f5b836aa9 |
@ -341,6 +341,7 @@ public:
|
||||
Impl();
|
||||
|
||||
AuthorList authorlist;
|
||||
AuthorMap authormap;
|
||||
BranchList branchlist;
|
||||
WordLangTable spellignore;
|
||||
Bullet temp_bullets[4];
|
||||
@ -494,7 +495,7 @@ BufferParams::BufferParams()
|
||||
use_lineno = false;
|
||||
|
||||
// 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)
|
||||
{
|
||||
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
|
||||
typedef std::map<int, int> AuthorMap;
|
||||
AuthorMap author_map_;
|
||||
AuthorMap & authormap();
|
||||
AuthorMap const & authormap() const;
|
||||
|
||||
/// the buffer's active font encoding
|
||||
std::string const main_font_encoding() const;
|
||||
|
@ -594,7 +594,7 @@ void Text::readParToken(Paragraph & par, Lexer & lex,
|
||||
int aid;
|
||||
time_t ct;
|
||||
is >> aid >> ct;
|
||||
BufferParams::AuthorMap const & am = bp.author_map_;
|
||||
BufferParams::AuthorMap & am = bp.authormap();
|
||||
if (am.find(aid) == am.end()) {
|
||||
errorList.push_back(ErrorItem(
|
||||
_("Change tracking author index missing"),
|
||||
@ -609,9 +609,9 @@ void Text::readParToken(Paragraph & par, Lexer & lex,
|
||||
bp.addAuthor(Author(aid));
|
||||
}
|
||||
if (token == "\\change_inserted")
|
||||
change = Change(Change::INSERTED, am.find(aid)->second, ct);
|
||||
change = Change(Change::INSERTED, am[aid], ct);
|
||||
else
|
||||
change = Change(Change::DELETED, am.find(aid)->second, ct);
|
||||
change = Change(Change::DELETED, am[aid], ct);
|
||||
} else {
|
||||
lex.eatLine();
|
||||
errorList.push_back(ErrorItem(_("Unknown token"),
|
||||
|
@ -196,7 +196,7 @@ docstring InsetPrintNomencl::screenLabel() const
|
||||
|
||||
struct NomenclEntry {
|
||||
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)
|
||||
{}
|
||||
|
||||
|
@ -470,7 +470,7 @@ bool getTokenValue(string const & str, char const * token, Change & change, Buff
|
||||
"is incomplete. I will ignore this."));
|
||||
return false;
|
||||
}
|
||||
BufferParams::AuthorMap const & am = bp.author_map_;
|
||||
BufferParams::AuthorMap & am = bp.authormap();
|
||||
int aid = convert<int>(changedata[1]);
|
||||
if (am.find(aid) == am.end()) {
|
||||
// FIXME Use ErrorList
|
||||
@ -488,10 +488,10 @@ bool getTokenValue(string const & str, char const * token, Change & change, Buff
|
||||
time_t ct;
|
||||
is >> ct;
|
||||
if (changedata[0] == "inserted") {
|
||||
change = Change(Change::INSERTED, am.find(aid)->second, ct);
|
||||
change = Change(Change::INSERTED, am[aid], ct);
|
||||
return true;
|
||||
} else if (changedata[0] == "deleted") {
|
||||
change = Change(Change::DELETED, am.find(aid)->second, ct);
|
||||
change = Change(Change::DELETED, am[aid], ct);
|
||||
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)
|
||||
{
|
||||
int num = 1;
|
||||
is >> num;
|
||||
return (num == 0) ? 1 : num;
|
||||
return min(max(num, 1), 1000);
|
||||
}
|
||||
|
||||
|
||||
|
@ -176,28 +176,28 @@ ADD_FRAMEWORKS = \
|
||||
-Wl,-headerpad_max_install_names
|
||||
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_SOURCES = \
|
||||
tests/check_convert.cpp \
|
||||
tests/dummy_functions.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_SOURCES = \
|
||||
tests/check_filetools.cpp \
|
||||
tests/dummy_functions.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_SOURCES = \
|
||||
tests/check_lstrings.cpp \
|
||||
tests/dummy_functions.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_SOURCES = \
|
||||
tests/check_trivstring.cpp \
|
||||
|
@ -24,63 +24,63 @@ using namespace std;
|
||||
namespace lyx {
|
||||
|
||||
template<>
|
||||
string convert<string>(bool b)
|
||||
string convert<string>(bool const & b)
|
||||
{
|
||||
return (b ? "true" : "false");
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
string convert<string>(char c)
|
||||
string convert<string>(char const & c)
|
||||
{
|
||||
return string(1, c);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
string convert<string>(short unsigned int sui)
|
||||
string convert<string>(short unsigned int const & sui)
|
||||
{
|
||||
return to_string(sui);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
string convert<string>(int i)
|
||||
string convert<string>(int const & i)
|
||||
{
|
||||
return to_string(i);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
docstring convert<docstring>(int i)
|
||||
docstring convert<docstring>(int const & i)
|
||||
{
|
||||
return from_ascii(to_string(i));
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
string convert<string>(unsigned int ui)
|
||||
string convert<string>(unsigned int const & ui)
|
||||
{
|
||||
return to_string(ui);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
docstring convert<docstring>(unsigned int ui)
|
||||
docstring convert<docstring>(unsigned int const & ui)
|
||||
{
|
||||
return from_ascii(to_string(ui));
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
string convert<string>(unsigned long ul)
|
||||
string convert<string>(unsigned long const & ul)
|
||||
{
|
||||
return to_string(ul);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
docstring convert<docstring>(unsigned long ul)
|
||||
docstring convert<docstring>(unsigned long const & ul)
|
||||
{
|
||||
return from_ascii(to_string(ul));
|
||||
}
|
||||
@ -88,35 +88,35 @@ docstring convert<docstring>(unsigned long ul)
|
||||
|
||||
#ifdef HAVE_LONG_LONG_INT
|
||||
template<>
|
||||
string convert<string>(unsigned long long ull)
|
||||
string convert<string>(unsigned long long const & ull)
|
||||
{
|
||||
return to_string(ull);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
docstring convert<docstring>(unsigned long long ull)
|
||||
docstring convert<docstring>(unsigned long long const & ull)
|
||||
{
|
||||
return from_ascii(to_string(ull));
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
string convert<string>(long long ll)
|
||||
string convert<string>(long long const & ll)
|
||||
{
|
||||
return to_string(ll);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
docstring convert<docstring>(long long ll)
|
||||
docstring convert<docstring>(long long const & ll)
|
||||
{
|
||||
return from_ascii(to_string(ll));
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
@ -124,7 +124,7 @@ unsigned long long convert<unsigned long long>(string const s)
|
||||
|
||||
/* not presently needed
|
||||
template<>
|
||||
long long convert<long long>(string const s)
|
||||
long long convert<long long>(string const & s)
|
||||
{
|
||||
return strtoll(s.c_str(), nullptr, 10);
|
||||
}
|
||||
@ -133,21 +133,21 @@ long long convert<long long>(string const s)
|
||||
|
||||
|
||||
template<>
|
||||
string convert<string>(long l)
|
||||
string convert<string>(long const & l)
|
||||
{
|
||||
return to_string(l);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
docstring convert<docstring>(long l)
|
||||
docstring convert<docstring>(long const & l)
|
||||
{
|
||||
return from_ascii(to_string(l));
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
string convert<string>(float f)
|
||||
string convert<string>(float const & f)
|
||||
{
|
||||
ostringstream val;
|
||||
val << f;
|
||||
@ -156,7 +156,7 @@ string convert<string>(float f)
|
||||
|
||||
|
||||
template<>
|
||||
string convert<string>(double d)
|
||||
string convert<string>(double const & d)
|
||||
{
|
||||
ostringstream val;
|
||||
val << d;
|
||||
@ -165,14 +165,14 @@ string convert<string>(double d)
|
||||
|
||||
|
||||
template<>
|
||||
docstring convert<docstring>(double d)
|
||||
docstring convert<docstring>(double const & d)
|
||||
{
|
||||
return from_ascii(convert<string>(d));
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
int convert<int>(string const s)
|
||||
int convert<int>(string const & s)
|
||||
{
|
||||
return int(strtol(s.c_str(), nullptr, 10));
|
||||
}
|
||||
@ -185,28 +185,28 @@ int convert(string const & s, int base)
|
||||
|
||||
|
||||
template<>
|
||||
int convert<int>(docstring const s)
|
||||
int convert<int>(docstring const & s)
|
||||
{
|
||||
return int(strtol(to_ascii(s).c_str(), nullptr, 10));
|
||||
}
|
||||
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
unsigned long convert<unsigned long>(string const s)
|
||||
unsigned long convert<unsigned long>(string const & s)
|
||||
{
|
||||
return strtoul(s.c_str(), nullptr, 10);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
double convert<double>(string const s)
|
||||
double convert<double>(string const & s)
|
||||
{
|
||||
return strtod(s.c_str(), nullptr);
|
||||
}
|
||||
|
@ -21,36 +21,40 @@
|
||||
namespace lyx {
|
||||
|
||||
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>(char c);
|
||||
template<> std::string convert<std::string>(short unsigned int sui);
|
||||
template<> std::string convert<std::string>(int i);
|
||||
template<> docstring convert<docstring>(int i);
|
||||
template<> std::string convert<std::string>(unsigned int ui);
|
||||
template<> docstring convert<docstring>(unsigned int ui);
|
||||
template<> std::string convert<std::string>(unsigned long ul);
|
||||
template<> docstring convert<docstring>(unsigned long ul);
|
||||
template<> std::string convert<std::string>(bool const & b);
|
||||
template<> std::string convert<std::string>(char const & c);
|
||||
template<> std::string convert<std::string>(short unsigned int const & sui);
|
||||
template<> std::string convert<std::string>(int const & i);
|
||||
template<> docstring convert<docstring>(int const & i);
|
||||
template<> std::string convert<std::string>(unsigned int const & ui);
|
||||
template<> docstring convert<docstring>(unsigned int const & ui);
|
||||
template<> std::string convert<std::string>(unsigned long const & ul);
|
||||
template<> docstring convert<docstring>(unsigned long const & ul);
|
||||
#ifdef HAVE_LONG_LONG_INT
|
||||
template<> std::string convert<std::string>(unsigned long long ull);
|
||||
template<> docstring convert<docstring>(unsigned long long ull);
|
||||
template<> std::string convert<std::string>(long long ll);
|
||||
template<> docstring convert<docstring>(long long ll);
|
||||
template<> std::string convert<std::string>(unsigned long long const & ull);
|
||||
template<> docstring convert<docstring>(unsigned long long const & ull);
|
||||
template<> std::string convert<std::string>(long long const & ll);
|
||||
template<> docstring convert<docstring>(long long const & ll);
|
||||
template<> unsigned long long convert<unsigned long long>(std::string const & s);
|
||||
// not presently needed
|
||||
// template<> long long convert<long long>(std::string const & s);
|
||||
#endif
|
||||
template<> std::string convert<std::string>(long l);
|
||||
template<> docstring convert<docstring>(long l);
|
||||
template<> std::string convert<std::string>(float f);
|
||||
template<> std::string convert<std::string>(double d);
|
||||
template<> std::string convert<std::string>(long const & l);
|
||||
template<> docstring convert<docstring>(long const & l);
|
||||
template<> std::string convert<std::string>(float const & f);
|
||||
template<> std::string convert<std::string>(double const & d);
|
||||
template<> int convert<int>(std::string const & s);
|
||||
template<> int convert<int>(docstring const & s);
|
||||
template<> unsigned int convert<unsigned int>(std::string const & s);
|
||||
template<> unsigned long convert<unsigned long>(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<> double convert<double>(char const * cptr);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user