mirror of
https://github.com/catchorg/Catch2.git
synced 2025-06-03 10:27:57 +00:00
Refactored string wrapper
- to be much more flexible (writes to vector) - fixed a couple of bugs
This commit is contained in:
parent
dd26e889b5
commit
b052bd729a
6 changed files with 806 additions and 316 deletions
|
@ -9,11 +9,39 @@
|
|||
#define TWOBLUECUBES_CATCH_LINE_WRAP_H_INCLUDED
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
void wrapLongStrings( std::ostream& stream, const std::string& str, std::size_t columns, std::size_t indent = 0 );
|
||||
std::string wrapLongStrings( const std::string& str, std::size_t columns, std::size_t indent = 0 );
|
||||
class LineWrapper {
|
||||
public:
|
||||
LineWrapper( std::size_t _indent, std::size_t _right );
|
||||
LineWrapper( std::size_t _right );
|
||||
LineWrapper();
|
||||
|
||||
LineWrapper& setIndent( std::size_t _indent );
|
||||
LineWrapper& setRight( std::size_t _right );
|
||||
|
||||
LineWrapper& wrap( std::string const& _str );
|
||||
|
||||
std::ostream& intoStream( std::ostream& stream ) const;
|
||||
std::string toString() const;
|
||||
|
||||
typedef std::vector<std::string>::const_iterator const_iterator;
|
||||
|
||||
const_iterator begin() const { return lines.begin(); }
|
||||
const_iterator end() const { return lines.end(); }
|
||||
|
||||
private:
|
||||
void wrapInternal( std::string const& _str );
|
||||
void addLine( const std::string& _line );
|
||||
|
||||
std::string indent;
|
||||
std::size_t right;
|
||||
std::size_t nextTab;
|
||||
std::size_t tab;
|
||||
std::vector<std::string> lines;
|
||||
};
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue