You already using std::vector; are you also familiar with std::map? Or iterators? Or how to use the table lookup approach?
Parser::MainParser() looks file -- though maybe you could come up with more descriptive names than Source1, ... (or is that all you've got???)
Parser::DoubleOutput could be recoded to use std::copy, it you want.
But Parser::Source4 is way too long for what it's doing. If you used either a map or a lookup table, you could fold the function right, right down. And make it less susceptible to bugs, too.
What you need to do is look up what to do with a char: e.g. 'a' -> append 'e'; 'y' -> append "ai"; 'w' -> double output "u", w"; etc.
Then you can the appropriate helper function. You already do DoubleOuput (if I read it right?), so you just need e.g.
1 2 3 4 5 6 7
|
void AppendOutput(const wstring& str)
{
for (int j = 0; j < m_iCount; j++)
{
m_Results[j] += str;
}
}
|
Regarding Win32 project / Windows Forms Application : the former is for normal C++ code (with SendMessage, etc.), the latter for C++/CLI. You can mix the two (a C++/CLI GUI with native algorithic code, for example), but that might get a bit confusing if you're learning both at the same time.
Basically, for the code you've been disussing here on cplusplus.com, you need a Win32 app.
Andy
PS Note that when you do this:
wstrInput[i] == 'v'
where wstrInput is a wchar_t*, then the compiler is promoting the char 'v' to a wchar_t and then comparing it with the wchar_t in wstrInput.
For example, if I do this
wcout << 'ą' << endl;
then Visual C++ warns me (my source file is Unicode):
warning C4566: character represented by universal-character-name '\u0105'
cannot be represented in the current code page (1252) |
Need to use
wcout << L'ą' << endl;
Also this (an int literal)
0x0105; // nasal a (with ogonek)
should really be (a wchar_t literal)
L'\x0105'; // nasal a (with ogonek)