I just can't help but feel that there's a more efficient way to do this than with multiple calls to the string[i] operator.
I've tried storing the results of string[i], but that leaves me with a char, which I'm evidently unable to compare. I know that I can compare a char*, but from what I can tell, that's a C char and string[i] provides me with a C++ char.
I could be way off with my entire analysis of the situation, so any help would be greatly appreciated.
void proc_cnf_line(Settings& settings, string line)
{
string param_name;
string param_value;
bool param_named = false; //for deciding which string characters are placed into as encountered
bool param_val_encountered = false; //for getting rid of leading spaces in param values
for (strsize ss = 0; ss < line.size(); ss++)
{
if (param_named == false)
{
if (line.compare(ss, 1, "=") == 0)
param_named = true;
else
{
if (line.compare(ss, 1, " ") != 0)
param_name += line[ss];
}
}
else
{
if (line.compare(ss, 1, " ") != 0)
{
if param_val_encountered == false
param_val_encountered = true;
param_value += line[ss];
}
}
}
}