My Account Log In Walkthrough IDE Integrations Contact  
Polystyle
Point And Click Source Code
Formatter & Obfuscator

Click Here To Download A Free Trial!
Home Features Documentation Buy Formatter Buy Obfuscator Download  

 



  • PHP Obfuscator

  • C# Obfuscator

  • Perl Obfuscator

  • Java Obfuscator

  • Javascript Obfuscator

  • JSP Obfuscator

  • Actionscript Obfuscator

  • C/C++ Formatter

  • Perl Formatter

  • Pascal/Delphi Formatter

  • C# Formatter

  • CSS Formatter

  • CMAC Formatter

  • Java Formatter

  • Javascript Formatter

  • PHP Formatter

  • JSP Formatter

  • HTML/XML Formatter

  • Python Formatter

  • ASP Formatter

  • Visual Basic Formatter

  • Actionscript Formatter

  • Step 2: Example C++ Source

  • Overall C/C++ Features
  • Step 1: Unformatted Source
  • Step 2: Example Source
  • Step 3: Formatted Source

    Here's one of the C/C++ example files that come with Polystyle.

    Polystyle comes with style files for: Allman/BSD, Ellemtel, GNU, Kernighan & Ritchie, One True Brace Style, Unix Kernel, Linux Kernel, Stroustrup, Sun Microsystems, and Whitesmith.

    Each example file come in various indent styles, such as 2-space, 1-tab, 4-space, and others.

    Your style is easily configured using the Configuration Tool.

    To define your style, you simply edit an example file however you like.


    /**
     * This is a recommended Polystyle C/C++ example.
     * Reformat this file as you like to define your personal style. This means
     * changing the whitespace padding between tokens, placement of newlines, and
     * the indents to match your style.
     *
     * Polystyle works by making the whitespace in your source files look the same as
     * the whitespace in your example files. This is the idea to keep in mind when
     * formatting your examples, Polystyle learns how you place padding between tokens
     * and how many newlines you use in various areas. It then applies these rules
     * to your source. 
     * 
     * Since Polystyle only updates the whitespace in your source code, it will not 
     * alter the actual contents of your files such as adding {}'s in if
     * statements or alphabetizing method declarations. At this time Polystyle will
     * not alter comments although this may change with a future version.
     *
     * You may add snippets of code to this file to elaborate on your style,
     * but it is recommended that you not remove code.
     * 
     * Polystyle ignores the placement of comments in the example file.
     * 
     * To set things such as your page width and indent character, use the 
     * Configuration Tool that comes with Polystyle. 
     *
     * If you would like Polystyle to not format certain parts of your code, 
     * wrap it with  as follows:
     *
     * //
     * int thisCodeIsIndentedButNoNewlineOrPaddingChangesAreMadeToWhitespace;
     * //
     *
     * In place of  you may also use within comments:
     *   (*   *)
     *   *INDENT-OFF*   *INDENT-ON*
     *
     * If Polystyle is unable to parse part of your code, you may be able to work
     * around that using:
     *
     * //
     * This code is not even parsed and is passed through verbatim.
     * //
     *
     * The  tag *must* be the very first thing in the comment in
     * order to work.  tags may appear anywhere in the comment.
     *
     * ---
     *
     * Copyright 2001-2003 Flashbulb Studios.
     *
     * http://polystyle.com
     */
    
    #include 
    
    using namespace a.b.c a;
    
    PREPROCESSOR()
    
    extern struct x y;
    
    static const class Example :
      Int1, Int2, Int3
      {
      public:
    
      Example::~Example() :
        S1(),
        S2(),
        S3()
        {
        // if statements with empty braces
        if (x)
          {
          }
        else if (x)
          {
          }
        else
          {
          }
    
        // if statements with exactly one braced statement
        if (x)
          {
          statement;
          }
        else if (x)
          {
          statement;
          }
        else
          {
          statement;
          }
    
        // special 'if' cases
        if (x)
          {
          statement;
          }
        else
          {
          statement;
          }
    
        if (x)
          {
          statement;
    
          statement;
          }
        else
          {
          statement;
    
          statement;
          }
    
        // if statements with a single implicit substatement
        if (x)
          statement;
    
        else if (x)
          statement;
    
        else
          statement;
    
        // if statements with multiple statements
        if (x)
          {
          statement;
    
          statement;
          }
        else if (x)
          {
          statement;
    
          statement;
          }
        else
          {
          statement;
    
          statement;
          }
    
        // while statements with a single implicit substatement
        while (x)
          statement;
    
        // while statements with a single implicit 'if' substatement
        while (x)
          if (x)
            statement;
    
        // while with multiple statements
        while (x)
          {
          statement;
    
          statement;
          }
    
        // labeled statement
        label:
        statement;
    
        // for statements with a single braced statement
        for( x; x; x )
          {
          statement;
          }
    
        // do statements with a single braced substatement
        do
          {
          statement;
          } while( false );
    
        // do statement with an empty block
        do { } while (x);
    
        // local blocks
        {
        statement;
        }
    
        /* Switch blocks:
         *
         * You can have case substatements be aligned by giving an example like:
         *
         * case 1: statement;
         * 
         *         statement;
         * 
         *         statement;
         * 
         *         etc...
         */
        switch( c )
          {
          case 1:
          case 2:
          case 3:
            statement;
    
            statement;
    
            statement;
    
          case 4:
            break; // case with exactly one substatement
    
          default:
            break;
          }
        }
    
      void method( const myClass & x, int [][][] c, ... )
        {
        // try-catch-finally with empty bodies
        try
          {
          }
        catch(Throwable e)
          {
          }
        finally
          {
          }
    
        // try-catch-finally with exactly one statement
        try
          {
          statement;
          }
        catch( Throwable t )
          {
          statement;
          }
        finally
          {
          statement;
          }
    
        // try-catch-finally with multiple statements 
        try
          {
          statement;
    
          statement;
          }
        catch( Throwable e )
          {
          statement;
    
          statement;
          }
        finally
          {
          statement;
    
          statement;
    
          statement;
          }
        }
      };
    
    // enum statement
    static typedef enum x : y
      {
      x,
      y,
      z,
      };
    
    // simple typedef
    typedef interface static short int x;
    
    namespace x
      {
      // template header
      template 
      x y z v() const;
    
      // pure virtual function, using c-style formal parameters with double parens
      void v(()) = 0;
    
      // function with one single line statement and c-style formal parameters
      void v(( int i )) { statement; };
    
      // function with no statements
      myClass::method() { }
      };
    
    template 
    class x
      {
      public:
    
      // operator declarations
      int operator + ();
    
      int operator [] ();
    
      // template method
      static void A::method() [][][]
        {
        asm
          {
          - Assembler statements -
          
          The outside braces are formatted but the asm code is passed through
          unchanged.
          }
    
        asm Single line assembler statements are also just passed through
    
        }
    
      extern void oldStyleFunction()
        int a;
        int b;
        int c;
        {
        // various simple statements
        long int a, b, c;
    
        long double [] i;
    
        goto x;
    
        delete [] x;
    
        delete [][][] x;
    
        return x;
    
        continue label;
    
        throw e;
    
        // c-style function calls with double parens
        b((a, b, c));
    
        a(());
    
        // expressions 
        new Object()->field.method();
    
        s = "string"
          "split across lines";
    
        method(a, B::C, 'd');
    
        z = j[0][0][0] || k * 3 >> ++i + "0" > i++ & (i) == !j;
    
        int (* functionPointer)( x, y, z );
    
        h[0] += a ? b : ((int)c).d;
    
        new Handler();
        }
      } a, b, c; // struct instances
    
    class Class2
      {
      /* Array creation with multiple non-array elements.
       * 
       * If you give this example with the elements on the same line, then 
       * Polystyle will automatically vertically align them into a grid when it 
       * fits your code to the page. An alternate style is to have each
       * element on its own line, like this:
       * {
       * x,
       * y
       * z
       * }
       */
      boolean * bools1 =
        {
        x, y, z
        };
    
      // array creation with a single element
      boolean bools2 = { x };
    
      // array creation with no elements
      boolean bools3 = { };
    
      // multidimensional array creation 
      const int *** array =
        {
        { 1, 2, 3 },
        { 1, 2, 3 },
        { 1, 2, 3 },
        };
      };
    
    #if x
    
      #define x
    
    #elif a
    
      #define x
    
    #else
    
      #define x
    
      #define x
    
      #define x
    
    #endif

    Next, in Step 3 we get the final result!

  • Home Features Documentation Buy Polystyle Buy Obfuscator Download  

    Click Here To Download A Free Trial!

    Copyright © Flashbulb Studios. All rights reserved.