GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - catchorg/textflowcpp: A simple, single-header-only library, for wrapping text. In C++

BranchesTags
Open more actions menu

Latest commit

 

History

28 Commits
28 Commits

Folders and files

NameName
Last commit message
Last commit date
.idea/inspectionProfiles
.idea/inspectionProfiles
 
 
.gitignore
.gitignore
 
 
CMakeLists.txt
CMakeLists.txt
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 
Surrogate.cpp
Surrogate.cpp
 
 
TextFlow.hpp
TextFlow.hpp
 
 
TextFlow_Tests.cpp
TextFlow_Tests.cpp
 
 
catch.hpp
catch.hpp
 
 
main.cpp
main.cpp
 
 

Repository files navigation

A simple way to wrap a string at different line lengths, optionally with indents.

e.g.

std::cout << Column( "This is quite a long string" ).width( 8 ) << std::endl;

will output:

This is
quite a
long
string

Columns can be combined, too:

auto a = Column( "This is a load of text that should go on the left" )
            .width( 10 );
auto b = Column( "Here's some more strings that should be formatted to the right. "
                 "It's longer so there should be blanks on the left" )
            .width( 12 )
            .initialIndent( 2 );
            
                 
auto layout = a + Spacer( 4 ) + b;

std::cout << layout << std::endl;                 

gives you:

 This is a       Here's
 load of       some more
 text that     strings that
 should go     should be
 on the        formatted to
 left          the right.
               It's longer
               so there
               should be
               blanks on
               the left

Not bad!

You can also iterate the lines (which are generated lazily), both from Column and the combined Columns.

See the tests for more.

About

A simple, single-header-only library, for wrapping text. In C++

Resources

Readme
BSL-1.0 license
Activity
Custom properties

Stars

112 stars

Watchers

7 watching

Forks

17 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.