## cr-om-parser

cr-om-parser

## Functions

CROMParser * | cr_om_parser_new ()
enum CRStatus | cr_om_parser_simply_parse_file ()
enum CRStatus | cr_om_parser_parse_file ()
enum CRStatus | cr_om_parser_simply_parse_buf ()
enum CRStatus | cr_om_parser_parse_buf ()
enum CRStatus | cr_om_parser_parse_paths_to_cascade ()
enum CRStatus | cr_om_parser_simply_parse_paths_to_cascade ()
void | cr_om_parser_destroy ()

## Types and Values

struct | CROMParser
| CROMParserPriv

## Description

## Functions

### cr_om_parser_new ()

    CROMParser *
    cr_om_parser_new (CRInput *a_input);

Constructor of the CROMParser. Returns the newly built instance of CROMParser.

#### Parameters

a_input | the input stream. |

### cr_om_parser_simply_parse_file ()

    enum CRStatus
    cr_om_parser_simply_parse_file (const guchar *a_file_path,
                                    enum CREncoding a_enc,
                                    CRStyleSheet **a_result);

The simpler method to parse a css2 file.

Returns CR_OK upon successfull completion, an error code otherwise. Note that this method uses `cr_om_parser_parse_file()` so both methods have the same return values.

#### Parameters

a_file_path | the css2 local file path. |
a_enc | the file encoding. |
a_result | out parameter. The returned css stylesheet. Must be freed by the caller using cr_stylesheet_destroy. |

### cr_om_parser_parse_file ()

    enum CRStatus
    cr_om_parser_parse_file (CROMParser *a_this,
                             const guchar *a_file_uri,
                             enum CREncoding a_enc,
                             CRStyleSheet **a_result);

Parses a css2 stylesheet contained in a file.

Returns CR_OK upon succesful completion, an error code otherwise.

#### Parameters

a_this | the current instance of the cssom parser. |
a_file_uri | the uri of the file. (only local file paths are suppported so far) |
a_enc | the encoding of the file. |
a_result | out parameter. A pointer the build css object model. |

### cr_om_parser_simply_parse_buf ()

    enum CRStatus
    cr_om_parser_simply_parse_buf (const guchar *a_buf,
                                   gulong a_len,
                                   enum CREncoding a_enc,
                                   CRStyleSheet **a_result);

The simpler way to parse an in memory css2 buffer.

Returns CR_OK upon successfull completion, an error code otherwise.

#### Parameters

a_buf | the css2 in memory buffer. |
a_len | the length of the in memory buffer. |
a_enc | the encoding of the in memory buffer. |
a_result | out parameter. The resulting css2 style sheet. |

### cr_om_parser_parse_buf ()

    enum CRStatus
    cr_om_parser_parse_buf (CROMParser *a_this,
                            const guchar *a_buf,
                            gulong a_len,
                            enum CREncoding a_enc,
                            CRStyleSheet **a_result);

Parses the content of an in memory buffer.

Returns CR_OK upon successfull completion, an error code otherwise.

#### Parameters

a_this | the current instance of CROMParser. |
a_buf | the in memory buffer to parse. |
a_len | the length of the in memory buffer in number of bytes. |
a_enc | the encoding of the in memory buffer. |
a_result | out parameter the resulting style sheet |

### cr_om_parser_parse_paths_to_cascade ()

    enum CRStatus
    cr_om_parser_parse_paths_to_cascade (CROMParser *a_this,
                                         const guchar *a_author_path,
                                         const guchar *a_user_path,
                                         const guchar *a_ua_path,
                                         enum CREncoding a_encoding,
                                         CRCascade **a_result);

Parses three sheets located by their paths and build a cascade

Returns CR_OK upon successful completion, an error code otherwise

#### Parameters

a_this | the current instance of CROMParser |
a_author_path | the path to the author stylesheet |
a_user_path | the path to the user stylesheet |
a_ua_path | the path to the User Agent stylesheet |
a_encoding | the encoding of the sheets. |
a_result | out parameter. The resulting cascade if the parsing was okay |

### cr_om_parser_simply_parse_paths_to_cascade ()

    enum CRStatus
    cr_om_parser_simply_parse_paths_to_cascade
                                   (const guchar *a_author_path,
                                    const guchar *a_user_path,
                                    const guchar *a_ua_path,
                                    enum CREncoding a_encoding,
                                    CRCascade **a_result);

Parses three sheets located by their paths and build a cascade

Returns CR_OK upon successful completion, an error code otherwise

#### Parameters

a_author_path | the path to the author stylesheet |
a_user_path | the path to the user stylesheet |
a_ua_path | the path to the User Agent stylesheet |
a_encoding | the encoding of the sheets. |
a_result | out parameter. The resulting cascade if the parsing was okay |

### cr_om_parser_destroy ()

    void
    cr_om_parser_destroy (CROMParser *a_this);

Destructor of the CROMParser.

#### Parameters

a_this | the current instance of CROMParser. |

## Types and Values

### struct CROMParser

    struct CROMParser {
            CROMParserPriv *priv ;
    };

### CROMParserPriv

    typedef struct _CROMParserPriv CROMParserPriv;