CpgFunctionArgument

CpgFunctionArgument — An argument to a custom defined function

Synopsis

#define             CPG_FUNCTION_ARGUMENT_CONST         (obj)
struct              CpgFunctionArgument;
struct              CpgFunctionArgumentClass;
CpgFunctionArgument * cpg_function_argument_new         (const gchar *name,
                                                         CpgExpression *expression,
                                                         gboolean isexplicit);
CpgFunctionArgument * cpg_function_argument_copy        (CpgFunctionArgument *argument);
const gchar *       cpg_function_argument_get_name      (CpgFunctionArgument *argument);
gboolean            cpg_function_argument_set_name      (CpgFunctionArgument *argument,
                                                         const gchar *name);
gboolean            cpg_function_argument_get_optional  (CpgFunctionArgument *argument);
void                cpg_function_argument_set_optional  (CpgFunctionArgument *argument,
                                                         gboolean optional);
CpgExpression *     cpg_function_argument_get_default_value
                                                        (CpgFunctionArgument *argument);
void                cpg_function_argument_set_default_value
                                                        (CpgFunctionArgument *argument,
                                                         CpgExpression *expression);
gboolean            cpg_function_argument_get_explicit  (CpgFunctionArgument *argument);
void                cpg_function_argument_set_explicit  (CpgFunctionArgument *argument,
                                                         gboolean isexplicit);
                    CpgFunctionArgumentPrivate;

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----CpgFunctionArgument

Properties

  "default-value"            CpgExpression*        : Read / Write / Construct
  "explicit"                 gboolean              : Read / Write / Construct
  "name"                     gchar*                : Read / Write / Construct
  "optional"                 gboolean              : Read

Signals

  "invalidate-name"                                : Run Last

Description

A CpgFunctionArgument contains information on an argument (or parameter) to a custom defined function.

Details

CPG_FUNCTION_ARGUMENT_CONST()

#define CPG_FUNCTION_ARGUMENT_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CPG_TYPE_FUNCTION_ARGUMENT, CpgFunctionArgument const))


struct CpgFunctionArgument

struct CpgFunctionArgument;


struct CpgFunctionArgumentClass

struct CpgFunctionArgumentClass {
	/* signals */
	gboolean (*invalidate_name) (CpgFunctionArgument *argument,
	                             const gchar         *name);
};


cpg_function_argument_new ()

CpgFunctionArgument * cpg_function_argument_new         (const gchar *name,
                                                         CpgExpression *expression,
                                                         gboolean isexplicit);

Create a new CpgFunctionArgument. Note that CpgFunctionArgument derives from GInitiallyUnowned. This means that initially, the newly created object has a floating reference and does not need to be freed if you add it to a function using cpg_function_add_argument.

name :

The function argument name

Returns :

A CpgFunctionArgument

cpg_function_argument_copy ()

CpgFunctionArgument * cpg_function_argument_copy        (CpgFunctionArgument *argument);

Create a copy of a function argument. Note that CpgFunctionArgument derives from GInitiallyUnowned. This means that initially, the newly created object has a floating reference and does not need to be freed if you add it to a function using cpg_function_add_argument.

argument :

A CpgFunctionArgument

Returns :

A CpgFunctionArgument. [transfer full]

cpg_function_argument_get_name ()

const gchar *       cpg_function_argument_get_name      (CpgFunctionArgument *argument);

Get the function name.

argument :

A CpgFunctionArgument

Returns :

the function name

cpg_function_argument_set_name ()

gboolean            cpg_function_argument_set_name      (CpgFunctionArgument *argument,
                                                         const gchar *name);

Set the function argument name.

argument :

A CpgFunctionArgument

name :

The argument name

Returns :

TRUE if the function argument name could be successfully changed, FALSE otherwise.

cpg_function_argument_get_optional ()

gboolean            cpg_function_argument_get_optional  (CpgFunctionArgument *argument);

Get whether the function argument is optional. If the argument is optional its default value can be obtained with cpg_function_argument_get_default_value

argument :

A CpgFunctionArgument

Returns :

whether the argument is optional

cpg_function_argument_set_optional ()

void                cpg_function_argument_set_optional  (CpgFunctionArgument *argument,
                                                         gboolean optional);


cpg_function_argument_get_default_value ()

CpgExpression *     cpg_function_argument_get_default_value
                                                        (CpgFunctionArgument *argument);

Get the function argument default value.

argument :

A CpgFunctionArgument

Returns :

the default value. [transfer none]

cpg_function_argument_set_default_value ()

void                cpg_function_argument_set_default_value
                                                        (CpgFunctionArgument *argument,
                                                         CpgExpression *expression);

Set the default argument value for an optional function argument.

argument :

A CpgFunctionArgument

cpg_function_argument_get_explicit ()

gboolean            cpg_function_argument_get_explicit  (CpgFunctionArgument *argument);

Get whether the function argument is explicit.

argument :

A CpgFunctionArgument

Returns :

whether the argument is explicit

cpg_function_argument_set_explicit ()

void                cpg_function_argument_set_explicit  (CpgFunctionArgument *argument,
                                                         gboolean isexplicit);

Set whether a function argument is explicit.

argument :

A CpgFunctionArgument

isexplicit :

Whether the argument is explicit

CpgFunctionArgumentPrivate

typedef struct _CpgFunctionArgumentPrivate CpgFunctionArgumentPrivate;

Property Details

The "default-value" property

  "default-value"            CpgExpression*        : Read / Write / Construct

Default Value.


The "explicit" property

  "explicit"                 gboolean              : Read / Write / Construct

Explicit.

Default value: TRUE


The "name" property

  "name"                     gchar*                : Read / Write / Construct

The function argument name

Default value: NULL


The "optional" property

  "optional"                 gboolean              : Read

Whether or not the function argument is optional

Default value: FALSE

Signal Details

The "invalidate-name" signal

gboolean            user_function                      (CpgFunctionArgument *object,
                                                        gchar               *name,
                                                        gpointer             user_data)      : Run Last

This signal is emitted to validate (or rather, invalidate) a new name for a function argument. When a signal handler returns TRUE, the new name is rejected.

object :

a CpgFunctionArgument

name :

the new function argument name

user_data :

user data set when the signal handler was connected.

Returns :

TRUE if the new name should be rejected, FALSE otherwise