xref: /minix3/external/bsd/bind/dist/unit/atf-src/atf-c++/detail/ui.hpp (revision 00b67f09dd46474d133c95011a48590a8e8f94c7)
1*00b67f09SDavid van Moolenbroek //
2*00b67f09SDavid van Moolenbroek // Automated Testing Framework (atf)
3*00b67f09SDavid van Moolenbroek //
4*00b67f09SDavid van Moolenbroek // Copyright (c) 2007 The NetBSD Foundation, Inc.
5*00b67f09SDavid van Moolenbroek // All rights reserved.
6*00b67f09SDavid van Moolenbroek //
7*00b67f09SDavid van Moolenbroek // Redistribution and use in source and binary forms, with or without
8*00b67f09SDavid van Moolenbroek // modification, are permitted provided that the following conditions
9*00b67f09SDavid van Moolenbroek // are met:
10*00b67f09SDavid van Moolenbroek // 1. Redistributions of source code must retain the above copyright
11*00b67f09SDavid van Moolenbroek //    notice, this list of conditions and the following disclaimer.
12*00b67f09SDavid van Moolenbroek // 2. Redistributions in binary form must reproduce the above copyright
13*00b67f09SDavid van Moolenbroek //    notice, this list of conditions and the following disclaimer in the
14*00b67f09SDavid van Moolenbroek //    documentation and/or other materials provided with the distribution.
15*00b67f09SDavid van Moolenbroek //
16*00b67f09SDavid van Moolenbroek // THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
17*00b67f09SDavid van Moolenbroek // CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18*00b67f09SDavid van Moolenbroek // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19*00b67f09SDavid van Moolenbroek // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20*00b67f09SDavid van Moolenbroek // IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
21*00b67f09SDavid van Moolenbroek // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22*00b67f09SDavid van Moolenbroek // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23*00b67f09SDavid van Moolenbroek // GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24*00b67f09SDavid van Moolenbroek // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25*00b67f09SDavid van Moolenbroek // IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26*00b67f09SDavid van Moolenbroek // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27*00b67f09SDavid van Moolenbroek // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*00b67f09SDavid van Moolenbroek //
29*00b67f09SDavid van Moolenbroek 
30*00b67f09SDavid van Moolenbroek #if !defined(_ATF_CXX_UI_HPP_)
31*00b67f09SDavid van Moolenbroek #define _ATF_CXX_UI_HPP_
32*00b67f09SDavid van Moolenbroek 
33*00b67f09SDavid van Moolenbroek #include <string>
34*00b67f09SDavid van Moolenbroek 
35*00b67f09SDavid van Moolenbroek namespace atf {
36*00b67f09SDavid van Moolenbroek namespace ui {
37*00b67f09SDavid van Moolenbroek 
38*00b67f09SDavid van Moolenbroek //!
39*00b67f09SDavid van Moolenbroek //! \brief Formats an error message to fit on screen.
40*00b67f09SDavid van Moolenbroek //!
41*00b67f09SDavid van Moolenbroek //! Given the program's name and an error message, properly formats it to
42*00b67f09SDavid van Moolenbroek //! fit on screen.
43*00b67f09SDavid van Moolenbroek //!
44*00b67f09SDavid van Moolenbroek //! The program's name is not stored globally to prevent the usage of this
45*00b67f09SDavid van Moolenbroek //! function from inside the library.  Making it a explicit parameter
46*00b67f09SDavid van Moolenbroek //! restricts its usage to the frontend.
47*00b67f09SDavid van Moolenbroek //!
48*00b67f09SDavid van Moolenbroek std::string format_error(const std::string&, const std::string&);
49*00b67f09SDavid van Moolenbroek 
50*00b67f09SDavid van Moolenbroek //!
51*00b67f09SDavid van Moolenbroek //! \brief Formats an informational message to fit on screen.
52*00b67f09SDavid van Moolenbroek //!
53*00b67f09SDavid van Moolenbroek //! Given the program's name and an informational message, properly formats
54*00b67f09SDavid van Moolenbroek //! it to fit on screen.
55*00b67f09SDavid van Moolenbroek //!
56*00b67f09SDavid van Moolenbroek //! The program's name is not stored globally to prevent the usage of this
57*00b67f09SDavid van Moolenbroek //! function from inside the library.  Making it a explicit parameter
58*00b67f09SDavid van Moolenbroek //! restricts its usage to the frontend.
59*00b67f09SDavid van Moolenbroek //!
60*00b67f09SDavid van Moolenbroek std::string format_info(const std::string&, const std::string&);
61*00b67f09SDavid van Moolenbroek 
62*00b67f09SDavid van Moolenbroek //!
63*00b67f09SDavid van Moolenbroek //! \brief Formats a block of text to fit nicely on screen.
64*00b67f09SDavid van Moolenbroek //!
65*00b67f09SDavid van Moolenbroek //! Given a text, which is composed of multiple paragraphs separated by
66*00b67f09SDavid van Moolenbroek //! a single '\n' character, reformats it to fill on the current screen's
67*00b67f09SDavid van Moolenbroek //! width with proper line wrapping.
68*00b67f09SDavid van Moolenbroek //!
69*00b67f09SDavid van Moolenbroek //! This is just a special case of format_text_with_tag, provided for
70*00b67f09SDavid van Moolenbroek //! simplicity.
71*00b67f09SDavid van Moolenbroek //!
72*00b67f09SDavid van Moolenbroek std::string format_text(const std::string&);
73*00b67f09SDavid van Moolenbroek 
74*00b67f09SDavid van Moolenbroek //!
75*00b67f09SDavid van Moolenbroek //! \brief Formats a block of text to fit nicely on screen, prepending a
76*00b67f09SDavid van Moolenbroek //! tag to it.
77*00b67f09SDavid van Moolenbroek //!
78*00b67f09SDavid van Moolenbroek //! Given a text, which is composed of multiple paragraphs separated by
79*00b67f09SDavid van Moolenbroek //! a single '\n' character, reformats it to fill on the current screen's
80*00b67f09SDavid van Moolenbroek //! width with proper line wrapping.  The text is prepended with a tag;
81*00b67f09SDavid van Moolenbroek //! i.e. a word that is printed at the beginning of the first paragraph and
82*00b67f09SDavid van Moolenbroek //! optionally repeated at the beginning of each word.  The last parameter
83*00b67f09SDavid van Moolenbroek //! specifies the column on which the text should start, and that position
84*00b67f09SDavid van Moolenbroek //! must be greater than the tag's length or 0, in which case it
85*00b67f09SDavid van Moolenbroek //! automatically takes the correct value.
86*00b67f09SDavid van Moolenbroek //!
87*00b67f09SDavid van Moolenbroek std::string format_text_with_tag(const std::string&, const std::string&,
88*00b67f09SDavid van Moolenbroek                                  bool, size_t = 0);
89*00b67f09SDavid van Moolenbroek 
90*00b67f09SDavid van Moolenbroek //!
91*00b67f09SDavid van Moolenbroek //! \brief Formats a warning message to fit on screen.
92*00b67f09SDavid van Moolenbroek //!
93*00b67f09SDavid van Moolenbroek //! Given the program's name and a warning message, properly formats it to
94*00b67f09SDavid van Moolenbroek //! fit on screen.
95*00b67f09SDavid van Moolenbroek //!
96*00b67f09SDavid van Moolenbroek //! The program's name is not stored globally to prevent the usage of this
97*00b67f09SDavid van Moolenbroek //! function from inside the library.  Making it a explicit parameter
98*00b67f09SDavid van Moolenbroek //! restricts its usage to the frontend.
99*00b67f09SDavid van Moolenbroek //!
100*00b67f09SDavid van Moolenbroek std::string format_warning(const std::string&, const std::string&);
101*00b67f09SDavid van Moolenbroek 
102*00b67f09SDavid van Moolenbroek } // namespace ui
103*00b67f09SDavid van Moolenbroek } // namespace atf
104*00b67f09SDavid van Moolenbroek 
105*00b67f09SDavid van Moolenbroek #endif // !defined(_ATF_CXX_UI_HPP_)
106