## de.memowe.sbc
Class SBCParser

    java.lang.Object
      de.memowe.sbc.SBCParser

    public class SBCParser

extends java.lang.Object

Simple Blog Code Parser. Simple Blog Code is a simple markup language. You can use it for guest books, blogs, wikis, boards and various other web applications. It produces valid and semantic (X)HTML from input and is patterned on that tiny usenet markups like *bold* and _underline_. HTML::SBC tries to give useful error messages and guess the right translation even with invalid input. It will always produce valid (X)HTML.

Constructor Summary
`SBCParser()` Constructs a SBC parser object with default values.
`SBCParser(int language, boolean imageSupport, ErrorReceiver errorCallback, URLChecker linkcheckCallback, URLChecker imgcheckCallback)` Constructs a SBC parser object.

Method Summary
`static java.lang.String` `description(int language)` SBC language description.
`static void` `english()` Static parser interface: set language to english.
`java.util.Vector` `errors()` Get a vector of error messages after translation.
`static void` `german()` Static parser interface: set language to german.
`ErrorReceiver` `getErrorCallback()`
`URLChecker` `getImgcheckCallback()`
`int` `getLanguage()`
`URLChecker` `getLinkcheckCallback()`
`boolean` `hasMoreErrors()` Returns whether there are more errors in your SBC (iterator).
`boolean` `isImageSupport()`
`java.lang.String` `nextError()` Get the next error message (iterator interface with hasMoreErrors).
`static java.lang.String` `quote(java.lang.String sbc)` Quoted SBC.
`static java.lang.String` `quote(java.lang.String sbc, java.lang.String cite)` Quoted SBC.
`java.lang.String` `sbc(java.lang.String text)` SBC translation.
`static java.lang.String` `sbcDescription()` Static parser interface: SBC language description
`java.lang.String` `sbcInline(java.lang.String text)` SBC inline translation.
`static java.lang.String` `sbcQuote(java.lang.String sbc)` Static parser interface: SBC quotes of given text.
`static java.lang.String` `sbcQuote(java.lang.String sbc, java.lang.String cite)` Static parser interface: SBC quotes of given text.
`static SBCResult` `sbcTranslate(java.lang.String text)` Static parser interface: SBC translation of given text.
`static SBCResult` `sbcTranslateInline(java.lang.String text)` Static parser interface: SBC inline translation of given text.
`void` `setErrorCallback(ErrorReceiver errorCallback)` Sets the error callback object.
`void` `setImageSupport(boolean imageSupport)` Sets whether image code is parsed or not.
`void` `setImgcheckCallback(URLChecker imgcheckCallback)` Sets the imgcheck callback object.
`void` `setLanguage(int language)` Sets the language.
`void` `setLinkcheckCallback(URLChecker linkcheckCallback)` Sets the linkcheck callback object.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SBCParser

    public SBCParser(int language,
                     boolean imageSupport,
                     ErrorReceiver errorCallback,
                     URLChecker linkcheckCallback,
                     URLChecker imgcheckCallback)

  Constructs a SBC parser object.

  Parameters:
    `language` - language for error messages
    `imageSupport` - whether image markup is translated
    `errorCallback` - callback object for error messages
    `linkcheckCallback` - callback object for link url validation
    `imgcheckCallback` - callback object for image url validation

### SBCParser

    public SBCParser()

  Constructs a SBC parser object with default values.

Method Detail

### getLanguage

    public int getLanguage()

  Returns:
    Returns the language.

### setLanguage

    public void setLanguage(int language)

  Sets the language. It defines the language of your error messages.

  Parameters:
    `language` - the language to set.

### isImageSupport

    public boolean isImageSupport()

  Returns:
    Returns the imageSupport.

### setImageSupport

    public void setImageSupport(boolean imageSupport)

  Sets whether image code is parsed or not.

  Parameters:
    `imageSupport` - the imageSupport to set.

### getErrorCallback

    public ErrorReceiver getErrorCallback()

  Returns:
    Returns the errorCallback.

### setErrorCallback

    public void setErrorCallback(ErrorReceiver errorCallback)

  Sets the error callback object. Every time an error occurs while parsing, its error() method is called.

  Parameters:
    `errorCallback` - The errorCallback to set.

### getLinkcheckCallback

    public URLChecker getLinkcheckCallback()

  Returns:
    Returns the linkcheckCallback.

### setLinkcheckCallback

    public void setLinkcheckCallback(URLChecker linkcheckCallback)

  Sets the linkcheck callback object. On a given URL its isValid() method has to return true if and only if this URL is valid/good.

  Parameters:
    `linkcheckCallback` - the linkcheckCallback to set.

### getImgcheckCallback

    public URLChecker getImgcheckCallback()

  Returns:
    Returns the imgcheckCallback.

### setImgcheckCallback

    public void setImgcheckCallback(URLChecker imgcheckCallback)

  Sets the imgcheck callback object. On a given URL its isValid() method has to return true if and only if this URL is valid/good.

  Parameters:
    `imgcheckCallback` - The imgcheckCallback to set.

### sbc

    public java.lang.String sbc(java.lang.String text)

  SBC translation.

  Parameters:
    `text` - SBC text
  Returns:
    valid HTML block elements representing the given SBC text.

### sbcInline

    public java.lang.String sbcInline(java.lang.String text)

  SBC inline translation.

  Parameters:
    `text` - inline SBC text (only inline elements!)
  Returns:
    valid HTML inline elements representing the given inline SBC text.

### hasMoreErrors

    public boolean hasMoreErrors()

  Returns whether there are more errors in your SBC (iterator).

  Returns:
    true if there are more error messages.

### errors

    public java.util.Vector errors()

  Get a vector of error messages after translation.

  Returns:
    a Vector of error messages (String)

### nextError

    public java.lang.String nextError()

  Get the next error message (iterator interface with hasMoreErrors).

  Returns:
    the next error message (String)

### quote

    public static java.lang.String quote(java.lang.String sbc)

  Quoted SBC.

  Parameters:
    `sbc` - your SBC input
  Returns:
    your string quoted

### quote

    public static java.lang.String quote(java.lang.String sbc,
                                         java.lang.String cite)

  Quoted SBC.

  Parameters:
    `sbc` - your SBC input
    `cite` - the author
  Returns:
    your string quoted

### description

    public static java.lang.String description(int language)

  SBC language description.

  Parameters:
    `language` - your language
  Returns:
    HTML string with SBC translation

### english

    public static void english()

  Static parser interface: set language to english.

### german

    public static void german()

  Static parser interface: set language to german.

### sbcTranslate

    public static SBCResult sbcTranslate(java.lang.String text)

  Static parser interface: SBC translation of given text.

  Parameters:
    `text` - your SBC text
  Returns:
    SBCResult with html text as result and an error Vector as errors.

### sbcTranslateInline

    public static SBCResult sbcTranslateInline(java.lang.String text)

  Static parser interface: SBC inline translation of given text.

  Parameters:
    `text` - your SBC inline text
  Returns:
    SBCResult with inline html as result and an error Vector as errors.

### sbcQuote

    public static java.lang.String sbcQuote(java.lang.String sbc,
                                            java.lang.String cite)

  Static parser interface: SBC quotes of given text.

  Parameters:
    `sbc` - the sbc text to be quoted
    `cite` - the author
  Returns:
    sbc quoted

### sbcQuote

    public static java.lang.String sbcQuote(java.lang.String sbc)

  Static parser interface: SBC quotes of given text.

  Parameters:
    `sbc` - the sbc text to be quoted
  Returns:
    sbc quoted

### sbcDescription

    public static java.lang.String sbcDescription()

  Static parser interface: SBC language description

  Returns:
    HTML string with SBC translation