This is the expression that calls my function.
Code:
OutputBox->SetValue( grid->Encode(InputBox->GetValue()) );
This is the function that is called. I don't really get why it works. InputBox->GetValue() returns a temporary value so how can I make a reference to it? Is this the correct way of calling a function with a reference parameter?
Code:
wxString MatrixGrid::Encode(const wxString& input)
{
bool resetFor;
wxString output;
for ( unsigned int a = 0; a < input.Length(); ++a)
{
resetFor = false;
for ( int i = 0; i < GetNumberRows(); ++i)
{
for ( int j = 0; j < GetNumberCols(); ++j)
{
if (input.GetChar(a) == GetCellValue( i, j ))
{
output << i << j;
resetFor = true;
break;
}
}
if (resetFor == true)
{
break;
}
}
}
return output;
}
Comments are erased because the code shouldn't be necessary to the subject except for the declaration.