Back to index

php5  5.3.10
Classes | Typedefs | Functions
mbfl_ident.h File Reference
#include "mbfl_defs.h"
#include "mbfl_encoding.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _mbfl_identify_filter
struct  mbfl_identify_vtbl

Typedefs

typedef struct _mbfl_identify_filter

Functions

MBFLAPI struct mbfl_identify_vtblmbfl_identify_filter_get_vtbl (enum mbfl_no_encoding encoding)
MBFLAPI mbfl_identify_filter * mbfl_identify_filter_new (enum mbfl_no_encoding encoding)
MBFLAPI void mbfl_identify_filter_delete (mbfl_identify_filter *filter)
MBFLAPI int mbfl_identify_filter_init (mbfl_identify_filter *filter, enum mbfl_no_encoding encoding)
MBFLAPI void mbfl_identify_filter_cleanup (mbfl_identify_filter *filter)
MBFLAPI void mbfl_filt_ident_common_ctor (mbfl_identify_filter *filter)
MBFLAPI void mbfl_filt_ident_common_dtor (mbfl_identify_filter *filter)
MBFLAPI void mbfl_filt_ident_false_ctor (mbfl_identify_filter *filter)
MBFLAPI int mbfl_filt_ident_false (int c, mbfl_identify_filter *filter)
MBFLAPI int mbfl_filt_ident_true (int c, mbfl_identify_filter *filter)

Typedef Documentation

typedef struct _mbfl_identify_filter

Definition at line 40 of file mbfl_ident.h.


Function Documentation

MBFLAPI void mbfl_filt_ident_common_ctor ( mbfl_identify_filter *  filter)

Definition at line 238 of file mbfl_ident.c.

{
       filter->status = 0;
       filter->flag = 0;
}
MBFLAPI void mbfl_filt_ident_common_dtor ( mbfl_identify_filter *  filter)

Definition at line 244 of file mbfl_ident.c.

{
       filter->status = 0;
}
MBFLAPI int mbfl_filt_ident_false ( int  c,
mbfl_identify_filter *  filter 
)

Definition at line 249 of file mbfl_ident.c.

{
       filter->flag = 1;    /* bad */
       return c;
}
MBFLAPI void mbfl_filt_ident_false_ctor ( mbfl_identify_filter *  filter)

Definition at line 255 of file mbfl_ident.c.

{
       filter->status = 0;
       filter->flag = 1;
}
MBFLAPI int mbfl_filt_ident_true ( int  c,
mbfl_identify_filter *  filter 
)

Definition at line 261 of file mbfl_ident.c.

{
       return c;
}
MBFLAPI void mbfl_identify_filter_cleanup ( mbfl_identify_filter *  filter)

Definition at line 233 of file mbfl_ident.c.

{
       (*filter->filter_dtor)(filter);
}

Here is the caller graph for this function:

MBFLAPI void mbfl_identify_filter_delete ( mbfl_identify_filter *  filter)

Definition at line 223 of file mbfl_ident.c.

{
       if (filter == NULL) {
              return;
       }

       mbfl_identify_filter_cleanup(filter);
       mbfl_free((void*)filter);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 161 of file mbfl_ident.c.

{
       const struct mbfl_identify_vtbl * vtbl;
       int i;

       i = 0;
       while ((vtbl = mbfl_identify_filter_list[i++]) != NULL) {
              if (vtbl->encoding == encoding) {
                     break;
              }
       }

       return vtbl;
}

Here is the caller graph for this function:

MBFLAPI int mbfl_identify_filter_init ( mbfl_identify_filter *  filter,
enum mbfl_no_encoding  encoding 
)

Definition at line 194 of file mbfl_ident.c.

{
       const struct mbfl_identify_vtbl *vtbl;

       /* encoding structure */
       filter->encoding = mbfl_no2encoding(encoding);
       if (filter->encoding == NULL) {
              filter->encoding = &mbfl_encoding_pass;
       }

       filter->status = 0;
       filter->flag = 0;
       filter->score = 0;

       /* setup the function table */
       vtbl = mbfl_identify_filter_get_vtbl(filter->encoding->no_encoding);
       if (vtbl == NULL) {
              vtbl = &vtbl_identify_false;
       }
       filter->filter_ctor = vtbl->filter_ctor;
       filter->filter_dtor = vtbl->filter_dtor;
       filter->filter_function = vtbl->filter_function;

       /* constructor */
       (*filter->filter_ctor)(filter);

       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

MBFLAPI mbfl_identify_filter* mbfl_identify_filter_new ( enum mbfl_no_encoding  encoding)

Definition at line 176 of file mbfl_ident.c.

{
       mbfl_identify_filter *filter;

       /* allocate */
       filter = (mbfl_identify_filter *)mbfl_malloc(sizeof(mbfl_identify_filter));
       if (filter == NULL) {
              return NULL;
       }

       if (mbfl_identify_filter_init(filter, encoding)) {
              mbfl_free(filter);
              return NULL;
       }

       return filter;
}

Here is the call graph for this function:

Here is the caller graph for this function: