Say I'm reading a file, line by line, and I want to check if the line QString satisfies any QRegExp I have defined.

I could use a bunch of if statements such as :
Qt Code:
  1. while(!in.EOF)
  2. {
  3. line = in.readLine();
  4.  
  5. if(line.contains(RegExp1)){...}
  6. else if(line.contains(RegExp2){...}
  7. ...
  8. else if(line.contains(RegExpN){...}
  9. }
To copy to clipboard, switch view to plain text mode 

But I thought it would be neater to write it in the format of a switch. Can this be done. I've googled, but it gives no relevant results.

I thought I could have done something like this:

Qt Code:
  1. while(!in.EOF)
  2. {
  3. switch(true)
  4. {
  5. case line.contains(RegExp1): {...}
  6. ...
  7. case line.contains(RegExpN): {...}
  8. }
  9. }
To copy to clipboard, switch view to plain text mode 
Doesn't work though.