I have a function that I would like to either send it a ifstream or a string (maybe a string stream)?

So say I have this code:

string test = "hello this is a string to be parsed";

if(testint == 0)
ifstream in(fileName);
// put string in a stream here?

ParseData(generic stream?);

Can someone help me fill in the missing pieces to this code? basically I need to parse either a file or a string and I was hoping to use the same code to do either with maybe a generic stream?