X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fstate.cpp;h=556970d561c13b3c624ef307de2cf9ed53ef5d9d;hb=f0b600c3b1739f7e088da6ab8eb7c2e67adf592c;hp=9e44e14d200ff00a3c9b804baf29d8af59ef94b8;hpb=a38c924ff32081f5cd67c2b0e2d5ca61f0e99de2;p=libs%2Fgltk.git diff --git a/source/state.cpp b/source/state.cpp index 9e44e14..556970d 100644 --- a/source/state.cpp +++ b/source/state.cpp @@ -9,16 +9,33 @@ istream &operator>>(istream &is, State &state) { string str; is>>str; - if(str=="NORMAL") - state=NORMAL; - else if(str=="HOVER") - state=HOVER; - else if(str=="ACTIVE") - state=ACTIVE; - else if(str=="DISABLED") - state=DISABLED; - else - is.setstate(ios_base::failbit); + + unsigned start = 0; + state = NORMAL; + + while(1) + { + string::size_type underscore = str.find('_', start); + if(!str.compare(start, underscore-start, "NORMAL")) + state |= NORMAL; + else if(!str.compare(start, underscore-start, "HOVER")) + state |= HOVER; + else if(!str.compare(start, underscore-start, "ACTIVE")) + state |= ACTIVE; + else if(!str.compare(start, underscore-start, "FOCUS")) + state |= FOCUS; + else if(!str.compare(start, underscore-start, "DISABLED")) + state |= DISABLED; + else + { + is.setstate(ios_base::failbit); + break; + } + + if(underscore==std::string::npos) + break; + start = underscore+1; + } return is; }