OGS
anonymous_namespace{PrjProcessing.cpp} Namespace Reference

Functions

std::string iostateToString (std::ios_base::iostate const state)
 

Function Documentation

◆ iostateToString()

std::string anonymous_namespace{PrjProcessing.cpp}::iostateToString ( std::ios_base::iostate const state)

Definition at line 30 of file PrjProcessing.cpp.

31{
32 std::string result;
33
34 if (state == std::ios_base::goodbit)
35 {
36 result = "goodbit";
37 }
38 else
39 {
40 if (state & std::ios_base::eofbit)
41 {
42 result += "eofbit ";
43 }
44 if (state & std::ios_base::failbit)
45 {
46 result += "failbit ";
47 }
48 if (state & std::ios_base::badbit)
49 {
50 result += "badbit";
51 }
52 // Remove trailing space if there is one
53 if (!result.empty() && result.back() == ' ')
54 {
55 result.pop_back();
56 }
57 }
58 return result;
59}