C++ formatter/beautifier?

O

OvErboRed

Hi, I'm wondering if anybody can point me to a good, free C++
formatter/beautifier. I'm looking for something that offers the level of
control that the Unix/Linux 'indent' program provides, but for C++ (indent
has some quirks when applied to C++). I have spent a while Googling for
something along these lines, but haven't come up with anything, only
various very basic formatting programs like Artistic Style. It would be
best if someone could point me to an open-source program, but I'm willing
to work with something that's free (as in beer). Thanks in advance.
 
P

Phlip

OvErboRed said:
Hi, I'm wondering if anybody can point me to a good, free C++
formatter/beautifier. I'm looking for something that offers the level of
control that the Unix/Linux 'indent' program provides, but for C++ (indent
has some quirks when applied to C++). I have spent a while Googling for
something along these lines, but haven't come up with anything, only
various very basic formatting programs like Artistic Style. It would be
best if someone could point me to an open-source program, but I'm willing
to work with something that's free (as in beer). Thanks in advance.

http://astyle.sourceforge.net
 
C

Cedric LEMAIRE

Try 'CodeWorker' at http://www.codeworker.org.

This is a parsing tool and a universal source code generator that
interprets a scripting language. The language provides the function
'indentFile()'.

If you just have a file to indent, write a single-line script, called
"indent.cws" for instance:
indentFile("my-C++-file.cpp");

and type:
codeworker indent.cws

If you have more files to indent, change "indent.cws" to:
forfile i in "*.cpp" indentFile(i);
forfile i in "*.h" indentFile(i);

Regards,

Cedric Lemaire
 
P

Phlip

[Top-post fixed. Please take pride in your posts.]
Thanks for your reply. As I mentioned in my post, AS is too basic for my
needs.

What the hell kind of needs could AS be "too basic" for? Do you intent to
turn innocent functions into ASCII Art of recumbent bicycles?

Use the source, Luke!
 
P

Peter van Merkerk

OvErboRed said:
Thanks for your reply. Unfortunately, BCPP is too basic for my needs.

Perhaps you should explain why the suggested programs are to basic for
your needs. In other word what do you need that those programs don't
provide?
 
T

Thomas Dickey

Phlip said:
What the hell kind of needs could AS be "too basic" for? Do you intent to
turn innocent functions into ASCII Art of recumbent bicycles?

a while back I wrote editor macros to transform comment-boxes to/from the
single-marker form:

/*******/
/* xxx */
/*******/

/*
xxx
*/

One of the developers in my project group found it unsuitable because he
wanted curved edges on the boxes.
 
I

Ira Baxter

OvErboRed said:
Hi, I'm wondering if anybody can point me to a good, free C++
formatter/beautifier. I'm looking for something that offers the level of
control that the Unix/Linux 'indent' program provides, but for C++ (indent
has some quirks when applied to C++). I have spent a while Googling for
something along these lines, but haven't come up with anything, only
various very basic formatting programs like Artistic Style. It would be
best if someone could point me to an open-source program, but I'm willing
to work with something that's free (as in beer). Thanks in advance.

Not free, but specific to C++ and doesn't have Indent quirks.
See http://www.semdesigns.com/Products/Formatters/CppFormatter.html
 
C

Class Account

Perhaps you should explain why the suggested programs are to basic for
your needs. In other word what do you need that those programs don't
provide?

At least be able to do what indent is capable of, e.g., be able to produce
GNU style, K&R style, or Berkeley style code, but adapted to C++.
 
O

overbored

Sorry, that was me, posted with wrong account.

At least be able to do what indent is capable of, e.g., be able to
produce GNU style, K&R style, or Berkeley style code, but adapted to
C++.
 
O

overbored

At least be able to do what indent is capable of, e.g., be able to produce
GNU style, K&R style, or Berkeley style code, but adapted to C++.

[Top-post fixed. Please take pride in your posts.]
Thanks for your reply. As I mentioned in my post, AS is too basic for my
needs.

What the hell kind of needs could AS be "too basic" for? Do you intent to
turn innocent functions into ASCII Art of recumbent bicycles?

Use the source, Luke!
 
P

Phlip

overbored said:
At least be able to do what indent is capable of, e.g., be able to produce
GNU style, K&R style, or Berkeley style code, but adapted to C++.

It do them, as top-level options: -linux, -knr, etc.
 
Joined
Oct 16, 2008
Messages
1
Reaction score
0
Uncrustify + UniversalIndentGUI

I have just found and used Uncrustify, which gives something like 200 options for spacing, new lines, braces, wrapping lines, etc. It doesn't appear to have any presets, so it takes a lot of work to get it configured right. But there is a lot of control in its options.
http://uncrustify.sourceforge.net/

I used UniversalIndentGUI in tandem, which provides a GUI for setting config options and seeing immediate results in any code. It also works with Artistic Style and others.
http://universalindent.sourceforge.net/

Noah
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top