Code for parsing variable lists and handling substitutions
Posted: Thu Jul 12, 2012 8:12 am
The variable list in EXEPlug is delievered in a COMMATEXT format, however, it turns out that handling all the rules is not straight-forward. Is there some official code available showing how to parse the variable list, re-encode and handle the substitutions efficiently? I was thinking about writing my own, or using something like boost Tokenizer, but the best would be to use whatever IA is using already - since the plugin needs to return the NewVariables list in the same way that it received the Variables list.
In my case, I just want to return a value as true, but I think the steps need to be:
1. Parse the Variables string into some kind of map or hashtable (correctly handling quotes, double-quotes, \", commas in between quotes)
2. Handle all substitutions of incoming text (e.g., $TITLE$)
3. Change the value of the target variable (I guess we can't just append, since the target variable must be created ahead of time with Set Variable)
3. Re-encode into the correct IA variables string format (values are not always double-quoted, for example)
Thank you much.
Respectfully,
Tim
In my case, I just want to return a value as true, but I think the steps need to be:
1. Parse the Variables string into some kind of map or hashtable (correctly handling quotes, double-quotes, \", commas in between quotes)
2. Handle all substitutions of incoming text (e.g., $TITLE$)
3. Change the value of the target variable (I guess we can't just append, since the target variable must be created ahead of time with Set Variable)
3. Re-encode into the correct IA variables string format (values are not always double-quoted, for example)
Thank you much.
Respectfully,
Tim