mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 12:32:26 +00:00
FindAdv: to please cppcheck ...
Initialize class elements Removed unused method Added 'explicit' keyword Optimize handling for sizes ( \tiny, \small, etc)
This commit is contained in:
parent
0b697d28e2
commit
187b518648
@ -1042,12 +1042,20 @@ class KeyInfo {
|
|||||||
KeyInfo()
|
KeyInfo()
|
||||||
: keytype(invalid),
|
: keytype(invalid),
|
||||||
head(""),
|
head(""),
|
||||||
|
_tokensize(-1),
|
||||||
|
_tokenstart(-1),
|
||||||
|
_dataStart(-1),
|
||||||
|
_dataEnd(-1),
|
||||||
parenthesiscount(1),
|
parenthesiscount(1),
|
||||||
disabled(false),
|
disabled(false),
|
||||||
used(false)
|
used(false)
|
||||||
{};
|
{};
|
||||||
KeyInfo(KeyType type, int parcount, bool disable)
|
KeyInfo(KeyType type, int parcount, bool disable)
|
||||||
: keytype(type),
|
: keytype(type),
|
||||||
|
_tokensize(-1),
|
||||||
|
_tokenstart(-1),
|
||||||
|
_dataStart(-1),
|
||||||
|
_dataEnd(-1),
|
||||||
parenthesiscount(parcount),
|
parenthesiscount(parcount),
|
||||||
disabled(disable),
|
disabled(disable),
|
||||||
used(false) {};
|
used(false) {};
|
||||||
@ -1073,7 +1081,10 @@ class Border {
|
|||||||
class Intervall {
|
class Intervall {
|
||||||
bool isPatternString;
|
bool isPatternString;
|
||||||
public:
|
public:
|
||||||
Intervall(bool isPattern) : isPatternString(isPattern), ignoreidx(-1), actualdeptindex(0) { depts[0] = 0;};
|
explicit Intervall(bool isPattern) :
|
||||||
|
isPatternString(isPattern),
|
||||||
|
ignoreidx(-1),
|
||||||
|
actualdeptindex(0) { depts[0] = 0; closes[0] = 0;};
|
||||||
string par;
|
string par;
|
||||||
int ignoreidx;
|
int ignoreidx;
|
||||||
int depts[MAXOPENED];
|
int depts[MAXOPENED];
|
||||||
@ -1255,7 +1266,7 @@ class LatexInfo {
|
|||||||
void removeHead(KeyInfo&, int count=0);
|
void removeHead(KeyInfo&, int count=0);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LatexInfo(string par, bool isPatternString) : interval(isPatternString) {
|
LatexInfo(string par, bool isPatternString) : entidx(-1), interval(isPatternString) {
|
||||||
interval.par = par;
|
interval.par = par;
|
||||||
buildKeys(isPatternString);
|
buildKeys(isPatternString);
|
||||||
entries = vector<KeyInfo>();
|
entries = vector<KeyInfo>();
|
||||||
@ -1343,16 +1354,6 @@ class MathInfo {
|
|||||||
m.mathSize = end - start;
|
m.mathSize = end - start;
|
||||||
entries.push_back(m);
|
entries.push_back(m);
|
||||||
}
|
}
|
||||||
bool evaluating(size_t pos) {
|
|
||||||
while (actualIdx < entries.size()) {
|
|
||||||
if (pos < entries[actualIdx].mathStart)
|
|
||||||
return false;
|
|
||||||
if (pos < entries[actualIdx].mathEnd)
|
|
||||||
return true;
|
|
||||||
actualIdx++;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
bool empty() { return entries.empty(); };
|
bool empty() { return entries.empty(); };
|
||||||
size_t getEndPos() {
|
size_t getEndPos() {
|
||||||
if (entries.empty() || (actualIdx >= entries.size())) {
|
if (entries.empty() || (actualIdx >= entries.size())) {
|
||||||
@ -1826,8 +1827,8 @@ void Intervall::output(ostringstream &os, int lastpos)
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
for (idx = 0; idx <= ignoreidx; idx++) {
|
for (idx = 0; idx <= ignoreidx; idx++) {
|
||||||
if (i < lastpos) {
|
if (i < lastpos) {
|
||||||
int printsize;
|
|
||||||
if (i <= borders[idx].low) {
|
if (i <= borders[idx].low) {
|
||||||
|
int printsize;
|
||||||
if (borders[idx].low > lastpos)
|
if (borders[idx].low > lastpos)
|
||||||
printsize = lastpos - i;
|
printsize = lastpos - i;
|
||||||
else
|
else
|
||||||
@ -1899,17 +1900,23 @@ int LatexInfo::dispatch(ostringstream &os, int previousStart, KeyInfo &actual)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case KeyInfo::isSize: {
|
case KeyInfo::isSize: {
|
||||||
if (actual.disabled || (interval.par[actual._dataStart] != '{')) {
|
if (actual.disabled || (interval.par[actual._dataStart] != '{') || (interval.par[actual._dataStart-1] == ' ')) {
|
||||||
processRegion(actual._dataEnd, actual._dataEnd+1); /* remove possibly following {} */
|
processRegion(actual._dataEnd, actual._dataEnd+1); /* remove possibly following {} */
|
||||||
interval.addIntervall(actual._tokenstart, actual._dataEnd+1);
|
interval.addIntervall(actual._tokenstart, actual._dataEnd+1);
|
||||||
nextKeyIdx = getNextKey();
|
nextKeyIdx = getNextKey();
|
||||||
} else {
|
} else {
|
||||||
// Determine the end if used like '{\tiny{}...}'
|
// Here _dataStart points to '{', so correct it
|
||||||
if (interval.par[actual._dataStart+1] == '}') {
|
actual._dataStart += 1;
|
||||||
actual._dataStart += 1;
|
actual._tokensize += 1;
|
||||||
interval.addIntervall(actual._dataStart, actual._dataStart+1);
|
actual.parenthesiscount = 1;
|
||||||
|
if (interval.par[actual._dataStart] == '}') {
|
||||||
|
// Determine the end if used like '{\tiny{}...}'
|
||||||
actual._dataEnd = interval.findclosing(actual._dataStart+1, interval.par.length()) + 1;
|
actual._dataEnd = interval.findclosing(actual._dataStart+1, interval.par.length()) + 1;
|
||||||
actual.parenthesiscount = 1;
|
interval.addIntervall(actual._dataStart, actual._dataStart+1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Determine the end if used like '\tiny{...}'
|
||||||
|
actual._dataEnd = interval.findclosing(actual._dataStart, interval.par.length()) + 1;
|
||||||
}
|
}
|
||||||
// Split on this key if not at start
|
// Split on this key if not at start
|
||||||
int start = interval.nextNotIgnored(previousStart);
|
int start = interval.nextNotIgnored(previousStart);
|
||||||
|
Loading…
Reference in New Issue
Block a user