001package gudusoft.gsqlparser.pp.para;
002
003/**
004 * Output renderer selected by {@link GFmtOpt#outputFmt}.
005 *
006 * <p>The active pretty-printer implements SQL and HTML output. Unknown falls
007 * back to SQL. All other values are retained for API compatibility with older
008 * formatter products and currently cause {@code UnsupportedOperationException}
009 * when selected.</p>
010 */
011public enum GOutputFmt {
012        /** Plain formatted SQL; supported. */
013        ofSql,
014        /** Legacy C# source renderer selector; not implemented by the active formatter. */
015        ofCsharp,
016        /** Legacy C# StringBuilder renderer selector; not implemented by the active formatter. */
017        ofCsharpsbd,
018        /** Legacy Visual Basic source renderer selector; not implemented by the active formatter. */
019        ofvb,
020        /** Legacy Visual Basic StringBuilder renderer selector; not implemented by the active formatter. */
021        ofvbsbd,
022        /** Legacy Java source renderer selector; not implemented by the active formatter. */
023        ofjava,
024        /** Legacy Java StringBuffer renderer selector; not implemented by the active formatter. */
025        ofjavasbf,
026        /** Legacy Visual C++ source renderer selector; not implemented by the active formatter. */
027        ofvc,
028        /** Legacy Pascal source renderer selector; not implemented by the active formatter. */
029        ofpascal,
030        /** Legacy PHP source renderer selector; not implemented by the active formatter. */
031        ofphp,
032        /** Legacy embedded-C renderer selector; not implemented by the active formatter. */
033        ofproc,
034        /** Legacy embedded-COBOL renderer selector; not implemented by the active formatter. */
035        ofprocobol,
036        /** Syntax-highlighted HTML output; supported. */
037        ofhtml,
038        /** Legacy alternate HTML renderer selector; not implemented by the active formatter. */
039        ofhtml2,
040        /** Legacy layout-preserving HTML renderer selector; not implemented by the active formatter. */
041        ofhtmlkeeplayout,
042        /** Legacy alternate layout-preserving HTML renderer selector; not implemented by the active formatter. */
043        ofhtmlkeeplayout2,
044        /** Legacy case-modifying HTML renderer selector; not implemented by the active formatter. */
045        ofhtmlkeeplayoutmodifycase,
046        /** Legacy alternate case-modifying HTML renderer selector; not implemented by the active formatter. */
047        ofhtmlkeeplayout2modifycase,
048        /** Legacy case-modifying text renderer selector; not implemented by the active formatter. */
049        oftxtmodifycase,
050        /** Legacy XML renderer selector; not implemented by the active formatter. */
051        ofxml,
052        /** Legacy database-object renderer selector; not implemented by the active formatter. */
053        ofdbobject,
054        /** Legacy rich-text renderer selector; not implemented by the active formatter. */
055        ofrtf,
056        /** Legacy layout-preserving rich-text renderer selector; not implemented by the active formatter. */
057        ofrtfkeeplayout,
058        /** Legacy case-modifying rich-text renderer selector; not implemented by the active formatter. */
059        ofrtfkeeplayoutmodifycase,
060        /** Legacy C#-input conversion selector; not implemented by the active formatter. */
061        ofFromCSharp,
062        /** Legacy Visual Basic-input conversion selector; not implemented by the active formatter. */
063        ofFromVB,
064        /** Legacy Visual C++-input conversion selector; not implemented by the active formatter. */
065        ofFromVC,
066        /** Legacy Java-input conversion selector; not implemented by the active formatter. */
067        ofFromJava,
068        /** Legacy PHP-input conversion selector; not implemented by the active formatter. */
069        ofFromPhp,
070        /** Legacy Pascal-input conversion selector; not implemented by the active formatter. */
071        ofFromPascal,
072        /** Unknown output selector; treated as plain SQL by the active formatter. */
073        ofUnknown;
074
075        /**
076         * Finds an enum value by name without regard to case.
077         *
078         * @param type enum constant name
079         * @return the matching value, or {@code null} for null or an unknown name
080         */
081        public static GOutputFmt of(String type) {
082                if (type == null)
083                        return null;
084                for (GOutputFmt value : GOutputFmt.values()) {
085                        if (value.name().equalsIgnoreCase(type)) {
086                                return value;
087                        }
088                }
089                return null;
090        }
091}