## cr-simple-sel

cr-simple-sel

## Synopsis

    struct              CRSimpleSel;
    CRSimpleSel *       cr_simple_sel_append_simple_sel     (CRSimpleSel *a_this,
                                                             CRSimpleSel *a_sel);
    enum CRStatus       cr_simple_sel_compute_specificity   (CRSimpleSel *a_this);
    void                cr_simple_sel_destroy               (CRSimpleSel *a_this);
    enum CRStatus       cr_simple_sel_dump                  (CRSimpleSel const *a_this,
                                                             FILE *a_fp);
    enum CRStatus       cr_simple_sel_dump_attr_sel_list    (CRSimpleSel const *a_this);
    CRSimpleSel *       cr_simple_sel_new                   (void);
    guchar *            cr_simple_sel_one_to_string         (CRSimpleSel const *a_this);
    CRSimpleSel *       cr_simple_sel_prepend_simple_sel    (CRSimpleSel *a_this,
                                                             CRSimpleSel *a_sel);
    guchar *            cr_simple_sel_to_string             (CRSimpleSel const *a_this);

## Description

## Details

### struct CRSimpleSel

    struct CRSimpleSel {
            enum SimpleSelectorType type_mask ;
            gboolean is_case_sentive ;
            CRString * name ;
            /**
             *The combinator that separates
             *this simple selector from the previous
             *one.
             */
            enum Combinator combinator ;

            /**
             *The additional selector list of the
             *current simple selector.
             *An additional selector may
             *be a class selector, an id selector,
             *or an attribute selector.
             *Note that this field is a linked list.
             */
            CRAdditionalSel *add_sel ;

            /*
             *the specificity as specified by
             *chapter 6.4.3 of the spec.
             */
            gulong specificity ;

            CRSimpleSel *next ;
            CRSimpleSel *prev ;
            CRParsingLocation location ;
    };

### cr_simple_sel_append_simple_sel ()

    CRSimpleSel *       cr_simple_sel_append_simple_sel     (CRSimpleSel *a_this,
                                                             CRSimpleSel *a_sel);

Appends a simpe selector to the current list of simple selector.

`a_this`: the this pointer of the current instance of CRSimpleSel. `a_sel`: the simple selector to append.

Returns : | the new list upon successfull completion, an error code otherwise.

### cr_simple_sel_compute_specificity ()

    enum CRStatus       cr_simple_sel_compute_specificity   (CRSimpleSel *a_this);

`a_this`: the current instance of CRSimpleSel

Computes the selector (combinator separated list of simple selectors) as defined in the css2 spec in chapter 6.4.3

Returns : | CR_OK upon successfull completion, an error code otherwise.

### cr_simple_sel_destroy ()

    void                cr_simple_sel_destroy               (CRSimpleSel *a_this);

`a_this`: the this pointer of the current instance of CRSimpleSel.

The destructor of the current instance of CRSimpleSel.

### cr_simple_sel_dump ()

    enum CRStatus       cr_simple_sel_dump                  (CRSimpleSel const *a_this,
                                                             FILE *a_fp);

Dumps the selector to a file. TODO: add the support of unicode in the dump.

`a_this` : | the current instance of CRSimpleSel.
`a_fp` : | the destination file pointer.
Returns : | CR_OK upon successfull completion, an error code otherwise.

### cr_simple_sel_dump_attr_sel_list ()

    enum CRStatus       cr_simple_sel_dump_attr_sel_list    (CRSimpleSel const *a_this);

### cr_simple_sel_new ()

    CRSimpleSel *       cr_simple_sel_new                   (void);

The constructor of CRSimpleSel.

Returns : | the new instance of CRSimpleSel.

### cr_simple_sel_one_to_string ()

    guchar *            cr_simple_sel_one_to_string         (CRSimpleSel const *a_this);

### cr_simple_sel_prepend_simple_sel ()

    CRSimpleSel *       cr_simple_sel_prepend_simple_sel    (CRSimpleSel *a_this,
                                                             CRSimpleSel *a_sel);

`a_this`: the this pointer of the current instance of CRSimpleSel. `a_sel`: the simple selector to prepend.

Prepends a simple selector to the current list of simple selectors.

Returns : | the new list upon successfull completion, an error code otherwise.

### cr_simple_sel_to_string ()

    guchar *            cr_simple_sel_to_string             (CRSimpleSel const *a_this);