ide: Alt+C handling of static members improved #799

git-svn-id: svn://ultimatepp.org/upp/trunk@7506 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-07-12 07:46:30 +00:00
parent 3847425095
commit 9cbaaf54de
2 changed files with 27 additions and 4 deletions

View file

@ -964,8 +964,11 @@ void AssistEditor::DCopy()
}
}
if(m.IsData()) {
String nat = m.natural;
if(cls.GetCount()) {
const char *s = m.natural;
nat.Replace("static", "");
nat = TrimLeft(nat);
const char *s = nat;
while(*s) {
if(iscib(*s)) {
const char *b = s;
@ -984,8 +987,28 @@ void AssistEditor::DCopy()
r << *s++;
}
}
else
r << "extern " << m.natural;
else {
int q = nat.ReverseFind("::");
if(q >= 0) { // Foo Class2 :: Class::variable; -> static Foo variable;
int e = q + 2;
for(;;) {
while(q >= 0 && nat[q - 1] == ' ')
q--;
if(q == 0 || !iscid(nat[q - 1]))
break;
while(q >= 0 && iscid(nat[q - 1]))
q--;
int w = nat.ReverseFind("::", q);
if(w < 0)
break;
q = w;
}
nat.Remove(q, e - q);
r << "static " << nat;
}
else
r << "extern " << nat;
}
r << ";\n";
}
}

View file

@ -4,7 +4,7 @@
#include "ide\Common/init"
#include "PdfDraw/init"
#include "RichEdit/init"
#define BLITZ_INDEX__ F93222d80ec8e06ccbdf5f9e1c0bd4535
#define BLITZ_INDEX__ F09f1bfac1925f12219a612fc7165f5a9
#include "TopicI.icpp"
#undef BLITZ_INDEX__
#endif