aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/AutoComplete.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2012-06-17 13:38:21 +1000
committernyamatongwe <unknown>2012-06-17 13:38:21 +1000
commitf0d56e473978dcfa017b6597ef4e2e09e5a477e6 (patch)
treec7d9b15f268ef84d933a9931ce05db5a1190ffb1 /src/AutoComplete.cxx
parent7a340b339181d7e8981ad8d67ec07d75b2e5fa54 (diff)
downloadscintilla-mirror-f0d56e473978dcfa017b6597ef4e2e09e5a477e6.tar.gz
Use std::string instead of fixed size strings.
Decrease direct access to the autocompletion list box from outside AutoComplete.
Diffstat (limited to 'src/AutoComplete.cxx')
-rw-r--r--src/AutoComplete.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/AutoComplete.cxx b/src/AutoComplete.cxx
index aa65810eb..82773f4db 100644
--- a/src/AutoComplete.cxx
+++ b/src/AutoComplete.cxx
@@ -10,6 +10,8 @@
#include <stdio.h>
#include <assert.h>
+#include <string>
+
#include "Platform.h"
#include "CharacterSet.h"
@@ -101,6 +103,16 @@ void AutoComplete::SetList(const char *list) {
lb->SetList(list, separator, typesep);
}
+int AutoComplete::GetSelection() const {
+ return lb->GetSelection();
+}
+
+std::string AutoComplete::GetValue(int item) const {
+ char value[maxItemLen];
+ lb->GetValue(item, value, sizeof(value));
+ return std::string(value);
+}
+
void AutoComplete::Show(bool show) {
lb->Show(show);
if (show)
@@ -130,7 +142,6 @@ void AutoComplete::Move(int delta) {
void AutoComplete::Select(const char *word) {
size_t lenWord = strlen(word);
int location = -1;
- const int maxItemLen=1000;
int start = 0; // lower bound of the api array block to search
int end = lb->Length() - 1; // upper bound of the api array block to search
while ((start <= end) && (location == -1)) { // Binary searching loop