c++ - A function return different object based on its parameter? -


i have bunch of functions this:

void business::convertdatatolistentityoftypex() // x = a,b,c.....  {      qbytearray tmp = getdata();     bool ok;     qvariantlist result = parse (tmp,&ok);      if (ok) {          (int = 0; < result.size(); ++i) {             typexentity e;              convertvarianttotypexentity(result[i],e);             typexentitylist.push_back(e);//typexentitylist private variables in business         }     }   } 

i want group them 1 function this

enum type{typea, typeb}; void business::convertdatatolistentity(type tp)  {      qbytearray tmp = getdata();     bool ok;     qvariantlist result = parse (tmp,&ok);      if (ok) {          (int = 0; < result.size(); ++i) {             typexentity e;// need magic function map enum typexentity              convertvarianttotypexentity(result[i],e);             typexentitylist.push_back(e);//need magic function map enum typexentitylist         }     }   } 

so there possible way qt or boost (qt prefered ) ?

any ideas appreciated :)


Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -