Logo Search packages:      
Sourcecode: inkscape version File versions

static void cr_token_clear ( CRToken a_this  )  [static]

Frees the attributes of the current instance of CRtoken.

Parameters:
a_this the current instance of CRToken.

Definition at line 42 of file cr-token.c.

References cr_num_destroy(), cr_utils_trace_info, _CRToken::dimen, _CRToken::num, _CRToken::rgb, _CRToken::str, _CRToken::type, and _CRToken::u.

Referenced by cr_token_destroy(), cr_token_set_cdc(), cr_token_set_cdo(), cr_token_set_dashmatch(), cr_token_set_includes(), and cr_token_set_s().

{
        g_return_if_fail (a_this);

        switch (a_this->type) {
        case S_TK:
        case CDO_TK:
        case INCLUDES_TK:
        case DASHMATCH_TK:
        case PAGE_SYM_TK:
        case MEDIA_SYM_TK:
        case FONT_FACE_SYM_TK:
        case CHARSET_SYM_TK:
        case IMPORT_SYM_TK:
        case IMPORTANT_SYM_TK:
        case SEMICOLON_TK:
        case NO_TK:
        case DELIM_TK:
        case CBO_TK:
        case CBC_TK:
        case BO_TK:
        case BC_TK:
                break;

        case STRING_TK:
        case IDENT_TK:
        case HASH_TK:
        case URI_TK:
        case FUNCTION_TK:
        case COMMENT_TK:
        case ATKEYWORD_TK:
                if (a_this->u.str) {
                        cr_string_destroy (a_this->u.str);
                        a_this->u.str = NULL;
                }
                break;

        case EMS_TK:
        case EXS_TK:
        case LENGTH_TK:
        case ANGLE_TK:
        case TIME_TK:
        case FREQ_TK:
        case PERCENTAGE_TK:
        case NUMBER_TK:
        case PO_TK:
        case PC_TK:
                if (a_this->u.num) {
                        cr_num_destroy (a_this->u.num);
                        a_this->u.num = NULL;
                }
                break;

        case DIMEN_TK:
                if (a_this->u.num) {
                        cr_num_destroy (a_this->u.num);
                        a_this->u.num = NULL;
                }

                if (a_this->dimen) {
                        cr_string_destroy (a_this->dimen);
                        a_this->dimen = NULL;
                }

                break;

        case RGB_TK:
                if (a_this->u.rgb) {
                        cr_rgb_destroy (a_this->u.rgb) ;
                        a_this->u.rgb = NULL ;
                }
                break ;

        case UNICODERANGE_TK:
                /*not supported yet. */
                break;

        default:
                cr_utils_trace_info ("I don't know how to clear this token\n") ;
                break;
        }

        a_this->type = NO_TK;
}


Generated by  Doxygen 1.6.0   Back to index