mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
forgot this part...
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23890 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f182333311
commit
f8afb49165
@ -323,7 +323,7 @@ void Encoding::init() const
|
||||
}
|
||||
|
||||
|
||||
docstring const Encoding::latexChar(char_type c) const
|
||||
docstring Encoding::latexChar(char_type c) const
|
||||
{
|
||||
// assure the used encoding is properly initialized
|
||||
init();
|
||||
@ -337,26 +337,25 @@ docstring const Encoding::latexChar(char_type c) const
|
||||
CharInfoMap::const_iterator const it = unicodesymbols.find(c);
|
||||
if (it == unicodesymbols.end())
|
||||
throw EncodingException(c);
|
||||
else
|
||||
return it->second.command;
|
||||
return it->second.command;
|
||||
}
|
||||
|
||||
|
||||
set<char_type> Encoding::getSymbolsList() const
|
||||
vector<char_type> Encoding::symbolsList() const
|
||||
{
|
||||
// assure the used encoding is properly initialized
|
||||
init();
|
||||
|
||||
// first all encodable characters
|
||||
CharSet symbols = encodable_;
|
||||
vector<char_type> symbols(encodable_.begin(), encodable_.end());
|
||||
// add those below start_encodable_
|
||||
for (char_type c = 0; c < start_encodable_; ++c)
|
||||
symbols.insert(c);
|
||||
symbols.push_back(c);
|
||||
// now the ones from the unicodesymbols file
|
||||
CharInfoMap::const_iterator const end = unicodesymbols.end();
|
||||
CharInfoMap::const_iterator it = unicodesymbols.begin();
|
||||
for (; it != end; ++it)
|
||||
symbols.insert(it->first);
|
||||
symbols.push_back(it->first);
|
||||
return symbols;
|
||||
}
|
||||
|
||||
@ -404,13 +403,9 @@ bool Encodings::is_arabic(char_type c)
|
||||
}
|
||||
|
||||
|
||||
char_type Encodings::transformChar(char_type c,
|
||||
Encodings::Letter_Form form)
|
||||
char_type Encodings::transformChar(char_type c, Encodings::Letter_Form form)
|
||||
{
|
||||
if (!is_arabic(c))
|
||||
return c;
|
||||
|
||||
return arabic_table[c-arabic_start][form];
|
||||
return is_arabic(c) ? arabic_table[c-arabic_start][form] : c;
|
||||
}
|
||||
|
||||
|
||||
@ -557,11 +552,10 @@ void Encodings::read(FileName const & encfile, FileName const & symbolsfile)
|
||||
fixedwidth = true;
|
||||
else if (width == "variable")
|
||||
fixedwidth = false;
|
||||
else {
|
||||
else
|
||||
lex.printError("Encodings::read: "
|
||||
"Unknown width: `$$Token'");
|
||||
}
|
||||
|
||||
|
||||
lex.next();
|
||||
string const p = lex.getString();
|
||||
Encoding::Package package = Encoding::none;
|
||||
@ -571,15 +565,14 @@ void Encodings::read(FileName const & encfile, FileName const & symbolsfile)
|
||||
package = Encoding::inputenc;
|
||||
else if (p == "CJK")
|
||||
package = Encoding::CJK;
|
||||
else {
|
||||
else
|
||||
lex.printError("Encodings::read: "
|
||||
"Unknown package: `$$Token'");
|
||||
}
|
||||
|
||||
|
||||
LYXERR(Debug::INFO, "Reading encoding " << name);
|
||||
encodinglist[name] = Encoding(name, latexname,
|
||||
iconvname, fixedwidth,
|
||||
package);
|
||||
iconvname, fixedwidth, package);
|
||||
|
||||
if (lex.lex() != et_end)
|
||||
lex.printError("Encodings::read: "
|
||||
"missing end");
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
namespace lyx {
|
||||
|
||||
@ -67,11 +68,11 @@ public:
|
||||
* LaTeX macro is known, a warning is given of lyxerr, and the
|
||||
* character is returned.
|
||||
*/
|
||||
docstring const latexChar(char_type c) const;
|
||||
docstring latexChar(char_type c) const;
|
||||
/// Which LaTeX package handles this encoding?
|
||||
Package package() const { return package_; }
|
||||
/// A list of all characters usable in this encoding
|
||||
std::set<char_type> getSymbolsList() const;
|
||||
std::vector<char_type> symbolsList() const;
|
||||
private:
|
||||
///
|
||||
std::string Name_;
|
||||
|
@ -24,12 +24,9 @@
|
||||
#include "support/lyxalgo.h"
|
||||
#include "support/types.h"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include <functional>
|
||||
#include <istream>
|
||||
#include <stack>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
@ -45,7 +42,7 @@ namespace lyx {
|
||||
|
||||
|
||||
///
|
||||
class Lexer::Pimpl : boost::noncopyable {
|
||||
class Lexer::Pimpl {
|
||||
public:
|
||||
///
|
||||
Pimpl(keyword_item * tab, int num);
|
||||
@ -106,6 +103,10 @@ public:
|
||||
///
|
||||
char commentChar;
|
||||
private:
|
||||
/// non-copyable
|
||||
Pimpl(Pimpl const &);
|
||||
void operator=(Pimpl const &);
|
||||
|
||||
///
|
||||
void verifyTable();
|
||||
///
|
||||
@ -757,7 +758,8 @@ docstring const Lexer::getDocString() const
|
||||
// explicit tokens (JMarc)
|
||||
string const Lexer::getLongString(string const & endtoken)
|
||||
{
|
||||
string str, prefix;
|
||||
string str;
|
||||
string prefix;
|
||||
bool firstline = true;
|
||||
|
||||
while (pimpl_->is) { //< eatLine only reads from is, not from pushTok
|
||||
@ -775,7 +777,7 @@ string const Lexer::getLongString(string const & endtoken)
|
||||
|
||||
string tmpstr = getString();
|
||||
if (firstline) {
|
||||
string::size_type i(tmpstr.find_first_not_of(' '));
|
||||
size_t i = tmpstr.find_first_not_of(' ');
|
||||
if (i != string::npos)
|
||||
prefix = tmpstr.substr(0, i);
|
||||
firstline = false;
|
||||
@ -784,16 +786,14 @@ string const Lexer::getLongString(string const & endtoken)
|
||||
|
||||
// further lines in long strings may have the same
|
||||
// whitespace prefix as the first line. Remove it.
|
||||
if (prefix.length() && prefixIs(tmpstr, prefix)) {
|
||||
if (prefix.length() && prefixIs(tmpstr, prefix))
|
||||
tmpstr.erase(0, prefix.length() - 1);
|
||||
}
|
||||
|
||||
str += ltrim(tmpstr, "\t") + '\n';
|
||||
}
|
||||
|
||||
if (!pimpl_->is) {
|
||||
if (!pimpl_->is)
|
||||
printError("Long string not ended by `" + endtoken + '\'');
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
@ -926,12 +926,15 @@ Lexer & Lexer::operator>>(bool & s)
|
||||
}
|
||||
|
||||
|
||||
/// quotes a string, e.g. for use in preferences files or as an argument of the "log" dialog
|
||||
// quotes a string, e.g. for use in preferences files or as an argument
|
||||
// of the "log" dialog
|
||||
string const Lexer::quoteString(string const & arg)
|
||||
{
|
||||
ostringstream os;
|
||||
os << '"' << subst(subst(arg, "\\", "\\\\"), "\"", "\\\"") << '"';
|
||||
return os.str();
|
||||
string res;
|
||||
res += '"';
|
||||
res += subst(subst(arg, "\\", "\\\\"), "\"", "\\\"");
|
||||
res += '"';
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user