aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <unknown>2009-07-21 08:29:51 +0000
committernyamatongwe <unknown>2009-07-21 08:29:51 +0000
commitc13647b77a1a52aef060aa7368ed84d5e33dcde5 (patch)
treed2212da98b16a084ef3e4d9eba4382c313f60be9 /src
parent74fc1b126280c1f928dd8a8fb54bc174b92187b4 (diff)
downloadscintilla-mirror-c13647b77a1a52aef060aa7368ed84d5e33dcde5.tar.gz
Replacing SString with std::string.
Diffstat (limited to 'src')
-rw-r--r--src/ExternalLexer.cxx4
-rw-r--r--src/ExternalLexer.h2
-rw-r--r--src/LexAda.cxx21
-rw-r--r--src/LexMPT.cxx16
-rw-r--r--src/LexSpice.cxx7
-rw-r--r--src/ScintillaBase.cxx8
-rw-r--r--src/ScintillaBase.h1
7 files changed, 31 insertions, 28 deletions
diff --git a/src/ExternalLexer.cxx b/src/ExternalLexer.cxx
index a4e29e314..098df4dd5 100644
--- a/src/ExternalLexer.cxx
+++ b/src/ExternalLexer.cxx
@@ -10,6 +10,8 @@
#include <string.h>
#include <ctype.h>
+#include <string>
+
#include "Platform.h"
#include "Scintilla.h"
@@ -39,7 +41,7 @@ char **WordListsToStrings(WordList *val[]) {
dim++;
char **wls = new char * [dim + 1];
for (int i = 0;i < dim;i++) {
- SString words;
+ std::string words;
words = "";
for (int n = 0; n < val[i]->len; n++) {
words += val[i]->words[n];
diff --git a/src/ExternalLexer.h b/src/ExternalLexer.h
index 55e127b40..3c1659a55 100644
--- a/src/ExternalLexer.h
+++ b/src/ExternalLexer.h
@@ -68,7 +68,7 @@ public:
void Release();
LexerLibrary *next;
- SString m_sModuleName;
+ std::string m_sModuleName;
};
/// LexerManager manages external lexers, contains LexerLibrarys.
diff --git a/src/LexAda.cxx b/src/LexAda.cxx
index f6c9e7ee7..654bfbeba 100644
--- a/src/LexAda.cxx
+++ b/src/LexAda.cxx
@@ -10,6 +10,8 @@
#include <string.h>
#include <stdio.h>
+#include <string>
+
#include "Platform.h"
#include "Accessor.h"
@@ -17,7 +19,6 @@
#include "PropSet.h"
#include "KeyWords.h"
#include "SciLexer.h"
-#include "SString.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -62,8 +63,8 @@ static inline bool IsDelimiterCharacter(int ch);
static inline bool IsNumberStartCharacter(int ch);
static inline bool IsNumberCharacter(int ch);
static inline bool IsSeparatorOrDelimiterCharacter(int ch);
-static bool IsValidIdentifier(const SString& identifier);
-static bool IsValidNumber(const SString& number);
+static bool IsValidIdentifier(const std::string& identifier);
+static bool IsValidNumber(const std::string& number);
static inline bool IsWordStartCharacter(int ch);
static inline bool IsWordCharacter(int ch);
@@ -117,7 +118,7 @@ static void ColouriseLabel(StyleContext& sc, WordList& keywords, bool& apostroph
sc.Forward();
sc.Forward();
- SString identifier;
+ std::string identifier;
while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) {
identifier += static_cast<char>(tolower(sc.ch));
@@ -144,7 +145,7 @@ static void ColouriseLabel(StyleContext& sc, WordList& keywords, bool& apostroph
static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute) {
apostropheStartsAttribute = true;
- SString number;
+ std::string number;
sc.SetState(SCE_ADA_NUMBER);
// Get all characters up to a delimiter or a separator, including points, but excluding
@@ -192,7 +193,7 @@ static void ColouriseWord(StyleContext& sc, WordList& keywords, bool& apostrophe
apostropheStartsAttribute = true;
sc.SetState(SCE_ADA_IDENTIFIER);
- SString word;
+ std::string word;
while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) {
word += static_cast<char>(tolower(sc.ch));
@@ -321,7 +322,7 @@ static inline bool IsSeparatorOrDelimiterCharacter(int ch) {
return IsASpace(ch) || IsDelimiterCharacter(ch);
}
-static bool IsValidIdentifier(const SString& identifier) {
+static bool IsValidIdentifier(const std::string& identifier) {
// First character can't be '_', so initialize the flag to true
bool lastWasUnderscore = true;
@@ -355,8 +356,8 @@ static bool IsValidIdentifier(const SString& identifier) {
return true;
}
-static bool IsValidNumber(const SString& number) {
- int hashPos = number.search("#");
+static bool IsValidNumber(const std::string& number) {
+ size_t hashPos = number.find("#");
bool seenDot = false;
size_t i = 0;
@@ -366,7 +367,7 @@ static bool IsValidNumber(const SString& number) {
return false; // Just in case
// Decimal number
- if (hashPos == -1) {
+ if (hashPos == std::string::npos) {
bool canBeSpecial = false;
for (; i < length; i++) {
diff --git a/src/LexMPT.cxx b/src/LexMPT.cxx
index 93b8caba7..b0099ff86 100644
--- a/src/LexMPT.cxx
+++ b/src/LexMPT.cxx
@@ -11,6 +11,9 @@
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
+
+#include <string>
+
#include "Platform.h"
#include "PropSet.h"
@@ -18,13 +21,12 @@
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
-#include "SString.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
-static int GetLotLineState(SString &line) {
+static int GetLotLineState(std::string &line) {
if (line.length()) {
// Most of the time the first non-blank character in line determines that line's type
// Now finds the first non-blank character
@@ -54,13 +56,13 @@ static int GetLotLineState(SString &line) {
default: // Any other line
// Checks for message at the end of lot file
- if (line.contains("PASSED")) {
+ if (line.find("PASSED") != std::string::npos) {
return SCE_LOT_PASS;
}
- else if (line.contains("FAILED")) {
+ else if (line.find("FAILED") != std::string::npos) {
return SCE_LOT_FAIL;
}
- else if (line.contains("ABORTED")) {
+ else if (line.find("ABORTED") != std::string::npos) {
return SCE_LOT_ABORT;
}
else {
@@ -78,8 +80,8 @@ static void ColourizeLotDoc(unsigned int startPos, int length, int, WordList *[]
styler.StartSegment(startPos);
bool atLineStart = true;// Arms the 'at line start' flag
char chNext = styler.SafeGetCharAt(startPos);
- SString line("");
- line.setsizegrowth(256); // Lot lines are less than 256 chars long most of the time. This should avoid reallocations
+ std::string line("");
+ line.reserve(256); // Lot lines are less than 256 chars long most of the time. This should avoid reallocations
// Styles LOT document
unsigned int i; // Declared here because it's used after the for loop
diff --git a/src/LexSpice.cxx b/src/LexSpice.cxx
index b2953c001..6aa2e8fdc 100644
--- a/src/LexSpice.cxx
+++ b/src/LexSpice.cxx
@@ -10,6 +10,8 @@
#include <string.h>
#include <stdio.h>
+#include <string>
+
#include "Platform.h"
#include "Accessor.h"
@@ -17,7 +19,6 @@
#include "PropSet.h"
#include "KeyWords.h"
#include "SciLexer.h"
-#include "SString.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
@@ -75,7 +76,7 @@ static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute
static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute) {
apostropheStartsAttribute = true;
- SString number;
+ std::string number;
sc.SetState(SCE_SPICE_NUMBER);
// Get all characters up to a delimiter or a separator, including points, but excluding
// double points (ranges).
@@ -104,7 +105,7 @@ static void ColouriseWhiteSpace(StyleContext& sc, bool& ) {
static void ColouriseWord(StyleContext& sc, WordList& keywords, WordList& keywords2, WordList& keywords3, bool& apostropheStartsAttribute) {
apostropheStartsAttribute = true;
sc.SetState(SCE_SPICE_IDENTIFIER);
- SString word;
+ std::string word;
while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) {
word += static_cast<char>(tolower(sc.ch));
sc.Forward();
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx
index 9247fce72..5e2d9114b 100644
--- a/src/ScintillaBase.cxx
+++ b/src/ScintillaBase.cxx
@@ -352,7 +352,6 @@ void ScintillaBase::AutoCompleteCompleted() {
ac.Show(false);
- listSelected = selected;
SCNotification scn = {0};
scn.nmhdr.code = listType > 0 ? SCN_USERLISTSELECTION : SCN_AUTOCSELECTION;
scn.message = 0;
@@ -360,7 +359,7 @@ void ScintillaBase::AutoCompleteCompleted() {
scn.listType = listType;
Position firstPos = ac.posStart - ac.startLen;
scn.lParam = firstPos;
- scn.text = listSelected.c_str();
+ scn.text = selected;
NotifyParent(scn);
if (!ac.Active())
@@ -381,9 +380,8 @@ void ScintillaBase::AutoCompleteCompleted() {
}
SetEmptySelection(ac.posStart);
if (item != -1) {
- SString piece = selected;
- pdoc->InsertCString(firstPos, piece.c_str());
- SetEmptySelection(firstPos + static_cast<int>(piece.length()));
+ pdoc->InsertCString(firstPos, selected);
+ SetEmptySelection(firstPos + static_cast<int>(strlen(selected)));
}
}
diff --git a/src/ScintillaBase.h b/src/ScintillaBase.h
index 0554d9457..0b414452a 100644
--- a/src/ScintillaBase.h
+++ b/src/ScintillaBase.h
@@ -41,7 +41,6 @@ protected:
CallTip ct;
int listType; ///< 0 is an autocomplete list
- SString listSelected; ///< Receives listbox selected string
int maxListWidth; /// Maximum width of list, in average character widths
bool performingStyle; ///< Prevent reentrance