Use Regex instead of wxRegEx everywhere

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1199 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-09-03 17:55:59 +00:00
parent de003f6e8f
commit 9d1a23ad53
3 changed files with 48 additions and 36 deletions
+5 -1
View File
@@ -100,6 +100,7 @@ struct TextElementsFromString {
// text element before this tag?
addText(te, text, text_start, pos, style, ctx);
}
// a (formatting) tag
size_t tag_start = pos;
pos = skip_tag(text, tag_start);
if (is_substr(text, tag_start, _( "<b"))) bold += 1;
@@ -177,18 +178,21 @@ struct TextElementsFromString {
} else {
// ignore other tags
}
// text starts again after the tag
text_start = pos;
} else {
// normal text
pos += 1;
}
}
if (text_start < end) {
// remaining text at the end
addText(te, text, text_start, end, style, ctx);
}
}
private:
/// Create a text element for a piece of text
/// Create a text element for a piece of text, text[start..end)
void addText(TextElements& te, const String& text, size_t start, size_t end, const TextStyle& style, Context& ctx) {
String content = untag(text.substr(start, end - start));
assert(content.size() == end-start);