]> git.lyx.org Git - lyx.git/blobdiff - src/LyXRC.cpp
At least for now, this has to be done differently.
[lyx.git] / src / LyXRC.cpp
index 993fb3889f29dbbc170a1bc49d549592931e795f..b79d4be6e7c1a1b584fa45b8e1c22d9183eac539 100644 (file)
@@ -598,7 +598,7 @@ int LyXRC::read(Lexer & lexrc)
 
                case RC_BIBTEX_ALTERNATIVES:
                        if (lexrc.next(true)) {
-                               bibtex_alternatives.push_back(lexrc.getString());
+                               bibtex_alternatives.insert(lexrc.getString());
                        }
                        break;
 
@@ -616,7 +616,7 @@ int LyXRC::read(Lexer & lexrc)
 
                case RC_INDEX_ALTERNATIVES:
                        if (lexrc.next(true)) {
-                               index_alternatives.push_back(lexrc.getString());
+                               index_alternatives.insert(lexrc.getString());
                        }
                        break;
 
@@ -1371,28 +1371,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                if (tag != RC_LAST)
                        break;
        case RC_BIBTEX_ALTERNATIVES: {
-               vector<string>::const_iterator it = bibtex_alternatives.begin();
-               vector<string>::const_iterator end = bibtex_alternatives.end();
-               if (ignore_system_lyxrc) {
-                       for ( ; it != end; ++it)
+               set<string>::const_iterator it = bibtex_alternatives.begin();
+               set<string>::const_iterator end = bibtex_alternatives.end();
+               for ( ; it != end; ++it) {
+                       if (ignore_system_lyxrc
+                           || !system_lyxrc.bibtex_alternatives.count(*it))
                                os << "\\bibtex_alternatives \""
                                   << *it << "\"\n";
-               } else {
-                       vector<string>::const_iterator sbeg =
-                               system_lyxrc.bibtex_alternatives.begin();
-                       vector<string>::const_iterator send =
-                               system_lyxrc.bibtex_alternatives.end();
-                       for ( ; it != end; ++it) {
-                               bool found = false;
-                               for (vector<string>::const_iterator sit = sbeg;
-                                                       sit != send; ++sit) {
-                                       if (*it == *sit)
-                                               found = true;
-                               }
-                               if (!found)
-                                       os << "\\bibtex_alternatives \""
-                                          << *it << "\"\n";
-                       }
                }
                if (tag != RC_LAST)
                        break;
@@ -1412,28 +1397,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                if (tag != RC_LAST)
                        break;
        case RC_INDEX_ALTERNATIVES: {
-               vector<string>::const_iterator it = index_alternatives.begin();
-               vector<string>::const_iterator end = index_alternatives.end();
-               if (ignore_system_lyxrc) {
-                       for ( ; it != end; ++it)
+               set<string>::const_iterator it = index_alternatives.begin();
+               set<string>::const_iterator end = index_alternatives.end();
+               for ( ; it != end; ++it) {
+                       if (ignore_system_lyxrc
+                           || !system_lyxrc.index_alternatives.count(*it))
                                os << "\\index_alternatives \""
                                   << *it << "\"\n";
-               } else {
-                       vector<string>::const_iterator sbeg =
-                               system_lyxrc.index_alternatives.begin();
-                       vector<string>::const_iterator send =
-                               system_lyxrc.index_alternatives.end();
-                       for ( ; it != end; ++it) {
-                               bool found = false;
-                               for (vector<string>::const_iterator sit = sbeg;
-                                                       sit != send; ++sit) {
-                                       if (*it == *sit)
-                                               found = true;
-                               }
-                               if (!found)
-                                       os << "\\index_alternatives \""
-                                          << *it << "\"\n";
-                       }
                }
                if (tag != RC_LAST)
                        break;