Gnm.Value

Fields

Name

Type

Access

Description

v_any

Gnm.ValueAny

r/w

v_array

Gnm.ValueArray

r/w

v_bool

Gnm.ValueBool

r/w

v_err

Gnm.ValueErr

r/w

v_float

Gnm.ValueFloat

r/w

v_range

Gnm.ValueRange

r/w

v_str

Gnm.ValueStr

r/w

Methods

class

cmp (ptr_a, ptr_b)

class

cmp_reverse (ptr_a, ptr_b)

class

error_name (err, translated)

class

new_array (cols, rows)

class

new_array_empty (cols, rows)

class

new_bool (b)

class

new_cellrange (a, b, eval_col, eval_row)

class

new_cellrange_parsepos_str (pp, str, flags)

class

new_cellrange_r (sheet, r)

class

new_cellrange_str (sheet, str)

class

new_empty ()

class

new_float (f)

class

new_from_string (t, str, sf, translated)

class

new_int (i)

class

new_string (str)

class

new_string_str (str)

area_fetch_x_y (x, y, ep)

area_foreach (ep, flags, func, *user_data)

area_get_height (ep)

area_get_width (ep)

area_get_x_y (x, y, ep)

array_set (col, row, v)

coerce_to_number (valid, ep)

compare (b, case_sensitive)

compare_no_cache (b, case_sensitive)

diff (b)

dump ()

dup ()

equal (b)

error_classify ()

get_as_bool (err)

get_as_checked_bool ()

get_as_float ()

get_as_gstring (target, conv)

get_as_int ()

get_as_string ()

get_rangeref ()

hash ()

is_zero ()

peek_string ()

release ()

set_fmt (fmt)

stringify ()

type_of ()

Details

class Gnm.Value
classmethod cmp(ptr_a, ptr_b)
Parameters:
Return type:

int

qsort style comparison function for ascending order

classmethod cmp_reverse(ptr_a, ptr_b)
Parameters:
Return type:

int

qsort style comparison function for descending order.

classmethod error_name(err, translated)
Parameters:
Returns:

the name of err, possibly localized.

Return type:

str

classmethod new_array(cols, rows)
Parameters:
  • cols (int) – number of columns

  • rows (int) – number of rows

Returns:

a new array GOffice.value of the given size with all elements equal to 0.

Return type:

Gnm.Value

classmethod new_array_empty(cols, rows)
Parameters:
  • cols (int) – number of columns

  • rows (int) – number of rows

Returns:

a new array GOffice.value of the given size with all elements equal the empty GOffice.value.

Return type:

Gnm.Value

classmethod new_bool(b)
Parameters:

b (bool) – boolean

Returns:

a new boolean GOffice.value.

Return type:

Gnm.Value

classmethod new_cellrange(a, b, eval_col, eval_row)
Parameters:
Return type:

Gnm.Value

Create a new range reference.

Attempt to do a sanity check for inverted ranges. NOTE : This is no longer necessary and will be removed. mixed mode references create the possibility of inversion. users of these values need to use the utility routines to evaluate the ranges in their context and normalize then.

classmethod new_cellrange_parsepos_str(pp, str, flags)
Parameters:
  • pp (Gnm.ParsePos) – if a relative range is specified, then it will be interpreted relative to this position (affects only A1-style relative references).

  • str (str) – a range specification (ex: “A1”, “A1:C3”, “Sheet1!A1:C3”, “R1C1”).

  • flags (Gnm.ExprParseFlags) –

Return type:

Gnm.Value

Parse str using the convention associated with sheet. Returns a (Gnm.Value *) of type Gnm.ValueType.CELLRANGE if the range was successfully parsed or None on failure.

classmethod new_cellrange_r(sheet, r)
Parameters:
Returns:

a new cell range GOffice.value for r

Return type:

Gnm.Value

classmethod new_cellrange_str(sheet, str)
Parameters:
  • sheet (Gnm.Sheet) – the sheet where the cell range is evaluated. This really only needed if the range given does not include a sheet specification.

  • str (str) – a range specification (ex: “A1”, “A1:C3”, “Sheet1!A1:C3”, “R1C1”).

Return type:

Gnm.Value

Parse str using the convention associated with sheet. Returns a (Gnm.Value *) of type Gnm.ValueType.CELLRANGE if the range was successfully parsed or None on failure.

classmethod new_empty()
Returns:

a new empty GOffice.value.

Return type:

Gnm.Value

classmethod new_float(f)
Parameters:

f (float) – number

Returns:

a new floating-point GOffice.value.

Return type:

Gnm.Value

classmethod new_from_string(t, str, sf, translated)
Parameters:
Return type:

Gnm.Value

classmethod new_int(i)
Parameters:

i (int) – integer

Returns:

a new integer GOffice.value. There is no separate integer type, so this is just an alias for Gnm.Value.new_float.

Return type:

Gnm.Value

classmethod new_string(str)
Parameters:

str (str) – string to use for GOffice.value

Returns:

a new string object.

Return type:

Gnm.Value

classmethod new_string_str(str)
Parameters:

str (GOffice.String) – string to use for GOffice.value

Returns:

a new string GOffice.value.

Return type:

Gnm.Value

area_fetch_x_y(x, y, ep)
Parameters:
Return type:

Gnm.Value

An internal routine to get a cell from an array or range. Ensures that elements of CELLRANGE are evaluated

Returns the element if it exists and is non-empty otherwise returns 0

area_foreach(ep, flags, func, *user_data)
Parameters:
Returns:

non-None on error, or VALUE_TERMINATE if some the handler requested to stop (by returning non-None).

Return type:

Gnm.Value

For each existing element in an array or range, invoke the callback routine.

area_get_height(ep)
Parameters:

ep (Gnm.EvalPos) –

Return type:

int

area_get_width(ep)
Parameters:

ep (Gnm.EvalPos) –

Return type:

int

area_get_x_y(x, y, ep)
Parameters:
Return type:

Gnm.Value

An internal routine to get a cell from an array or range. Ensures that elements of CELLRANGE are evaluated

If any problems occur a None is returned.

array_set(col, row, v)
Parameters:

Sets an element of an array GOffice.value.

coerce_to_number(valid, ep)
Parameters:
Return type:

Gnm.Value

If the GOffice.value can be used as a number return that number otherwise free it at return an appropriate error

compare(b, case_sensitive)
Parameters:
Return type:

Gnm.ValDiff

compare_no_cache(b, case_sensitive)
Parameters:
Return type:

Gnm.ValDiff

diff(b)
Parameters:

b (Gnm.Value) – GOffice.value b

Return type:

float

IGNORES format.

Returns a non-negative difference between 2 values

dump()
dup()
Returns:

a copy of self.

Return type:

Gnm.Value or None

equal(b)
Parameters:

b (Gnm.Value) – second Gnm.Value

Returns:

True if the two values are equal, False otherwise. Cell ranges are considered equal only if they are the same ranges, i.e., the contents of the ranges are not considered.

Return type:

bool

error_classify()
Return type:

Gnm.StdError

get_as_bool(err)
Parameters:

err (bool) –

Return type:

bool

get_as_checked_bool()
Return type:

bool

get_as_float()
Returns:

self interpreted as a floating point GOffice.value.

Return type:

float

get_as_gstring(target, conv)
Parameters:

A simple GOffice.value formatter to convert self into a string stored in target according to conv. See Gnm.format_value_gstring for something more elaborate that handles formats too.

get_as_int()
Returns:

self interpreted as an integer.

Return type:

int

get_as_string()
Returns:

a string rendering of self.

Return type:

str

Simplistic GOffice.value rendering

get_rangeref()
Returns:

the cell range of a cell range GOffice.value.

Return type:

Gnm.RangeRef

hash()
Returns:

a reasonable hash GOffice.value for self.

Return type:

int

is_zero()
Returns:

True if self interpreted as a floating-point GOffice.value is zero.

Return type:

bool

peek_string()
Returns:

A string representation of the GOffice.value. The result will stay valid until either (a) the GOffice.value is disposed of, or (b) two further calls to this function are made.

Return type:

str

release()

Free the GOffice.value.

set_fmt(fmt)
Parameters:

fmt (GOffice.Format) –

stringify()
Returns:

A string representation of the GOffice.value suitable for use in a Python __repr__ function.

Return type:

str

type_of()
Return type:

Gnm.ValueType