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