]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_extern.C
Fix to bug 2362: Deleting superscript also deletes subscript.
[lyx.git] / src / mathed / math_extern.C
index 78dcf35092d3125db917b09073f5b4135b502107..28f961cbd26977fc5afd1ab04bc7312473e16ddd 100644 (file)
 #include "math_stringinset.h"
 #include "math_symbolinset.h"
 #include "math_parser.h"
-#include "support/std_sstream.h"
 #include "debug.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
 
 #include <algorithm>
+#include <sstream>
 
 using lyx::support::cmd_ret;
 using lyx::support::getVectorFromString;
@@ -148,7 +148,7 @@ string charSequence
 void extractStrings(MathArray & ar)
 {
        //lyxerr << "\nStrings from: " << ar << endl;
-       for (MathArray::size_type i = 0; i < ar.size(); ++i) {
+       for (size_t i = 0; i < ar.size(); ++i) {
                if (!ar[i]->asCharInset())
                        continue;
                string s = charSequence(ar.begin() + i, ar.end());
@@ -163,7 +163,7 @@ void extractMatrices(MathArray & ar)
 {
        //lyxerr << "\nMatrices from: " << ar << endl;
        // first pass for explicitly delimited stuff
-       for (MathArray::size_type i = 0; i < ar.size(); ++i) {
+       for (size_t i = 0; i < ar.size(); ++i) {
                if (!ar[i]->asDelimInset())
                        continue;
                MathArray const & arr = ar[i]->asDelimInset()->cell(0);
@@ -175,7 +175,7 @@ void extractMatrices(MathArray & ar)
        }
 
        // second pass for AMS "pmatrix" etc
-       for (MathArray::size_type i = 0; i < ar.size(); ++i)
+       for (size_t i = 0; i < ar.size(); ++i)
                if (ar[i]->asAMSArrayInset())
                        ar[i] = MathAtom(new MathMatrixInset(*(ar[i]->asGridInset())));
        //lyxerr << "\nMatrices to: " << ar << endl;
@@ -200,7 +200,7 @@ bool extractString(MathAtom const & at, string & str)
 // convert this inset somehow to a number
 bool extractNumber(MathArray const & ar, int & i)
 {
-       istringstream is(charSequence(ar.begin(), ar.end()).c_str());
+       istringstream is(charSequence(ar.begin(), ar.end()));
        is >> i;
        return is;
 }
@@ -208,7 +208,7 @@ bool extractNumber(MathArray const & ar, int & i)
 
 bool extractNumber(MathArray const & ar, double & d)
 {
-       istringstream is(charSequence(ar.begin(), ar.end()).c_str());
+       istringstream is(charSequence(ar.begin(), ar.end()));
        is >> d;
        return is;
 }
@@ -251,7 +251,7 @@ void replaceNested(
 {
        // use indices rather than iterators for the loop  because we are going
        // to modify the array.
-       for (MathArray::size_type i = 0; i < ar.size(); ++i) {
+       for (size_t i = 0; i < ar.size(); ++i) {
                // check whether this is the begin of the sequence
                if (!testOpen(ar[i]))
                        continue;
@@ -278,7 +278,7 @@ void replaceNested(
 void splitScripts(MathArray & ar)
 {
        //lyxerr << "\nScripts from: " << ar << endl;
-       for (MathArray::size_type i = 0; i < ar.size(); ++i) {
+       for (size_t i = 0; i < ar.size(); ++i) {
                // is this script inset?
                if (!ar[i]->asScriptInset())
                        continue;
@@ -310,7 +310,7 @@ void splitScripts(MathArray & ar)
 void extractExps(MathArray & ar)
 {
        //lyxerr << "\nExps from: " << ar << endl;
-       for (MathArray::size_type i = 0; i + 1 < ar.size(); ++i) {
+       for (size_t i = 0; i + 1 < ar.size(); ++i) {
                // is this 'e'?
                if (ar[i]->getChar() != 'e')
                        continue;
@@ -373,7 +373,7 @@ string digitSequence
 void extractNumbers(MathArray & ar)
 {
        //lyxerr << "\nNumbers from: " << ar << endl;
-       for (MathArray::size_type i = 0; i < ar.size(); ++i) {
+       for (size_t i = 0; i < ar.size(); ++i) {
                if (!ar[i]->asCharInset())
                        continue;
                if (!isDigitOrSimilar(ar[i]->asCharInset()->getChar()))
@@ -393,13 +393,13 @@ void extractNumbers(MathArray & ar)
 // search deliminiters
 //
 
-bool testOpenParan(MathAtom const & at)
+bool testOpenParen(MathAtom const & at)
 {
        return testString(at, "(");
 }
 
 
-bool testCloseParan(MathAtom const & at)
+bool testCloseParen(MathAtom const & at)
 {
        return testString(at, ")");
 }
@@ -415,7 +415,7 @@ MathAtom replaceDelims(const MathArray & ar)
 void extractDelims(MathArray & ar)
 {
        //lyxerr << "\nDelims from: " << ar << endl;
-       replaceNested(ar, testOpenParan, testCloseParan, replaceDelims);
+       replaceNested(ar, testOpenParen, testCloseParen, replaceDelims);
        //lyxerr << "\nDelims to: " << ar << endl;
 }
 
@@ -435,7 +435,7 @@ void extractFunctions(MathArray & ar)
                return;
 
        //lyxerr << "\nFunctions from: " << ar << endl;
-       for (MathArray::size_type i = 0; i + 1 < ar.size(); ++i) {
+       for (size_t i = 0; i + 1 < ar.size(); ++i) {
                MathArray::iterator it = ar.begin() + i;
                MathArray::iterator jt = it + 1;
 
@@ -526,7 +526,7 @@ void extractIntegrals(MathArray & ar)
                return;
 
        //lyxerr << "\nIntegrals from: " << ar << endl;
-       for (MathArray::size_type i = 0; i + 1 < ar.size(); ++i) {
+       for (size_t i = 0; i + 1 < ar.size(); ++i) {
                MathArray::iterator it = ar.begin() + i;
 
                // search 'd'
@@ -598,7 +598,7 @@ void extractSums(MathArray & ar)
                return;
 
        //lyxerr << "\nSums from: " << ar << endl;
-       for (MathArray::size_type i = 0; i + 1 < ar.size(); ++i) {
+       for (size_t i = 0; i + 1 < ar.size(); ++i) {
                MathArray::iterator it = ar.begin() + i;
 
                // is this a sum name?
@@ -670,7 +670,7 @@ bool testDiffFrac(MathAtom const & at)
 void extractDiff(MathArray & ar)
 {
        //lyxerr << "\nDiffs from: " << ar << endl;
-       for (MathArray::size_type i = 0; i < ar.size(); ++i) {
+       for (size_t i = 0; i < ar.size(); ++i) {
                MathArray::iterator it = ar.begin() + i;
 
                // is this a "differential fraction"?
@@ -760,7 +760,7 @@ void extractLims(MathArray & ar)
                return;
 
        //lyxerr << "\nLimits from: " << ar << endl;
-       for (MathArray::size_type i = 0; i + 2 < ar.size(); ++i) {
+       for (size_t i = 0; i + 2 < ar.size(); ++i) {
                MathArray::iterator it = ar.begin() + i;
 
                // is this a limit function?
@@ -963,7 +963,7 @@ namespace {
                                break;
 
                        // search line with "Incorrect syntax"
-                       istringstream is(out.c_str());
+                       istringstream is(out);
                        string line;
                        while (is) {
                                getline(is, line);
@@ -1080,7 +1080,7 @@ namespace {
                        string out = captureOutput("mint -i 1 -S -s -q -q", expr + ';');
                        if (out.empty())
                                break; // expression syntax is ok
-                       istringstream is(out.c_str());
+                       istringstream is(out);
                        string line;
                        getline(is, line);
                        if (line.find("on line") != 0)
@@ -1134,7 +1134,7 @@ namespace {
                                break;
 
                        // search line with single caret
-                       istringstream is(out.c_str());
+                       istringstream is(out);
                        string line;
                        while (is) {
                                getline(is, line);