Package pyamf :: Module amf3 :: Class Context

[hide private]
[frames] | no frames]

# Class Context

source code

I hold the AMF3 context for en/decoding streams.

Instance Methods | [hide private]

__init__(self) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code

clear(self) Clears the context. | source code

reset(self) Resets the context. | source code

setObjectAlias(self, obj, alias) Maps an object to an aliased object. | source code

getObjectAlias(self, obj) Get an alias of an object. | source code

`str`

getString(self, ref) Gets a string based on a reference `ref`. | source code

`int`

getStringReference(self, s) Return string reference. | source code

`int`

addString(self, s) Creates a reference to `s`. | source code

getClassDefinition(self, ref) Return class reference. | source code

`int`

getClassDefinitionReference(self, class_def) Return class definition reference. | source code

addClassDefinition(self, class_def) Creates a reference to `class_def`. | source code

removeClassDefinition(self, class_def) Removes a `ClassDefinition` reference from this context. | source code

getLegacyXML(self, ref) Return the legacy XML reference. | source code

`int`

getLegacyXMLReference(self, doc) Return legacy XML reference. | source code

`int`

addLegacyXML(self, doc) Creates a reference to `doc`. | source code

__copy__(self) | source code

Inherited from `BaseContext`: `addObject`, `getClassAlias`, `getObject`, `getObjectReference` Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Instance Variables | [hide private]

`list` | classes A list of ClassDefinition.
`list` | legacy_xml A list of legacy encoded XML documents.
`list` | strings A list of string references.

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self)
(Constructor)

source code

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
  (inherited documentation)

### clear(self)

source code

Clears the context.

Overrides: BaseContext.clear

### reset(self)

source code

Resets the context.

Overrides: BaseContext.reset

See Also: pyamf.BaseContext.reset

### setObjectAlias(self, obj, alias)

source code

Maps an object to an aliased object.

Since: 0.4

### getObjectAlias(self, obj)

source code

Get an alias of an object.

Since: 0.4

### getString(self, ref)

source code

Gets a string based on a reference `ref`.

Parameters:
  - `ref` (`str`) - The reference index.
Returns: `str`
  The referenced string.
Raises:
  - `ReferenceError` - The referenced string could not be found.

### getStringReference(self, s)

source code

Return string reference.

Parameters:
  - `s` (`str`) - The referenced string.
Returns: `int`
  The reference index to the string.
Raises:
  - `ReferenceError` - The string reference could not be found.

### addString(self, s)

source code

Creates a reference to `s`. If the reference already exists, that reference is returned.

Parameters:
  - `s` (`str`) - The string to be referenced.
Returns: `int`
  The reference index.
Raises:
  - `TypeError` - The parameter `s` is not of `basestring` type.
  - `ValueError` - Trying to store a reference to an empty string.

### getClassDefinition(self, ref)

source code

Return class reference.

Returns:
  Class reference.
Raises:
  - `ReferenceError` - The class reference could not be found.

### getClassDefinitionReference(self, class_def)

source code

Return class definition reference.

Parameters:
  - `class_def` (ClassDefinition or `instance` or `class`) - The class definition reference to be found.
Returns: `int`
  The reference to `class_def`.
Raises:
  - `ReferenceError` - The reference could not be found.
  - `TypeError` - Unable to determine class.

### addClassDefinition(self, class_def)

source code

Creates a reference to `class_def`.

Parameters:
  - `class_def` - `ClassDefinition` instance.

### getLegacyXML(self, ref)

source code

Return the legacy XML reference. This is the `flash.xml.XMLDocument` class in ActionScript 3.0 and the top-level `XML` class in ActionScript 1.0 and 2.0.

Parameters:
  - `ref` (`int`) - The reference index.
Returns:
  Instance of ET
Raises:
  - `ReferenceError` - The legacy XML reference could not be found.

### getLegacyXMLReference(self, doc)

source code

Return legacy XML reference.

Parameters:
  - `doc` (ET) - The XML document to reference.
Returns: `int`
  The reference to `doc`.
Raises:
  - `ReferenceError` - The reference could not be found.

### addLegacyXML(self, doc)

source code

Creates a reference to `doc`.

If `doc` is already referenced that index will be returned. Otherwise a new index will be created.

Parameters:
  - `doc` (ET) - The XML document to reference.
Returns: `int`
  The reference to `doc`.

### __copy__(self)

source code

Overrides: BaseContext.__copy__