ngdb.entry
Norton guide entry loading and holding code.
MAX_LINE_LENGTH
module-attribute
MAX_LINE_LENGTH = 1024
Maximum size of a line we'll look for in a guide.
Entry
Entry(guide)
Norton Guide database entry class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
GuideReader
|
The reader object for the guide. |
required |
has_next
property
has_next
Is there a next entry?
has_previous
property
has_previous
Is there a previous entry?
has_see_also
property
has_see_also
Does this entry have any see-also items?
lines
property
lines
The lines of text in the entry.
next
property
next
The location of the next entry.
offset
property
offset
The file offset of this entry.
parent
property
parent
Returns the parent entry information.
previous
property
previous
The location of the previous entry.
size
property
size
The size of the entry in bytes.
type_id
property
type_id
The numeric ID of the type of entry.
__len__
__len__()
__repr__
__repr__()
Returns a string representation of the object.
Returns:
Type | Description |
---|---|
str
|
The name of the type of entry. |
__rich__
__rich__()
__str__
__str__()
load
classmethod
load(guide)
Load the entry at the current position in the guide.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
GuideReader
|
The reader object for the guide. |
required |
Returns:
Type | Description |
---|---|
Entry
|
The correct type of entry object. |
Raises:
Type | Description |
---|---|
UnknownEntryType
|
Indicates that the entry type is unknown. |
loads
classmethod
loads(entry_type)
Decorator for defining which class handles which entry type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
EntryType
|
The ID of the entry type being handled. |
required |
Returns:
Type | Description |
---|---|
Callable[[type[Entry]], type[Entry]]
|
The decorator wrapper. |
Example
@Entry.loads(EntryType.SHORT)
class Short(Entry):
...
EntryParent
EntryParent(guide)
Class to load and hold the parent information for an entry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
GuideReader
|
The reader object for the guide. |
required |
has_line
property
has_line
Does this entry have a parent entry line that points to it?
has_menu
property
has_menu
Is there a menu related to this entry?
has_prompt
property
has_prompt
Is there a menu prompt related to this entry?
line
property
line
The line in the parent entry that point to this entry.
If there is no parent line this will be -1
. But also see
has_line
for a test for a
parent entry line.
menu
property
menu
The menu that relates to this entry.
If there is no menu, this will be -1
. But also see
has_menu
to test if there is a
related menu.
offset
property
offset
The offset of the parent entry, if there is one.
prompt
property
prompt
The menu prompt related to this entry.
If there is no menu prompt, this will be -1
. But also see
has_prompt
to test if there
is a related menu prompt.
Long
Long(guide)
Bases: Entry
Long Norton Guide database entry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
GuideReader
|
The reader object for the guide. |
required |
see_also
property
see_also
The see-also information for this entry.
__getitem__
__getitem__(line)
Short
Short(guide)
Bases: Entry
Short Norton Guide database entry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
GuideReader
|
The reader object for the guide. |
required |
offsets
property
offsets
The offsets for each of the lines in the entry.
__getitem__
__getitem__(line)