Boost logo

Boost :

From: Bertolt Mildner (Bertolt.Mildner_at_[hidden])
Date: 2004-12-04 14:50:58


OK, i have rewritten the multi-line support. I hope it is much easier to
read and understand now (but still got some iterator arithmetics in it ...)

Now tabs ('\t') have a special function:
- A option descriptions consists of one or more paragraphs.

- Paragraphs are seperated by a '\n' and may be empty.

- Each paragraph has an independend indent relative to first_column_width.

- The indent is set as the position of the last tab ('\t') in a paragraph,
other tabs are ignored.
  IMHO multiple indents per paragraph make no sens.

- Additionally a first line indent can be simulated with spaces (' ') at
the paragraph beginning.

So the following code ...
-----------------------------------------------
    po::options_description options("Options");

    options.add_options()
      ("help", "a long help msg a long help msg a long help msg a long help
msg a long help msg a long help msg a long help msg a long help msg ")

      ("well_formated", "As you can see this is a very well formatted
option description.\n"
                        "You can do this for example:\n\n"
                        "Values:\n"
                        " Value1: \tdoes this and that, bla bla bla bla
bla bla bla bla bla bla bla bla bla bla bla\n"
                        " Value2: \tdoes something else, bla bla bla bla
bla bla bla bla bla bla bla bla bla bla bla\n\n"
                        " This paragraph has a first line indent only,
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla")
      ;

    std::cout << options << "\n";

-----------------------------------------------

... gives this output (formatted for 50 char per line)
-----------------------------------------------
Options:
  --help a long help msg a long
                        help msg a long help msg
                        a long help msg a long
                        help msg a long help msg
                        a long help msg a long
                        help msg
  --well_formated As you can see this is a
                        very well formatted
                        option description.
                        You can do this for
                        example:

                        Values:
                          Value1: does this and
                                  that, bla bla
                                  bla bla bla bla
                                  bla bla bla bla
                                  bla bla bla bla
                                  bla
                          Value2: does something
                                  else, bla bla
                                  bla bla bla bla
                                  bla bla bla bla
                                  bla bla bla bla
                                  bla

                            This paragraph has a
                        first line indent only,
                        bla bla bla bla bla bla
                        bla bla bla bla bla bla
                        bla bla bla
-----------------------------------------------




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk