MCPcopy Create free account
hub / github.com/boostorg/spirit / main

Function main

example/qi/custom_string.cpp:77–110  ·  view source on GitHub ↗

//////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

75
76///////////////////////////////////////////////////////////////////////////////
77int main()
78{
79 std::cout << "/////////////////////////////////////////////////////////\n\n";
80 std::cout << "\t\tParsing into a QString from Spirit...\n\n";
81 std::cout << "/////////////////////////////////////////////////////////\n\n";
82
83 std::cout << "Give me a complex number of the form r or (r) or (r,i) \n";
84 std::cout << "Type [q or Q] to quit\n\n";
85
86 std::string str;
87 while (getline(std::cin, str))
88 {
89 if (str.empty() || str[0] == 'q' || str[0] == 'Q')
90 break;
91
92 QString t;
93 if (client::parse_qstring(str.begin(), str.end(), t))
94 {
95 std::cout << "-------------------------\n";
96 std::cout << "Parsing succeeded\n";
97 std::cout << "got: " << t.toStdString() << std::endl;
98 std::cout << "\n-------------------------\n";
99 }
100 else
101 {
102 std::cout << "-------------------------\n";
103 std::cout << "Parsing failed\n";
104 std::cout << "-------------------------\n";
105 }
106 }
107
108 std::cout << "Bye... :-) \n\n";
109 return 0;
110}
111
112

Callers

nothing calls this directly

Calls 4

parse_qstringFunction · 0.85
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected