kputil

Name

kputil -- 

Synopsis



gboolean    kp_date_valid                   (KPDate *date);
void        kp_date_set_time                (KPDate *date,
                                             GTime time_);
gboolean    kp_is_valid_date_str            (const gchar *date_str);
gboolean    kp_is_valid_time_str            (const gchar *time_str);
gboolean    kp_is_valid_number              (const gchar *possible_number);
gdouble     kp_is_valid_duration_entry_str  (const gchar *time_str);
gdouble     kp_number                       (const gchar*);
GValue*     kp_g_value_from_string          (const gchar *string);
gchar*      kp_g_value_to_string            (const GValue *value);
guint       kp_get_month_len                (guint m,
                                             gboolean is_leap);
gboolean    kp_leap                         (guint year);
gboolean    kp_week_of_year                 (guint *week,
                                             guint *year,
                                             guint mm,
                                             guint dd);
glong       kp_calc_days                    (guint year,
                                             guint mm,
                                             guint dd);
guint       kp_day_of_week                  (guint year,
                                             guint mm,
                                             guint dd);
glong       kp_dates_difference             (guint year1,
                                             guint mm1,
                                             guint dd1,
                                             guint year2,
                                             guint mm2,
                                             guint dd2);
guint       kp_weeks_in_year                (guint year);
void        kp_print_debug_string           (const gchar *file,
                                             const gchar *function,
                                             guint line,
                                             const gchar *message,
                                             ...);
gint        kp_get_month_num                (const gchar *m);
gchar*      kp_get_month_name               (guint m);
#define     KP_TAG_MATCH                    (node,tagname)
#define     kp_debug                        (...)

Description

Details

kp_date_valid ()

gboolean    kp_date_valid                   (KPDate *date);

Checks if this DMY is valid julian day.

date :

A KPDate

Returns :

TRUE if date is valid and FALSE otherwise.


kp_date_set_time ()

void        kp_date_set_time                (KPDate *date,
                                             GTime time_);

Used to create

date :

KPDate

time_ :

time value, just like time_t


kp_is_valid_date_str ()

gboolean    kp_is_valid_date_str            (const gchar *date_str);

date_str :

Returns :


kp_is_valid_time_str ()

gboolean    kp_is_valid_time_str            (const gchar *time_str);

time_str :

Returns :


kp_is_valid_number ()

gboolean    kp_is_valid_number              (const gchar *possible_number);

Find out if the string contains some numeric data.

possible_number :

String that may contain a valid numeric value

Returns :

TRUE if string contains numeric data only and FALSE otherwise.


kp_is_valid_duration_entry_str ()

gdouble     kp_is_valid_duration_entry_str  (const gchar *time_str);

time_str :

Returns :


kp_number ()

gdouble     kp_number                       (const gchar*);

Try to parse a string to a double.

Param1 :

Returns :

The double value if possible_number is valid and 0.0 otherwise.


kp_g_value_from_string ()

GValue*     kp_g_value_from_string          (const gchar *string);

string :

Returns :


kp_g_value_to_string ()

gchar*      kp_g_value_to_string            (const GValue *value);

value :

Returns :


kp_get_month_len ()

guint       kp_get_month_len                (guint m,
                                             gboolean is_leap);

Get number of days in the month.

m :

Number of the month (0-11)

is_leap :

TRUE if the year which the month is in, is a leap year

Returns :

Number of the days or 0 if month number is invalid.


kp_leap ()

gboolean    kp_leap                         (guint year);

year :

Returns :


kp_week_of_year ()

gboolean    kp_week_of_year                 (guint *week,
                                             guint *year,
                                             guint mm,
                                             guint dd);

week :

year :

mm :

dd :

Returns :


kp_calc_days ()

glong       kp_calc_days                    (guint year,
                                             guint mm,
                                             guint dd);

year :

mm :

dd :

Returns :


kp_day_of_week ()

guint       kp_day_of_week                  (guint year,
                                             guint mm,
                                             guint dd);

year :

mm :

dd :

Returns :


kp_dates_difference ()

glong       kp_dates_difference             (guint year1,
                                             guint mm1,
                                             guint dd1,
                                             guint year2,
                                             guint mm2,
                                             guint dd2);

year1 :

mm1 :

dd1 :

year2 :

mm2 :

dd2 :

Returns :


kp_weeks_in_year ()

guint       kp_weeks_in_year                (guint year);

year :

Returns :


kp_print_debug_string ()

void        kp_print_debug_string           (const gchar *file,
                                             const gchar *function,
                                             guint line,
                                             const gchar *message,
                                             ...);

file :

function :

line :

message :

... :


kp_get_month_num ()

gint        kp_get_month_num                (const gchar *m);

Get number of the month.

m :

localized month name.

Returns :

The number of the month between 0 and 11 or -1 if the month is invalid.


kp_get_month_name ()

gchar*      kp_get_month_name               (guint m);

Get localized month name.

m :

month number between 0 and 11

Returns :

Newly-allocated string that must be freed or NULL if m is invalid.


KP_TAG_MATCH()

#define         KP_TAG_MATCH(node,tagname)  (xmlStrcasecmp(((xmlNodePtr)node)->name,tagname) == 0)

node :

tagname :


kp_debug()

#define     kp_debug(...)

... :