|
|
|
@ -87,30 +87,42 @@ private: |
|
|
|
|
std::string data; |
|
|
|
|
while (s.good()) { |
|
|
|
|
int quotationMarkCount=0; |
|
|
|
|
bool pastEquals=false; |
|
|
|
|
data=""; |
|
|
|
|
bool valid=false; |
|
|
|
|
while(s.good()){ |
|
|
|
|
int character=s.get(); |
|
|
|
|
if(character=='"'){ |
|
|
|
|
quotationMarkCount++; |
|
|
|
|
} |
|
|
|
|
data+=character; |
|
|
|
|
if(character==' '&"ationMarkCount%2==0){ |
|
|
|
|
valid=true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
data+=character; |
|
|
|
|
if(pastEquals&"ationMarkCount%2==0){ |
|
|
|
|
valid=true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
if(character=='='&"ationMarkCount%2==0){ |
|
|
|
|
pastEquals=true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (newTag.tag.length()==0) { //Tag's empty, so first line is the tag.
|
|
|
|
|
newTag.tag=data; |
|
|
|
|
std::cout<<"Tag: "<<newTag.tag<<"\n"; |
|
|
|
|
} else { |
|
|
|
|
std::string key = data.substr(0,data.find("=")); |
|
|
|
|
std::string value = data.substr(data.find("=")+1,std::string::npos); |
|
|
|
|
|
|
|
|
|
//Strip Quotation marks.
|
|
|
|
|
value = value.substr(1,std::string::npos); |
|
|
|
|
value = value.substr(0,value.length()-2); |
|
|
|
|
|
|
|
|
|
newTag.data[key]=value; |
|
|
|
|
std::cout<<" "<<key<<":"<<newTag.data[key]<<"\n"; |
|
|
|
|
if(valid&&data.length()>0){ |
|
|
|
|
if (newTag.tag.length()==0) { //Tag's empty, so first line is the tag.
|
|
|
|
|
newTag.tag=data; |
|
|
|
|
std::cout<<"Tag: "<<newTag.tag<<"\n"; |
|
|
|
|
} else { |
|
|
|
|
std::string key = data.substr(0,data.find("=")); |
|
|
|
|
std::string value = data.substr(data.find("=")+1,std::string::npos); |
|
|
|
|
|
|
|
|
|
//Strip Quotation marks.
|
|
|
|
|
value = value.substr(1,std::string::npos); |
|
|
|
|
value = value.substr(0,value.length()-1); |
|
|
|
|
|
|
|
|
|
newTag.data[key]=value; |
|
|
|
|
std::cout<<" "<<key<<":"<<newTag.data[key]<<"\n"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|