| 344 | }); |
| 345 | |
| 346 | String PerfdataValue::Format() const |
| 347 | { |
| 348 | std::ostringstream result; |
| 349 | |
| 350 | if (GetLabel().FindFirstOf(" ") != String::NPos) |
| 351 | result << "'" << GetLabel() << "'"; |
| 352 | else |
| 353 | result << GetLabel(); |
| 354 | |
| 355 | result << "=" << Convert::ToString(GetValue()); |
| 356 | |
| 357 | String unit; |
| 358 | |
| 359 | if (GetCounter()) { |
| 360 | unit = "c"; |
| 361 | } else { |
| 362 | auto myUnit (GetUnit()); |
| 363 | auto uom (l_FormatUoMs.find(myUnit.GetData())); |
| 364 | |
| 365 | if (uom != l_FormatUoMs.end()) { |
| 366 | unit = uom->second; |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | result << unit; |
| 371 | |
| 372 | std::string interm(";"); |
| 373 | if (!GetWarn().IsEmpty()) { |
| 374 | result << interm << Convert::ToString(GetWarn()); |
| 375 | interm.clear(); |
| 376 | } |
| 377 | |
| 378 | interm += ";"; |
| 379 | if (!GetCrit().IsEmpty()) { |
| 380 | result << interm << Convert::ToString(GetCrit()); |
| 381 | interm.clear(); |
| 382 | } |
| 383 | |
| 384 | interm += ";"; |
| 385 | if (!GetMin().IsEmpty()) { |
| 386 | result << interm << Convert::ToString(GetMin()); |
| 387 | interm.clear(); |
| 388 | } |
| 389 | |
| 390 | interm += ";"; |
| 391 | if (!GetMax().IsEmpty()) { |
| 392 | result << interm << Convert::ToString(GetMax()); |
| 393 | } |
| 394 | |
| 395 | return result.str(); |
| 396 | } |
| 397 | |
| 398 | Value PerfdataValue::ParseWarnCritMinMaxToken(const std::vector<String>& tokens, std::vector<String>::size_type index, const String& description) |
| 399 | { |
nothing calls this directly
no test coverage detected