mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 20:51:16 +00:00
Prettied up the bool formatting code
This commit is contained in:
@@ -613,36 +613,32 @@ namespace YAML
|
|||||||
switch(mainFmt) {
|
switch(mainFmt) {
|
||||||
case YesNoBool:
|
case YesNoBool:
|
||||||
switch(caseFmt) {
|
switch(caseFmt) {
|
||||||
case UpperCase:
|
case UpperCase: return b ? "YES" : "NO";
|
||||||
return b ? "YES" : "NO";
|
case CamelCase: return b ? "Yes" : "No";
|
||||||
case CamelCase:
|
case LowerCase: return b ? "yes" : "no";
|
||||||
return b ? "Yes" : "No";
|
default: break;
|
||||||
case LowerCase: // fall through to default
|
|
||||||
default:
|
|
||||||
return b ? "yes" : "no";
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case OnOffBool:
|
case OnOffBool:
|
||||||
switch(caseFmt) {
|
switch(caseFmt) {
|
||||||
case UpperCase:
|
case UpperCase: return b ? "ON" : "OFF";
|
||||||
return b ? "ON" : "OFF";
|
case CamelCase: return b ? "On" : "Off";
|
||||||
case CamelCase:
|
case LowerCase: return b ? "on" : "off";
|
||||||
return b ? "On" : "Off";
|
default: break;
|
||||||
case LowerCase: // fall through to default
|
|
||||||
default:
|
|
||||||
return b ? "on" : "off";
|
|
||||||
}
|
}
|
||||||
case TrueFalseBool: // fall through to default
|
break;
|
||||||
default:
|
case TrueFalseBool:
|
||||||
switch(caseFmt) {
|
switch(caseFmt) {
|
||||||
case UpperCase:
|
case UpperCase: return b ? "TRUE" : "FALSE";
|
||||||
return b ? "TRUE" : "FALSE";
|
case CamelCase: return b ? "True" : "False";
|
||||||
case CamelCase:
|
case LowerCase: return b ? "true" : "false";
|
||||||
return b ? "True" : "False";
|
default: break;
|
||||||
case LowerCase: // fall through to default
|
|
||||||
default:
|
|
||||||
return b ? "true" : "false";
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
return b ? "y" : "n"; // should never get here, but it can't hurt to give these answers
|
||||||
}
|
}
|
||||||
|
|
||||||
Emitter& Emitter::Write(bool b)
|
Emitter& Emitter::Write(bool b)
|
||||||
|
Reference in New Issue
Block a user