Pro.Core
— Core API for parsing and scanning files¶
Core Concepts¶
Some of the most important classes are:
NTContainer
- This is a generic container used to encapsulate data such as files and memory. It’s an extremely important class and it’s used extensively. Containers can be created through SDK functions such ascreateContainerFromFile()
andnewContainer()
.NTBuffer
/NTContainerBuffer
/CFFBuffer
/etc. - These type of classes are used to efficiently read iteratively small amounts of data from a source.NTBuffer
is the base class and derived classes are named after the object they read from. E.g.:NTContainerBuffer
reads fromNTContainer
andCFFBuffer
reads fromCFFObject
.NTTextStream
/NTTextBuffer
/NTTextStringBuffer
- These classes are used to output text. The amount of indentation can be specified.NTTextStream
is the base class and derived classes are named after the output type:NTTextBuffer
outputs to a utf-8 array andNTTextStringBuffer
to a utf-16 array.NTXml
- Used to parse XML. This class is fast and secure. The code is based on RapidXML.CFFObject
- The class from which every format class is derived (ZipObject, PEObject, etc.). WhileNTContainer
provides basic parsing facilities, more complex types and the use ofCFFStruct
rely uponCFFObject
.CFFHeader
- Headers contain definition of structures and can be loaded from SQLite files or XML strings. The structures can be imported from C/C++ code through the Header Manager or from debug symbols such as PDB files.CFFStruct
- This class represents a data structure.CFFFlags
- This class represents the flags of a field in a CFFStruct.
Hint
If you’re wondering why the case convention for methods is not always the same, the reason is simple. Classes such as CFFObject
and CFFStruct
are based on older code which followed the pascal-case convention. Consequently all derived classes like PEObject follow this convention. All other classes use the camel-case convention.
Basic types like integers and strings are automatically converted between C++ and Python. However, lists are preserved for efficiency reasons. Whenever the signature of a method contains a list or another type of container class, you must work with the C++ class. For example, the following example creates a list of C++ integers and iterates through it:
from Pro.Core import *
l = NTIntList()
for i in range(10):
l.append(i)
it = NTIntListIt(l)
while it.hasNext():
print(it.next())
Lists, vectors, hashes and sets all have specialized C++ classes usually relying on Qt containers. These type of classes are easily recognized due to the naming convention.
Note
While in C++ these classes are implemented as template classes, in Python they are exposed as different types. However, NTIntList
will have exactly the same methods as NTStringList
.
Parsing Files¶
Printing out a structure in a file can be as simple as:
from Pro.Core import *
from Pro.PE import *
def printDOSHeader(fname):
c = createContainerFromFile(fname)
if c.isNull():
return
pe = PEObject()
if not pe.Load(c):
return
out = NTTextBuffer()
pe.DosHeader().Dump(out) # CFFStruct.Dump
print(out.buffer)
Warning
Avoid initializing NTContainer
and CFFObject
objects globally in order to avoid memory leaks!
If you really need to use a global object, make sure to set it to None
when it is no longer needed. This way, the garbage collector will release the allocated memory.
NTContainer
is a powerful abstraction for reading from a target. The target can be a memory buffer, a file or even the memory of a remote process. When NTContainer
objects are returned by calling functions like createContainerFromFile()
or newContainer()
, they may either encapsulate a file or a memory buffer. Whether to use a file or a memory buffer is internally decided upon the basis of current memory resources.
If you want to make sure that an NTContainer
instance encapsulates a memory buffer you can do it by specifically setting its internal object:
from Pro.Core import *
c = NTContainer()
# set a byte array as the internal object of NTContainer
c.setData(b"")
# NTContainer are never resizeable by default
c.setResizable(True)
# append some data
c.append(b"foo")
# print out the size of 3
print(c.size())
Ranges and address spaces can also be applied to NTContainer
. Consider the following example:
from Pro.Core import *
c = NTContainer()
c.setData(b"Hello, world!")
# increase the reference count of c
c2 = c.clone()
# set a new range for c2
c2.setRange(7, 5)
# prints out "Hello, world!"
print(c.read(0, c.size()).decode("utf-8"))
# prints out "world"
print(c2.read(0, c2.size()).decode("utf-8"))
The c2
instance refers to the same object as c
but with a different range. This is very useful when working with embedded objects. For instance, parsing a resource inside of a binary file might only require setting the range on an instance NTContainer
of the parent binary file, before being passed onto CFFObject.Load()
.
It is not necessary to subclass CFFObject
in order parse a file. We can use CFFObject
directly:
from Pro.Core import *
xml_header = """<header>
<r id='_IMAGE_DOS_HEADER' type='struct'>
<f id='e_magic' type='unsigned short'/>
<f id='e_cblp' type='unsigned short'/>
<f id='e_cp' type='unsigned short'/>
<f id='e_crlc' type='unsigned short'/>
<f id='e_cparhdr' type='unsigned short'/>
<f id='e_minalloc' type='unsigned short'/>
<f id='e_maxalloc' type='unsigned short'/>
<f id='e_ss' type='unsigned short'/>
<f id='e_sp' type='unsigned short'/>
<f id='e_csum' type='unsigned short'/>
<f id='e_ip' type='unsigned short'/>
<f id='e_cs' type='unsigned short'/>
<f id='e_lfarlc' type='unsigned short'/>
<f id='e_ovno' type='unsigned short'/>
<f id='e_res' type='unsigned short [4]'/>
<f id='e_oemid' type='unsigned short'/>
<f id='e_oeminfo' type='unsigned short'/>
<f id='e_res2' type='unsigned short [10]'/>
<f id='e_lfanew' type='int'/>
</r>
</header>"""
def printStructure(fname):
c = createContainerFromFile(fname)
if c.isNull():
return
# load header from an XML string
header = CFFHeader()
if not header.LoadFromXml(xml_header):
return
obj = CFFObject()
# since CFFObject is not subclassed, the Load method cannot fail
obj.Load(c)
# map a structure to a specific offset
offset = 0
s = obj.MakeStruct(header, "_IMAGE_DOS_HEADER", offset, CFFSO_VC | CFFSO_Pack1)
out = NTTextBuffer()
s.Dump(out)
print(out.buffer)
To read in a buffered way from a target object, be it CFFObject
or NTContainer
, you can use NTBuffer
derived classes such as NTContainerBuffer
and CFFBuffer
:
from Pro.Core import *
def bufferedRead(fname):
c = createContainerFromFile(fname)
if c.isNull():
return
obj = CFFObject()
obj.Load(c)
offset = 0
r = obj.ToBuffer(offset)
try:
# read a single byte from the file
b = r.u8()
except IndexError:
print("error: out of range")
By default buffered readers default to Bufferize_Forwards
. If you want to read backwards or back and forth you can specify Bufferize_Backwards
or Bufferize_BackAndForth
respectively.
The default endianness can be specified both for CFFObject
and NTBuffer
instances. If not specified, endianness will default to ENDIANNESS_LITTLE
.
If need to parse an XML string, you can use our NTXml
class, which is both fast and secure.
from Pro.Core import *
x = NTXml()
ret = x.parse("<r><e t='test'></e></r>")
if ret == NTXml_ErrNone:
n = x.findChild(None, "r")
if n != None:
n = x.findChild(n, "e")
if n != None:
a = x.findAttribute(n, "t")
if a != None:
print(x.value(a))
All the filters which are available in the UI can be used programmatically from the SDK.
from Pro.Core import *
c = NTContainer()
c.setData(b"Hello, world!")
# compress data with zlib
fstr = "<flts><f name='pack/zlib' level='9' raw='true'/></flts>"
# set the last parameter to False to hide the wait-box
c = applyFilters(c, fstr, True)
# print out the compressed data
print(c.read(0, c.size()))
By using filters it’s possible to perform complex data operations with just a few lines of code. In the code snippet above we use a filter to compress the input data using zlib.
Scanning Files¶
In this section we offer an introduction into the internals of our scan engine.
The core classes are:
Report
- This class represents a project. A project can be unpacked or packed. When it’s unpacked, it consists of a directory containing a number of DBs and other files. When it’s packed, the same files are merged into a single file and may be compressed and/or encrypted. Fundamentally, in the context of file scanning, a project contains a SQLite3 database which, in turn, contains XML reports for each scanned file. The current instance of this class is returned byProCoreContext.getReport()
.ScanProvider
- This is the base class inherited by all the scan engines for the different file formats.ScanEntryData
- This is the class that contains the data passed toScanProvider.addEntry()
. Every time a scan provider for a file format encounters a threat, warning, information, privacy issue or embedded file, it callsScanProvider.addEntry()
.FormatTree
- A tree of uint32 ids that describe the layout structure of the analyzed file. This is the layout shown in the format view in the analysis workspace.FormatItemInfo
- The information returned for each individual item in the format tree.ScanProvider._formatViewInfo()
returns this information based on the id provided when constructing theFormatTree
.ScanViewData
- This class is returned byScanProvider._scanViewData()
andScanProvider._formatViewData()
. It may represent raw data, in case of an embedded file, as well as a complex UI.CommonSystem
- Logic providers return classes derived from this class to define a scanning behaviour. For instance, when creating a logic provider which analyzes only a specific set of files in a directory or on a file system, the derived classLocalSystem
can be used.ProCoreContext
- Provides context information like the current scan provider (ProCoreContext.currentScanProvider()
) or the current report (ProCoreContext.getReport()
). The global instance of this class is returned byproCoreContext()
.
As mentioned, for every scanned file an XML report is generated. Below is the commented schema of these XML reports.
<!-- XML schema
note: attributes are marked by parenthesis
o = object
(t = type
u = current entry unique id (in hex)
s = target (base64)
r = risk
f = flags)
s = scan entries
t = threat
w = warning
i = info
(t = type
u = unique identifier for the entry (in hex)
f = flags (optional)
s = target (optional, for embedded files)(base64)
l = object format (for embedded files)
)
(- ic = indirect category
it = indirect type
- fi = format item id
ii = internal file uid
v = view
of = offset
sz = size)
d = data (mandatory)
extra:
t = text
flts = filters
f = filter
(name + params)
s = shellcode
(a = arch
b = base address
)
e = embedded objects
o = object (see above)
h = hashes
md5 = md5 hash
etc.
m = metadata
(ct = creation time
mt = modification time
at = access time
)
e = entry (content is base64 encoded)
(id = name identifying the entry (raw)
l = label (base64)
f = flags (1 for text to show in report)
)
<!-- sample -->
<o t="pe" s="C:/file" r="100">
<!-- scan entries -->
<s>
<!-- threat entry -->
<t t="5" u="0">
<!-- custom data for the current entry, this is handled by
the specific scan provider -->
<d>
<start>0</start>
<size>1000</size>
</d>
<!-- human readable text (for showing advanced infos)
encoded in utf8->base64 -->
<t></t>
<!-- filters applied on the retrieved data -->
<flts>
<f n="aes" p="cbc;256" k="11223344.." />
<f n="z" />
</flts>
</t>
</s>
<!-- what follows is a list of embedded objects
in the same order of the embedded file entries -->
<e>
<o t="pdf" r="70">
<!-- ... -->
</o>
</e>
<!-- various hashes (if any) stored for the current object -->
<h>
<md5>00000000000000..</md5>
<sha1>000000000000...</sha1>
</h>
<!-- metadata (if any) -->
<m ct="hex" wt="hex" at="hex">
<e>base64</e>
<e f=1>base64</e> <!-- will be shown as text in the report view -->
</m>
</o>
The important part to understand when working with the SDK is the custom data mentioned in the schema (the <d> node). This is the custom XML data which is provided by the ScanProvider
during the scanning process via ScanProvider.addEntry()
and is then passed back to ScanProvider._scanViewData()
when requesting data relative to a scan entry.
The data returned from a scan entry can be everything: from a simple description of a threat to an embedded file. In fact, ScanProvider._scanViewData()
can return even complex UIs or native code disassembled by our Carbon engine.
Module API¶
Pro.Core module API.
Attributes:
Buffering method for
NTBuffer
.Buffering method for
NTBuffer
.Buffering method for
NTBuffer
.Buffering method for
NTBuffer
.32-bit index size for
CFFDB
.64-bit index size for
CFFDB
.Invalid index for
CFFDB
.Root index for
CFFDB
.Key sub-type raw.
Key sub-type string.
Key sub-type utf-8.
Key type certificate.
Key type invalid.
Key type password.
Base value for standard
CFFObject
notifications.
CFFObject
notification for malformed data.
CFFObject
notification for the file limit.
CFFObject
notification for failed decryption.
CFFObject
notification for failed decompression.
CFFObject
notification for an internal parsing limit.
CFFObject
notification for recursion.
CFFObject
notification for the decompression limit.
CFFObject
notification for the decompression nesting limit.The maximum supported pointer size.
The minimum supported pointer size.
16-bit pointer size.
32-bit pointer size.
64-bit pointer size.
Range value.
Last range value plus one.
Range value (alias of
CFFRange_Unreferenced
).Range value.
Range value.
Range value.
This flag specifies that the structure was generated by the Clang compiler.
Compiler mask for the flags of the structure.
This flag specifies that the structure is big-endian.
This flag specifies that the structure uses the default endianness.
This flag specifies that the structure is little-endian.
This flag specifies that the structure is big-endian.
This flag specifies that the structure uses the default endianness.
This flag specifies that the structure is little-endian.
Endianness mask for the flags of the structure.
This flag specifies that the structure was generated by the GCC compiler.
This flag specifies that the structure wasn’t generated by a specific compiler.
This flag specifies that the structure isn’t bound to specific platform.
This flag specifies that the structure has an alignment of 1.
This flag specifies that the structure has an alignment of 16.
This flag specifies that the structure has an alignment of 2.
This flag specifies that the structure has an alignment of 4.
This flag specifies that the structure has an alignment of 8.
Alignment mask for the flags of the structure.
This flag specifies that the structure doesn’t have an alignment.
Platform mask for the flags of the structure.
This flag specifies that the pointer size of the structure is 16-bits.
This flag specifies that the pointer size of the structure is 32-bits.
This flag specifies that the pointer size of the structure is 64-bits.
This flag specifies that the pointer size of the structure is the default one for the object.
Pointer mask for the flags of the structure.
This flag specifies that the structure was generated by the Visual C++ compiler.
This flag specifies that the structure was generated for the Windows platform.
If specified, makes an array of structure be null-terminated.
Scan entry type for ActionScript2.
Scan entry type for ActionScript3.
Scan entry type for application launches.
Scan entry type for attack surfaces.
Scan entry type for binary data.
Scan entry type for a blacklisted item.
Scan entry type for byte-code.
Scan entry type for Dalvik byte-code.
Scan entry type for data entries end.
Scan entry type for data entries start.
Scan entry type for debug data.
Scan entry type for decompression bombs.
Scan entry type for embedded objects.
Scan entry type for entry limits.
Scan entry type for when a file system objects exceeds the maximum size at which its files are automatically scanned.
Scan entry type for foreign data.
Scan entry type for free pages.
Scan entry type for geo-locations.
Scan entry type for hidden sheets.
Scan entry type for an intelligence report.
Scan entry type for interactive forms.
Scan entry type for invalid certificates.
Scan entry type for Java byte-code.
Scan entry type for JavaScript.
Scan entry type for MSIL byte-code.
Scan entry type for malformed data.
Scan entry type for malformed documents.
Scan entry type for meta-data.
Scan entry type for unknown meta-data.
Scan entry type for native code.
Scan entry type for failed decompression.
Scan entry type for failed decryption.
Scan entry type for successful decompression.
Scan entry type for successful decryption.
Scan entry type for personal data.
Scan entry type for required privileges.
Scan entry type for recursion.
Scan entry type for a report.
Scan entry type for issues in resources.
Scan entry type for scripts.
Scan entry type for shellcode.
Scan entry type for signature matches.
Scan entry type for spreadsheet formulas.
Scan entry type for symbolic links.
Scan entry type for thumbnails.
Scan entry type for TrueType fonts.
Scan entry type for trusted certificates.
Scan entry type for Type1 fonts.
Scan entry type for Type2 fonts.
Scan entry type for unaccounted space.
Scan entry type for unknown fonts.
Scan entry type for the decompression limit.
Scan entry type for the decompression nesting limit.
Scan entry type for unreferenced data.
Scan entry type for untrusted certificates.
Scan entry type for unverified certificates.
Scan entry type for VBA code.
Scan entry type for VBS scripts.
Scan entry type for version information.
Scan entry type for a whitelisted item.
Scan entry type for invalid checksums.
Scan entry type for invalid digests.
Scan entry type for invalid hashes.
Doesn’t include the member type (i.e.: public, protected, private) in the unmangled symbol.
Doesn’t include the calling convention in the unmangled symbol.
Doesn’t include the member type (i.e.: static, virtual, extern) in the unmangled symbol.
Doesn’t include the return type in the unmangled symbol.
Returns a simplified signature of the unmangled symbol.
Shows offsets in disassemblies shown in the text view.
Shows opcodes in disassemblies shown in the text view.
Big-endian option.
Little-endian option.
The mask for explicit object flags.
Address space format group.
Archive format group.
Audio format group.
Certificate format group.
Database format group.
Document format group.
Email format group.
Executable format group.
File system format group.
First format group.
Font format group.
Image format group.
Last format group (not included).
Managed executable format group.
Memory format group.
P2P format group.
Script format group.
System file format group.
Unknown format group.
Video format group.
This constant defines the size of a gigabyte.
Don’t sort scan providers flag.
Include dummy provider flag.
Include external scan providers flag.
Include only formats and not extensions flag.
Implicit object flag.
Invalid file or data offset.
Invalid file or data offset.
This constant defines the size of a kilobyte.
This constant defines the size of a megabyte.
Specifies the string nature of the meta-data.
Byte-array type nature.
Integer number type nature.
Real number type nature.
String type nature.
Unknown type nature.
The long date format used by the application’s locale.
The short date format specified by the application’s locale.
Creates the file only if it doesn’t already exist.
Read-only file access.
Shared write file access.
Read/write file access.
Ignores unknown flags and options.
Fifth day of the week.
ISO 8601 extended date format: either yyyy-MM-dd for dates or yyyy-MM-ddTHH:mm:ss (e.g.
Local time, controlled by a system time-zone setting.
First day of the week.
An offset in seconds from Coordinated Universal Time.
Executable memory flag.
Guarded memory flag.
Readable memory flag.
User-mode memory flag.
Writable memory flag.
Committed memory state.
Freed memory state.
Reserved memory state.
Image memory type.
Mapped memory type.
Private memory type.
RFC 2822, RFC 850 and RFC 1036 date format.
Sixth day of the week.
Seventh day of the week.
The long date format used by the operating system.
The short date format used by the operating system.
Date format equivalent to using the date format string
"ddd MMM d yyyy"
.Fourth day of the week.
A named time zone.
Second day of the week.
Coordinated Universal Time.
Third day of the week.
Returned if an allocation error occurred.
Returned if no error occurred.
Returned if a parse error occurred.
Returned if an unknown error occurred.
Parses malformed XML data.
Ignores XML node namespaces.
Returned if invalid flags were specified.
Returned if an invalid node was specified.
Returned if an invalid type was specified.
Address space flag for block I/O.
Address space flag to ignore invalid pages.
Address space flag for sparse address spaces.
Address space flag for process memory.
Address space standard flag which combines all supported flags.
Address space standard flag for dirty pages.
Address space standard flag for executable pages.
Address space standard flag for guarded pages.
Address space standard flag for readable/present pages.
Address space standard flag for transitional pages.
Address space standard flag for user mode pages.
Address space standard flag for writable pages.
Address space result for unsuccessful operations.
Address space result for successful operations.
Address space result for unsupported operations.
File attribute flag.
File attribute flag.
File attribute flag.
File attribute flag.
File attribute flag.
File attribute flag.
Applies a shared library extension to the file name (e.g.:
".dll"
on Windows and".dylib"
on macOS).Applies a binary extension to the file name (i.e.,
".exe"
on Windows).Applies a link extension to the file name (i.e.,
".lnk"
on Windows).Retrieves the application directory.
Retrieves the AppData directory on Windows.
Retrieves the application directory.
Retrieves the AppMenu directory on Windows.
Retrieves the applications directory on Windows.
Retrieves the x86 applications directory on Windows.
Retrieves the shared AppMenu directory on Windows.
Retrieves the shared desktop directory on Windows.
Retrieves the current working directory.
Retrieves the desktop directory.
Retrieves the documents directory.
Retrieves the home directory.
Retrieves the root directory (i.e.,
"/"
on Linux/macOS and"C:/"
on Windows).Retrieves the default system temporary directory.
Retrieves the temporary directory.
Maximum memory address for memory regions.
All process access privileges.
Process read access privileges.
Process termination access privileges.
Object flag.
Object flag.
Object flag.
Object flag.
Object flag.
Object flag.
Object flag.
Object flag.
File extension for an unpacked project.
Name of the main project database.
File extension for a packed project.
Name of the internal files database.
Name of the internal files path.
The prefix used to reference internal files from root entries.
Name of the object database.
File signature for a packed project.
Current project version.
Specifies that the returned data is big-endian.
Carbon view.
Cell table view.
Chart view.
Specifies that the returned data is ascii.
Codec mask for the returned data.
Specifies that the returned data is ucs-2.
Specifies that the returned data is ucs-4.
Specifies that the returned data is utf-16.
Specifies that the returned data is utf-32.
Specifies that the returned data is utf-8.
Specifies that the returned data is JavaScript code.
Code mask for the returned data.
Specifies no code type for the returned data.
Specifies that the returned data is VBA code.
Specifies that the returned data is VBS code.
Custom view.
Second custom view.
Third custom view.
Fourth custom view.
Fifth custom view.
Specifies that the returned data is utf-16 is not shared among the views.
Endianness mask for the returned data.
File info view.
File system view.
Geo-location view.
Hex view.
Key-value view.
Specifies that the returned data is little-endian.
List view.
Specifies that the returned data is middle-endian.
Media view.
Invalid view.
Plot view.
Raw hex view.
Table view.
Text view.
Text browser view.
Tree view.
Web view.
Scan entry category for embedded objects.
Scan entry category for information.
Scan entry category for intrinsic threats.
Scan entry category for online entries.
Scan entry category for privacy issues.
Scan entry category for threats.
Scan entry category for warnings.
Scan provider time type for file access.
Scan provider time type for file creation.
Scan provider time type for file modification.
This constant defines the size of a terabyte.
The special name of the header file associated with the report.
The file name of the header file associated with the report.
Base value for type nature.
Checks for the existence of the directory.
Creates the directory if missing.
Returns the requested directory without checking for its existence or creating it if missing.
Classes:
CFFBuffer
(object, offset, method)This class provides buffered read capability for
CFFObject
.This is a derived class from
NTContainer
which can reference data asCFFObject
andCFFStruct
.List of
CFFContainer
elements.
CFFContainerListIt
(obj)Iterator class for
CFFContainerList
.This class is used internally by
CFFStruct
to store information from members which affect the position and size of other members.
CFFDB
()This class creates a volatile tree structure that is either stored in memory or on disk.
CFFFlags
()This class contains flags and options for a member of
CFFStruct
.This class is the return value of
CFFObject.GetKey()
.List of
CFFGetKeyResult
elements.Iterator class for
CFFGetKeyResultList
.This class represents a header.
Alias data of a header file.
Structure data of a header file.
Type definition data of a header file.
CFFInitParams
(wo, options)This class contains the initialization parameters for the
CFFObject.Initialize()
method.This class represents a key index.
The class from which every format class is derived (ZipObject, PEObject, etc.).
This class represents a data structure and references a
CFFObject
instance.
CFFStructIt
(s)Iterator for an array of
CFFStruct
structures.List of
CFFStruct
elements.
CFFStructListIt
(obj)Iterator class for
CFFStructList
.
CFSEntry
(iface)Wrapper class for a
CFSEntryInterface
instance.This class represents a single file system entry.
CFSInstance
(iface)Wrapper class for a
CFSInterface
instance.This class represents a file system interface
CFSIterator
(iface)Wrapper class for a
CFSIteratorInterface
instance.This class represents a file system iterator.
CFSList
(iface)Wrapper class for a
CFSListInterface
instance.This class represents a file system list.
CFSNonRecursiveEnum
(inst_or_intf, …)This class serves the purpose of enumerating files without using recursion.
Logic providers return classes derived from this class to define a scanning behaviour.
This class contains information about the file to scan returned by classes derived from
CommonSystem
.The information about a format item returned by
ScanProvider._formatViewInfo()
.Tree of
FormatTreeNode
nodes.This class represents a node of
FormatTree
.List of
FormatTreeNode
elements.
FormatTreeNodeListIt
(obj)Iterator class for
FormatTreeNodeList
.
KROffset
()Match for a byte search in
NTContainer
.
Layout
()Layouts are used to create ranges and associate structures to hex views.
This class contains the data of a layout entry.
This class represents a layout interval.
LayoutPair
(t1, t2)Pair of (
LayoutInterval
,LayoutData
) elements.List of
LayoutPair
elements.
LayoutPairListIt
(obj)Iterator class for
LayoutPairList
.
CommonSystem
derived class used to perform local file system scans.This class is used to apply address spaces to containers.
NTBuffer
()Base class for buffered read operations.
List of
bytes
elements.
NTByteArrayListIt
(obj)Iterator class for
NTByteArrayList
.This is a generic container used to encapsulate data such as files and memory.
NTContainerBuffer
(container, endianness, …)This class provides buffered read capability for
NTContainer
.
NTDate
(y, m, d)This class provides date functions.
NTDateTime
(date, time, spec)This class provides date and time functions.
List of
float
elements.
NTDoubleListIt
(obj)Iterator class for
NTDoubleList
.Vector list of
float
elements.
NTDoubleVectorIt
(obj)Iterator class for
NTDoubleVector
.
NTFileEnum
(path)This class enumerates files from a specified path.
NTIWait
()Interface for wait objects.
List of
int
elements.
NTIntListIt
(obj)Iterator class for
NTIntList
.Dictionary of
int
->BasicType
elements.
NTIntVariantHashIt
(obj)Iterator class for
NTIntVariantHash
.Vector list of
int
elements.
NTIntVectorIt
(obj)Iterator class for
NTIntVector
.List of
int
elements.
NTMaxUIntListIt
(obj)Iterator class for
NTMaxUIntList
.Tree of
NTMaxUIntTreeNode
nodes.This class represents a node of
NTMaxUIntTree
.List of
NTMaxUIntTreeNode
elements.Iterator class for
NTMaxUIntTreeNodeList
.Vector list of
int
elements.
NTMaxUIntVectorIt
(obj)Iterator class for
NTMaxUIntVector
.List of
NTMemoryInfo
elements.
NTMemoryInfoListIt
(obj)Iterator class for
NTMemoryInfoList
.List of
NTModuleInfo
elements.
NTModuleInfoListIt
(obj)Iterator class for
NTModuleInfoList
.This class defines a generic offset-size range.
List of
NTOffsetRange
elements.
NTOffsetRangeListIt
(obj)Iterator class for
NTOffsetRangeList
.List of
NTProcessInfo
elements.
NTProcessInfoListIt
(obj)Iterator class for
NTProcessInfoList
.This class implements an enumerator for memory regions.
Basic implementation of
NTIWait
.List of
str
elements.
NTStringListIt
(obj)Iterator class for
NTStringList
.
NTStringPair
(t1, t2)Pair of (
str
,str
) elements.List of
NTStringPair
elements.
NTStringPairListIt
(obj)Iterator class for
NTStringPairList
.Dictionary of
str
->str
elements.
NTStringStringHashIt
(obj)Iterator class for
NTStringStringHash
.List of
NTStringStringHash
elements.Iterator class for
NTStringStringHashList
.Dictionary of
str
->BasicType
elements.Iterator class for
NTStringVariantHash
.This is a class derived from
NTTextStream
.An interface for outputting text and mnemonics.
This is a class derived from
NTTextStream
.This class represents a single text tag.
This class represents a sorted list of text tags.
NTTime
(h, m, s, ms)This class provides clock time functionality.
NTTimer
()This class implements a fast milliseconds timer based on
NT_GetTickCount()
.List of
int
elements.
NTUInt64ListIt
(obj)Iterator class for
NTUInt64List
.Dictionary of
int
->int
elements.
NTUInt64UIntHashIt
(obj)Iterator class for
NTUInt64UIntHash
.List of
int
elements.
NTUIntListIt
(obj)Iterator class for
NTUIntList
.Tree of
NTUIntTreeNode
nodes.This class represents a node of
NTUIntTree
.List of
NTUIntTreeNode
elements.
NTUIntTreeNodeListIt
(obj)Iterator class for
NTUIntTreeNodeList
.Vector list of
int
elements.
NTUIntVectorIt
(obj)Iterator class for
NTUIntVector
.Dictionary of
int
->int
elements.
NTUShortUShortHashIt
(obj)Iterator class for
NTUShortUShortHash
.Vector list of
int
elements.
NTUShortVectorIt
(obj)Iterator class for
NTUShortVector
.Dictionary of
str
->str
elements.
NTUTF8StringHashIt
(obj)Iterator class for
NTUTF8StringHash
.List of
str
elements.
NTUTF8StringListIt
(obj)Iterator class for
NTUTF8StringList
.List of
BasicType
elements.
NTVariantListIt
(obj)Iterator class for
NTVariantList
.This is a class derived from
NTTextStream
.
NTXml
()XML parser class.
This class represents a memory region.
This class contains information about a loaded module.
This class contains information about a process.
This class contains association information for Windows PDB files.
This class provides functionality for the current context.
This class provides access to the main settings of the application.
This class represents a generic plugin.
This class represents a generic plugin interface.
List of
ProPlugin
elements.
ProPluginListIt
(obj)Iterator class for
ProPluginList
.This class provides access to settings.
This is a class derived from
NTTextStream
.This class provides SQLite-backed key -> value storage facility.
ProWebRequest
(url)This class can be used to make a web request.
Report
()This class represents a project.
This class contains the base attributes of a scan entry retrieved from the report.
This class represents a scan entry.
List of
ScanMetaDataEntry
elements.Iterator class for
ScanMetaDataEntries
.This class represents a scan meta-data entry.
This is the base class inherited by all the scan engines for the different file formats.
The base class for the
ScanProvider.visitChildren()
visitor.
ScanProviderWait
(sprovider)This class only wraps
ScanProvider.isAborted()
.This class is used as I/O container to retrieve data and UI views from a scan provider.
This class contains information about an entry in the object database.
This class contains parameters to create a window view of the object database.
Functions:
Returns the endianness of the system (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).
DemangleSymbolName
(mangled[, flags])Unmangles a decorated symbol.
MethodNameFromSimpleSignature
(signature)Extracts the function or method name from a simple signature.
NT_AppendFile
(src, copySize, dst)Appends
copySize
bytes ofsrc
file todst
file.
NT_ApplyFileExt
(fileName, filetype)Appends the default extension type for the current system specified by
filetype
tofileName
.
NT_AutoDecodeBytes
(raw)This function tries to decode raw bytes into a string using simple heuristics.
NT_CloseFile
(ntfile)Closes an open file handle.
NT_CloseModuleHandle
(ntmod)Closes the handle of a module without unloading the module.
NT_CloseProcess
(proc)Closes a process handle.
NT_ColorFromString
(str)Compute a color from an input string.
NT_CopyFile
(fileNameA, fileNameB)Copies a file.
NT_CopyFileOpen
(fileNameA, fileNameB)Copies a file.
NT_CreateDirectory
(dirName)Creates a directory.
NT_CreateDirectoryTree
(dirName)Creates a directory and all the intermediate directories leading up to that directory if not yet present.
NT_CreateFile
(FileName[, opt])Creates a file.
NT_CreateFileLink
(fileName, linkName[, descr])Creates a link (e.g.: .lnk on Windows) file.
NT_CreateTempFile
([ext, auto_delete])Creates a temporary file.
NT_DecodeAsciiBytes
(raw)This function tries to decode an ascii string using simple heuristics.
NT_DecodeAsciiBytes16
(raw, endianness)This function tries to decode an ascii wide-char string using simple heuristics.
NT_DeleteDirectory
(dirName)Deletes a directory.
NT_DeleteFile
(FileName)Deletes a file.
NT_DeleteLink
(linkName)Deletes a link (e.g.: .lnk on Windows) file.
NT_DirectoryExists
(dirName)Checks the existence of a directory.
NT_FileExists
(FileName)Checks the existence of a file.
NT_FileExtFromName
(fileName[, include_dot])Retrieves the extension of a file name (e.g.:
".exe"
).
NT_FileNameFromPath
(path)Retrieves the file name from a path.
NT_FileToBuffer
(fileName, maxSize[, readPartial])Reads a file to a memory buffer.
Converts a float value to string.
NT_FreeModule
(ntmod)Unloads a module and closes its handle.
Returns the current working directory.
Returns the name of the current module including its path.
Returns the full path of the current module.
Returns the current process id.
Returns the path of the executable of the current process.
Gets the temporary directory set for the application.
NT_GetFileAttributes
(fileName)Retrieves the attributes of a file.
NT_GetFileAttributesAsString
(fileName)Retrieves the attributes of a file as a string.
NT_GetFileName
(ntfile)Retrieves the name of a file from its handle.
NT_GetFileOwner
(fileName)Retrieves the file owner of a file.
NT_GetFilePermissionsAsString
(fileName)Retrieves the file permissions as a string.
NT_GetFilePos
(ntfile)Gets the current file position.
NT_GetFileSize
(ntfile)Gets the size of a file.
NT_GetMemoryRegions
(pid[, allocated_only, limit])Retrieves the list of memory regions allocated by the specified process.
NT_GetModule
(name)Retrieves a module from its name.
NT_GetModuleList
(pid)Retrieves the list of modules loaded in the address space of a process.
NT_GetProcessFileName
(pid_or_proc)Retrieves the path of the executable of a specified process.
NT_GetProcessId
(proc)Retrieves the process id for a process handle.
NT_GetProcessList
([only_accessible])Retrieves the current list of processes.
Retrieves a special system directory.
NT_GetSystemFileHandle
(ntfile)Returns the internal system handle of a file.
NT_GetTempFileName
([ext])Generates a temporary file name.
Returns the time passed since system boot in milliseconds.
Returns
True
if the process API is available on the current system; otherwise returnsFalse
.
NT_HexCharToByte
(ch)Converts a hex character into its corresponding integer value (e.g.:
ord('F')
->15
).Returns
True
if the current module is a shared library; otherwise returnsFalse
.
NT_IsRelativePath
(path)Checks whether a path is relative.
NT_IsSymbolicLink
(FileName)Checks whether the specified file is a symbolic link.
NT_KillProcess
(pid_or_proc[, timeout])Terminates a process.
NT_LoadModule
(name)Loads a module from disk.
NT_MakeCString
(str)Escapes a string for C (e.g.:
"Hello,\nWorld!"
becomes"Hello,\\nWorld!"
).
NT_MakeFileExecutable
(fileName)Adds executable attributes to the specified file if they’re missing.
NT_MatchFileName
(fileNameA, fileNameB)Compares two paths taking also into account the case sensitivity of the current file system.
NT_MemorySizeToString
(size[, prec])Converts a size in bytes to a string representation using byte, KB, MB or GB units.
NT_NormalizeFileName
(fileName)Replaces any backslash in a file name with a forward slash.
NT_NormalizePath
(path)Replaces any backslash in a path with a forward slash and makes sure that the path ends with a trailing forward slash.
NT_NormalizeToNative
(fileOrPath)Replaces the slashes of a file name or path with the slashes expected by the current system (i.e., backslashes on Windows and slashes on Linux/macOS).
NT_NormalizeToOrigin
(fileOrPath)Replaces the slashes of a file name or path with the slashes expected by the originating system (i.e., backslashes on Windows and slashes on Linux/macOS).
NT_OpenFile
(FileName[, opt])Opens an existing file.
NT_OpenProcess
(pid[, access])Retrieves a handle to a process.
NT_PathFromFileName
(fileName)Separates a path or file name from its trailing part.
NT_RawPathFromFileName
(fileName)Behaves exactly like
NT_PathFromFileName()
, except that it retains the slashes of the input.
NT_ReadFile
(ntfile, nBytesToRead)Reads a specified amount of bytes from a file and updates the file position.
NT_ReadProcessMemory
(proc, MemoryAddr, …)Reads the memory of a process.
NT_ResetFixedFileSize
(ntfile)Resets the fixed file size set by calling
NT_SetFixedFileSize()
.
NT_ResolveShortcut
(shortcut)Resolves the target of a link (.lnk) file.
NT_ResolveSymbol
(ntmod, symname)Resolves the symbol of a module.
NT_SetCurrentDirectory
(dirName)Sets the current working directory.
NT_SetCustomTempFolder
(path)Sets a custom temporary folder to be used by the application.
NT_SetFileAutoDelete
(ntfile, auto_delete)Sets the auto-deletion flag for the file.
NT_SetFilePos
(ntfile, FileOffset)Sets the current file position.
NT_SetFileSize
(ntfile, NewFileSize)Changes the size of a file.
NT_SetFixedFileSize
(ntfile, FixedFileSize)Sets the fixed size of a file.
NT_StripFileExt
(fileName)Strips the extension from a file name.
NT_TrashFile
(fileName[, showProgress])Moves a file to the trash.
NT_UnescapeCString
(str)Unescapes a C string (e.g.:
"Hello,\\nWorld!"
becomes"Hello,\nWorld!"
).Converts a Windows
FILETIME
toNTDateTime
.
NT_WriteFile
(ntfile, bytes)Writes the specified bytes to a file.
NT_WriteProcessMemory
(proc, MemoryAddr, bytes)Writes the memory of a process.
appDataDir
([opt])Retrieves the user data directory for the application.
applyFilters
(data, str[, waitdlg_or_wo])Applies the specified filters to an
NTContainer
and returns the resulting data as anNTContainer
.Returns the carbon themes directory.
Maps the computer file system to a
CFSInstance
instance.
cfsFileSystemEntry
(path)Maps a file system file to a
CFSEntry
instance.Returns the configuration directory.
createAddressSpace
(name[, pt_offs, arg2, arg3])Creates an address space based on a page-table.
createBlockIOAddressSpace
(total_size, page_size)Creates a block I/O address space.
createContainerFromFile
(fname)Creates an
NTContainer
object from a file on disk.
createSparseAddressSpace
([reference_as, …])Creates a sparse address space.
enableHook
(name, enable)Enables or disables the specified hook
executeFunctionInMainThread
(func[, ud, blocking])Executes a function from the main thread.
getFormatDescr
(ext)Retrieves the description for a format or extension.
getFormatExtensions
(ext)Retrieves all extensions for the specified format or extension.
Converts an extension to its format name.
getFormatGroup
(ext)Converts a format or extension to its format group.
Converts the short name to a format group.
getFormatGroupName
(group[, plural])Retrieves the user-friendly name for the format group.
getShortFormatGroupName
(group)Retrieves the short name for the format group.
Returns the list of supported file extensions.
getSupportedFormatsAndDescr
([flags])Returns a list of supported file formats and their description.
Returns the headers directory.
identifyPossibleFormats
(data)Identifies a list of possible file formats for the input data.
isExtensionSupported
(ext)Checks whether a format or extension is supported.
Returns
True
if called from the UI thread; otherwise returnsFalse
.
mediaDir
()Returns the media directory.
newContainer
([size, reserve_size, max_size])Creates a new
NTContainer
object.
ntAlpha
(rgb)Retrieves the alpha color component from an RGBA value.
ntAlphaBlend
(src, bkg)Performs an alpha blend operation on two RGBA values.
ntBlue
(rgb)Retrieves the blue color component from an RGBA value.
ntGreen
(rgb)Retrieves the green color component from an RGBA value.
ntRed
(rgb)Retrieves the read color component from an RGBA value.
ntRgb
(r, g, b)Creates an RGBA value from its red, green and blue color components.
ntRgba
(r, g, b, a)Creates an RGBA value from its red, green, blue and alpha color components.
ntShiftToColor
(source, target, fraction)Shift an RGBA value to another RGBA value.
Returns the package certificates directory.
Returns the plugins directory.
proAbort
(ret[, msg])Aborts the application with an optional message.
proAddRecentFile
(history, fname[, max_list_size])Adds a recent file name to a specified historical list.
proAddRecentItem
(history, item[, max_list_size])Adds a recent item to a specified historical list.
Returns the path of the main application.
Returns
True
if the current architecture is x64; otherwise returnsFalse
.Returns
True
if the current architecture is x86; otherwise returnsFalse
.Returns the name of the current architecture (e.g.,
'x64'
).
proClearOutput
([with_undo])Clears the output view if available.
Returns the global
ProCoreContext
instance.Crashes the application on purpose.
Returns the current disassembly options for the text view.
proGetAvailablePlugins
(config_name)Retrieves a list of generic plugins.
proGetIntPtr
(name)Retrieves an internal pointer.
proGetLine
([prompt])Retrieves an input string either by prompting a dialog box or from the terminal.
proGetRecentItems
(history)Retrieves a specified historical list.
proGetRiskBgColor
(risk, bg)Computes a color based on risk percentage.
Returns
True
if the code is running under Cerbero Engine; otherwise returnsFalse
.
proLaunchApplication
(app[, args])Launches an application.
proLaunchThisApplication
([args])Launches the main application.
Returns
True
if the current platform is Linux; otherwise returnsFalse
.Returns
True
if the current platform is macOS; otherwise returnsFalse
.Returns
True
if the current platform is Windows; otherwise returnsFalse
.Returns the name of the current platform (supported values are:
'windows'
,'linux'
and'macos'
).Returns the short name of the current platform (supported values are:
'win'
,'lin'
and'mac'
).
proPrint
(str)Prints a message to the output view.
proPrintnl
(str)Prints a message to the output view.
proProcessEvents
([ms])Processes thread loop events.
proSetReturnCode
(ret)Sets the return code for the application.
Creates a new
NTTextBuffer
instance with the default disassembly options.Returns the current version of the application as a string in the shape of major_version.minor_version.build_version.
Returns the build number of the application.
Returns the major version of the application.
Returns the minor version of the application.
Enables or disables the idle processing of Python code.
Returns the themes directory.
userCarbonThemesDir
([opt])Retrieves the user carbon themes directory.
userConfigDir
([opt])Retrieves the user configuration directory.
userHeadersDir
([opt])Retrieves the user headers directory.
userMediaDir
([opt])Retrieves the user media directory.
userPDBSymbolsDir
([opt])Retrieves the user PDB symbols directory.
userPackageCertificatesDir
([opt])Retrieves the user package certificates directory.
userPackagesDir
([opt])Retrieves the user packages directory.
userPluginsDir
([opt])Retrieves the user plugins directory.
userPythonPluginsDir
([opt])Retrieves the user Python plugins directory.
userThemesDir
([opt])Retrieves the user themes directory.
- Bufferize_BackAndForth: Final[int]¶
Buffering method for
NTBuffer
. To use when reading in both directions.
- Bufferize_Invalid: Final[int]¶
Buffering method for
NTBuffer
. Only used for uninitialized instances.See also
NTBuffer.isNull()
.
- class CFFBuffer(object: Pro.Core.CFFObject, offset: int, method: int = Bufferize_Forwards)¶
Bases:
Pro.Core.NTBuffer
This class provides buffered read capability for
CFFObject
.
- Parameters
object (CFFObject) – The object to read from.
offset (int) – The start offset to read from.
method (int) – The buffering method to use. Defaults to
Bufferize_Forwards
.See also
CFFObject.ToBuffer()
,NTBuffer
andNTContainerBuffer
.
- class CFFContainer¶
Bases:
Pro.Core.NTContainer
This is a derived class from
NTContainer
which can reference data asCFFObject
andCFFStruct
.See also
NTContainer()
,NTContainerBuffer
andNTAddressSpace
.Attributes:
Type of data internally referenced by the container.
Type of data internally referenced by the container.
Type of data internally referenced by the container.
Methods:
setData
(data[, own_or_size])Returns the internal
CFSInstance
referenced by the container if thedataType()
isFileSystem
; otherwise returns an invalidCFSInstance
instance.
toObject
()Returns the internal
CFFObject
referenced by the container if thedataType()
isObject
; otherwise returnsNone
.
toStruct
()Returns the internal
CFFStruct
referenced by the container if thedataType()
isStruct
; otherwise returns an invalid struct.
- FileSystem: Final[int]¶
Type of data internally referenced by the container.
Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.
See also
NTContainer.dataType()
.
- Object: Final[int]¶
Type of data internally referenced by the container.
See also
NTContainer.dataType()
.
- Struct: Final[int]¶
Type of data internally referenced by the container.
See also
NTContainer.dataType()
.
- setData(data: Union[CFFObject, CFFStruct, CFSInstance, NTByteArrayList, NTContainer, NTStringList, NTTextTags, NT_FILE, NT_PROCESS, bytes, int, str], own_or_size: Union[bool, int] = True) → None¶
- toFileSystem() → Pro.Core.CFSInstance¶
- Returns
Returns the internal
CFSInstance
referenced by the container if thedataType()
isFileSystem
; otherwise returns an invalidCFSInstance
instance.- Return type
Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.
See also
NTContainer.dataType()
.
- toObject() → object¶
- Returns
Returns the internal
CFFObject
referenced by the container if thedataType()
isObject
; otherwise returnsNone
.- Return type
See also
NTContainer.dataType()
.
- toStruct() → Pro.Core.CFFStruct¶
- Returns
Returns the internal
CFFStruct
referenced by the container if thedataType()
isStruct
; otherwise returns an invalid struct.- Return type
See also
NTContainer.dataType()
.
- class CFFContainerList¶
List of
CFFContainer
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: Pro.Core.CFFContainer) → None¶
Inserts
value
at the end of the list.
- Parameters
value (CFFContainer) – The value to add to the list.
See also
insert()
.
- at(i: int) → Pro.Core.CFFContainer¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
- clear() → None¶
Removes all items from the list.
- contains(value: Pro.Core.CFFContainer) → bool¶
Checks the presence of an element in the list.
- Parameters
value (CFFContainer) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: Pro.Core.CFFContainer) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (CFFContainer) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: Pro.Core.CFFContainer, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (CFFContainer) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: Pro.Core.CFFContainer) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (CFFContainer) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.CFFContainerListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: Pro.Core.CFFContainer) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (CFFContainer) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → Pro.Core.CFFContainer¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
See also
removeAt()
.
- class CFFContainerListIt(obj: Pro.Core.CFFContainerList)¶
Iterator class for
CFFContainerList
.
- Parameters
obj (CFFContainerList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → Pro.Core.CFFContainer¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
See also
hasNext()
andprevious()
.
- previous() → Pro.Core.CFFContainer¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class CFFContext¶
This class is used internally by
CFFStruct
to store information from members which affect the position and size of other members.See also
CFFStruct.Context()
andCFFStruct.SetContext()
.Methods:
set
(key, val)Sets a value of the context.
value
(key)Retrieves a value from the context.
- class CFFDB¶
This class creates a volatile tree structure that is either stored in memory or on disk.
Indexes for the tree can either be 32-bit (
CFFDBIndexSize32
) or 64-bit (CFFDBIndexSize64
).Every item in the tree has fixed-size data. If no data size is specified when creating the tree, the fixed data size will be the same as the index size.
This class does not support the removal of items from the tree.
Methods:
AppendChild
([parent])Appends an item.
Children
(index)Returns the number of children for the specified index.
Data
(index)Retrieves the data of an item.
Data32
(index)Retrieves the data of an item as a 32-bit value.
Data64
(index)Retrieves the data of an item as a 64-bit value.
Index
(pos[, parent])Returns the index of an item given its parent and it’s position relative to its siblings.
InsertChild
(pos[, parent])Inserts an item given its parent and position relative to its siblings.
InsertChildren
(pos, count[, parent])Inserts multiple items given their parent and position relative to their siblings.
IsNull
()Returns
True
if invalid; otherwise returnsFalse
.
IsValid
()Returns
True
if valid; otherwise returnsFalse
.
Next
(current)Gets the next item in the tree.
Open
([fixed_data_size, idxsize])Initializes a
CFFDB
.
Parent
(index)Returns the parent of an item.
Position
(index)Returns the position of an item relative to its siblings.
PrependChild
([parent])Prepends an item.
Previous
(current)Gets the previous item in the tree.
SetData
(index, value)Sets the data of an item.
SetData32
(index, value)Sets the data of an item as a 32-bit value.
SetData64
(index, value)Sets the data of an item as a 64-bit value.
- AppendChild(parent: int = 0) → int¶
Appends an item.
- Parameters
parent (int) – The parent index of the item to append.
- Returns
Returns the index of the added child item if successful; otherwise returns
CFFDBInvalidIndex
.- Return type
int
See also
PrependChild()
andInsertChild()
.
- Children(index: int) → int¶
Returns the number of children for the specified index.
- Parameters
index (int) – The index of the item for which to retrieve the number of children.
- Returns
Returns the number of children.
- Return type
int
See also
Position()
,Parent()
andIndex()
.
- Data(index: int) → tuple¶
Retrieves the data of an item.
- Parameters
index (int) – The index of the item for which to retrieve the data.
- Returns
Returns a tuple containing the retrieved data and a boolean. The boolean value is
True
if successful; otherwise it isFalse
.- Return type
tuple[bytes, bool]
- Data32(index: int) → tuple¶
Retrieves the data of an item as a 32-bit value.
- Parameters
index (int) – The index of the item for which to retrieve the data.
- Returns
Returns a tuple containing the retrieved data value and a boolean. The boolean value is
True
if successful; otherwise it isFalse
.- Return type
tuple[int, bool]
See also
SetData32()
,Data()
andData64()
.
- Data64(index: int) → tuple¶
Retrieves the data of an item as a 64-bit value.
- Parameters
index (int) – The index of the item for which to retrieve the data.
- Returns
Returns a tuple containing the retrieved data value and a boolean. The boolean value is
True
if successful; otherwise it isFalse
.- Return type
tuple[int, bool]
See also
SetData64()
,Data()
andData32()
.
- Index(pos: int, parent: int = 0) → int¶
Returns the index of an item given its parent and it’s position relative to its siblings.
- Parameters
pos (int) – The position of the item relative to its siblings.
parent (int) – The index of the parent item.
- Returns
Returns the requested index if successful; otherwise returns
CFFDBInvalidIndex
.- Return type
int
See also
Parent()
,Position()
andChildren()
.
- InsertChild(pos: int, parent: int = 0) → int¶
Inserts an item given its parent and position relative to its siblings.
- Parameters
pos (int) – The position of the item to insert relative to its siblings.
parent (int) – The index of the parent item.
- Returns
Returns the index of the added child item if successful; otherwise returns
CFFDBInvalidIndex
.- Return type
int
See also
InsertChildren()
,AppendChild()
andPrependChild()
.
- InsertChildren(pos: int, count: int, parent: int = 0) → bool¶
Inserts multiple items given their parent and position relative to their siblings.
- Parameters
pos (int) – The position of the items to insert relative to their siblings.
count (int) – The number of items to insert.
parent (int) – The index of the parent item.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
InsertChild()
,AppendChild()
andPrependChild()
.
- IsNull() → bool¶
- Returns
Returns
True
if invalid; otherwise returnsFalse
.- Return type
bool
- IsValid() → bool¶
- Returns
Returns
True
if valid; otherwise returnsFalse
.- Return type
bool
- Next(current: int) → int¶
Gets the next item in the tree.
This method enumerates parent and child items.
- Parameters
current (int) – The current index.
- Returns
Returns the index if successful; otherwise returns
CFFDBInvalidIndex
.- Return type
int
See also
Previous()
.
- Open(fixed_data_size: int = 0, idxsize: int = CFFDBIndexSize32) → bool¶
Initializes a
CFFDB
.
- Parameters
fixed_data_size (int) – The size of the data associated with each item. If
0
, it defaults to the index size.idxsize (int) – The index size.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
- Parent(index: int) → int¶
Returns the parent of an item.
- Parameters
index (int) – The index of the item for which to retrieve the parent.
- Returns
Returns the parent index if successful; otherwise returns
CFFDBInvalidIndex
.- Return type
int
See also
Index()
,Position()
andChildren()
.
- Position(index: int) → int¶
Returns the position of an item relative to its siblings.
- Parameters
index (int) – The index of the item for which to retrieve the relative position.
- Returns
Returns the position if successful; otherwise returns
CFFDBInvalidIndex
.- Return type
int
See also
Children()
,Index()
andParent()
.
- PrependChild(parent: int = 0) → int¶
Prepends an item.
- Parameters
parent (int) – The parent index of the item to prepend.
- Returns
Returns the index of the added child item if successful; otherwise returns
CFFDBInvalidIndex
.- Return type
int
See also
AppendChild()
andInsertChild()
.
- Previous(current: int) → int¶
Gets the previous item in the tree.
This method enumerates parent and child items.
- Parameters
current (int) – The current index.
- Returns
Returns the index if successful; otherwise returns
CFFDBInvalidIndex
.- Return type
int
See also
Next()
.
- SetData(index: int, value: bytes) → bool¶
Sets the data of an item.
The size of
value
must match the size of the data specified when initializing the tree (SeeOpen()
).
- Parameters
index (int) – The index of the item for which to set the data.
value (bytes) – The data to set.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
Data()
,SetData32()
andSetData64()
.
- SetData32(index: int, value: int) → bool¶
Sets the data of an item as a 32-bit value.
- Parameters
index (int) – The index of the item for which to set the data.
value (int) – The 32-bit value to set.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
Data32()
,SetData()
andSetData64()
.
- SetData64(index: int, value: int) → bool¶
Sets the data of an item as a 64-bit value.
- Parameters
index (int) – The index of the item for which to set the data.
value (int) – The 64-bit value to set.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
Data64()
,SetData()
andSetData32()
.
- class CFFFlags¶
This class contains flags and options for a member of
CFFStruct
.Methods:
Count
()Returns the number of flags and options available.
Description
(i)Retrieves the description of a flag or option.
IsFlag
(value, i_or_name)Checks if a flag or option is set in the input value.
IsNull
()Returns
True
if theCFFFlags
instance is invalid; otherwise returnsFalse
.Returns
True
if the currentCFFFlags
instance contains only options and not flags; otherwise returnsFalse
.
IsValid
()Returns
True
if theCFFFlags
instance is valid; otherwise returnsFalse
.
Name
(i)Retrieves the name of a flag or option.
Output
(out, value[, opt, sep])Outputs the flags and options set in the input value to a text stream .
Position
(name)Retrieves the position of a flag or option by its name.
Retrieves the short description of a flag or option.
Type
([i])Retrieves the type of the
CFFFlags
instance or the type of one of its members.
Value
(i)Retrieves the value of a flag or option.
ValueDescription
(value)Retrieves the description for the input value.
ValueName
(value)Retrieves the name for the input value.
- Count() → int¶
- Returns
Returns the number of flags and options available.
- Return type
int
- Description(i: int) → str¶
Retrieves the description of a flag or option.
- Parameters
i (int) – The index of the flag or option.
- Returns
Returns the description if available; otherwise returns an empty string.
- Return type
str
See also
ShortDescription()
,Name()
andValue()
.
- IsFlag(value: int, i_or_name: Union[int, str]) → bool¶
Checks if a flag or option is set in the input value.
- Parameters
value (int) – The input value.
i_or_name (Union[int, str]) – The index or name of the flag or option.
- Returns
Returns
True
if the flag or option is set in the input value; otherwise returnsFalse
.- Return type
bool
- IsNull() → bool¶
- Returns
Returns
True
if theCFFFlags
instance is invalid; otherwise returnsFalse
.- Return type
bool
See also
IsValid()
.
- IsOptionsOnly() → bool¶
- Returns
Returns
True
if the currentCFFFlags
instance contains only options and not flags; otherwise returnsFalse
.- Return type
bool
See also
ValueDescription()
.
- IsValid() → bool¶
- Returns
Returns
True
if theCFFFlags
instance is valid; otherwise returnsFalse
.- Return type
bool
See also
IsNull()
.
- Name(i: int) → str¶
Retrieves the name of a flag or option.
- Parameters
i (int) – The index of the flag or option.
- Returns
Returns the name of the flag or option if successful; otherwise returns an empty string.
- Return type
str
- Output(out: Pro.Core.NTTextStream, value: int, opt: int = 0, sep: Optional[str] = None) → None¶
Outputs the flags and options set in the input value to a text stream .
- Parameters
out (NTTextStream) – The text stream.
value (int) – The input value.
opt (int) – The output options.
NTFlagOutput_IgnoreUnknown
can be specified to ignore unknown flags.sep (Optional[str]) – The separator for the output. Defaults to
" | "
.See also
NTTextStream
andShortDescription()
.
- Position(name: str) → int¶
Retrieves the position of a flag or option by its name.
- Parameters
name (str) – The name of the flag or option.
- Returns
Returns the index of the flag or option if successful; otherwise returns
-1
.- Return type
int
- ShortDescription(i: int) → str¶
Retrieves the short description of a flag or option.
- Parameters
i (int) – The index of the flag or option.
- Returns
Returns the short description if available; otherwise returns an empty string.
- Return type
str
See also
Description()
,Name()
andValue()
.
- Type(i: Optional[int] = None) → int¶
Retrieves the type of the
CFFFlags
instance or the type of one of its members.
- Parameters
i (Optional[int]) – The index of the flag or option.
- Returns
Returns the requested type if successful; otherwise returns
0
.- Return type
int
- Value(i: int) → int¶
Retrieves the value of a flag or option.
- Parameters
i (int) – The index of the flag or option.
- Returns
Returns the value if successful; otherwise returns
0
.- Return type
int
See also
Name()
andDescription()
.
- ValueDescription(value: int) → str¶
Retrieves the description for the input value.
This method works only if the
CFFFlags
instance contains only options (SeeIsOptionsOnly()
).
- Parameters
value (int) – The input value.
- Returns
Returns the value description if successful; otherwise returns an empty string.
- Return type
str
See also
ValueName()
,IsOptionsOnly()
andOutput()
.
- ValueName(value: int) → str¶
Retrieves the name for the input value.
This method works only if the
CFFFlags
instance contains only options (SeeIsOptionsOnly()
).
- Parameters
value (int) – The input value.
- Returns
Returns the value description if successful; otherwise returns an empty string.
- Return type
str
Available since Cerbero Suite 7.3 and Cerbero Engine 4.3.
See also
ValueDescription()
,IsOptionsOnly()
andOutput()
.
- class CFFGetKeyResult¶
This class is the return value of
CFFObject.GetKey()
.Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.
See also
CFFObject.GetKey()
.Attributes:
The key data.
The key type (e.g.,
CFFKT_Pass
).
- data¶
The key data.
- key_type¶
The key type (e.g.,
CFFKT_Pass
).
- class CFFGetKeyResultList¶
List of
CFFGetKeyResult
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: Pro.Core.CFFGetKeyResult) → None¶
Inserts
value
at the end of the list.
- Parameters
value (CFFGetKeyResult) – The value to add to the list.
See also
insert()
.
- at(i: int) → Pro.Core.CFFGetKeyResult¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
- clear() → None¶
Removes all items from the list.
- contains(value: Pro.Core.CFFGetKeyResult) → bool¶
Checks the presence of an element in the list.
- Parameters
value (CFFGetKeyResult) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: Pro.Core.CFFGetKeyResult) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (CFFGetKeyResult) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: Pro.Core.CFFGetKeyResult, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (CFFGetKeyResult) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: Pro.Core.CFFGetKeyResult) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (CFFGetKeyResult) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.CFFGetKeyResultListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: Pro.Core.CFFGetKeyResult) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (CFFGetKeyResult) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → Pro.Core.CFFGetKeyResult¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
See also
removeAt()
.
- class CFFGetKeyResultListIt(obj: Pro.Core.CFFGetKeyResultList)¶
Iterator class for
CFFGetKeyResultList
.
- Parameters
obj (CFFGetKeyResultList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → Pro.Core.CFFGetKeyResult¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
See also
hasNext()
andprevious()
.
- previous() → Pro.Core.CFFGetKeyResult¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class CFFHeader¶
This class represents a header.
Headers contain definition of structures and can be loaded from SQLite files or XML strings. The structures can be imported from C/C++ code through the Header Manager or from debug symbols such as PDB files.
Important
Editing is supported only for SQLite-backed headers.
Example:
from Pro.Core import * xml_header = """<header> <r id='_IMAGE_DOS_HEADER' type='struct'> <f id='e_magic' type='unsigned short'/> <f id='e_cblp' type='unsigned short'/> <f id='e_cp' type='unsigned short'/> <f id='e_crlc' type='unsigned short'/> <f id='e_cparhdr' type='unsigned short'/> <f id='e_minalloc' type='unsigned short'/> <f id='e_maxalloc' type='unsigned short'/> <f id='e_ss' type='unsigned short'/> <f id='e_sp' type='unsigned short'/> <f id='e_csum' type='unsigned short'/> <f id='e_ip' type='unsigned short'/> <f id='e_cs' type='unsigned short'/> <f id='e_lfarlc' type='unsigned short'/> <f id='e_ovno' type='unsigned short'/> <f id='e_res' type='unsigned short [4]'/> <f id='e_oemid' type='unsigned short'/> <f id='e_oeminfo' type='unsigned short'/> <f id='e_res2' type='unsigned short [10]'/> <f id='e_lfanew' type='int'/> </r> </header>""" def printStructure(fname): c = createContainerFromFile(fname) if c.isNull(): return # load header from an XML string header = CFFHeader() if not header.LoadFromXml(xml_header): return obj = CFFObject() # since CFFObject is not subclassed, the Load method cannot fail obj.Load(c) # map a structure to a specific offset offset = 0 s = obj.MakeStruct(header, "_IMAGE_DOS_HEADER", offset, CFFSO_VC | CFFSO_Pack1) out = NTTextBuffer() s.Dump(out) print(out.buffer)See also
CFFStruct
andCFFObject
.Attributes:
Alias category for a definition.
Alias category for an enumerator.
Alias category terminator.
Alias integer value type.
Alias terminator value type.
Alias floating point value type.
Alias string value type.
Methods:
Begins an SQLite transaction.
Close
()Clears the current instance.
EndEdit
()Ends an SQLite transaction.
Equals
(s)Checks whether two headers reference the same internal data.
GetACName
(category)Retrieves the alias category name.
GetAVTName
(vtype)Retrieves the alias value type name.
Returns the number of alias in the header.
GetAliasData
(i)Retrieves the data for an alias.
Returns the SQLite handle if the header is backed by SQLite internally; otherwise returns
None
.Retrieves the basic data of a structure.
Returns the number of structures in the header.
GetStructData
(i_or_name)Retrieves the data of a structure.
Returns the number of type definitions in the header.
Retrieves the data of a type definition.
InsertAlias
(name, category, type, vtype, value)Inserts or replaces an alias in the header file.
InsertStruct
(schema)Inserts or replaces a structure in the header file.
InsertTypeDef
(name, type)Inserts or replaces a type definition in the header file.
Returns
True
if the header was modified; otherwise returnsFalse
.
IsNull
()Returns
True
if the header is invalid; otherwise returnsFalse
.
IsValid
()Returns
True
if the header is valid; otherwise returnsFalse
.
LoadFromFile
(name)Loads a header file from an SQLite database.
LoadFromXml
(xml)Initializes a header instance from XML data.
SetModified
(b)Sets the modified status for the header file.
- AC_Define: Final[int]¶
Alias category for a definition.
- AC_Enum: Final[int]¶
Alias category for an enumerator.
- AC_Last: Final[int]¶
Alias category terminator.
- AVT_Integer: Final[int]¶
Alias integer value type.
- AVT_Last: Final[int]¶
Alias terminator value type.
- AVT_Real: Final[int]¶
Alias floating point value type.
- AVT_String: Final[int]¶
Alias string value type.
- BeginEdit() → None¶
Begins an SQLite transaction.
See also
EndEdit()
andInsertStruct()
.
- Close() → None¶
Clears the current instance.
See also
LoadFromFile()
andLoadFromXml()
.
- EndEdit() → None¶
Ends an SQLite transaction.
See also
BeginEdit()
andInsertStruct()
.
- Equals(s: Pro.Core.CFFHeader) → bool¶
Checks whether two headers reference the same internal data.
- Parameters
s (CFFHeader) – The other header.
- Returns
Returns
True
if the two headers reference the same internal data; otherwise returnsFalse
.- Return type
bool
- static GetACName(category: int) → str¶
Retrieves the alias category name.
- Parameters
category (int) – The alias category.
- Returns
Returns the name of the alias category if successful; otherwise returns an empty string.
- Return type
str
See also
GetAVTName()
.
- static GetAVTName(vtype: int) → str¶
Retrieves the alias value type name.
- Parameters
vtype (int) – The alias value type.
- Returns
Returns the name of the alias value type if successful; otherwise returns an empty string.
- Return type
str
See also
GetACName()
.
- GetAliasCount() → int¶
- Returns
Returns the number of alias in the header.
- Return type
int
See also
GetAliasData()
andInsertAlias()
.
- GetAliasData(i: int) → Pro.Core.CFFHeaderAliasData¶
Retrieves the data for an alias.
- Parameters
i (int) – The index of the alias.
- Returns
Returns the data of the alias if successful; otherwise returns an empty data structure.
- Return type
See also
GetAliasCount()
andInsertAlias()
.
- GetSQLiteDB() → sqlite3¶
- Returns
Returns the SQLite handle if the header is backed by SQLite internally; otherwise returns
None
.- Return type
sqlite3
- GetStructBaseData(i: int) → Pro.Core.CFFHeaderStructData¶
Retrieves the basic data of a structure.
The difference with
GetStructData()
is that the XML schema of the structure is not retrieved. Therefore, this method is a bit faster.
- Parameters
i (int) – The index of the structure.
- Returns
Returns the data of the structure if successful; otherwise returns an empty data structure.
- Return type
See also
GetStructData()
,GetStructCount()
andInsertStruct()
.
- GetStructCount() → int¶
- Returns
Returns the number of structures in the header.
- Return type
int
See also
GetStructData()
andInsertStruct()
.
- GetStructData(i_or_name: Union[int, str]) → Pro.Core.CFFHeaderStructData¶
Retrieves the data of a structure.
- Parameters
i_or_name (Union[int, str]) – The name or the index of the structure.
- Returns
Returns the data of the structure if successful; otherwise returns an empty data structure.
- Return type
See also
GetStructBaseData()
,GetStructCount()
andInsertStruct()
.
- GetTypeDefCount() → int¶
- Returns
Returns the number of type definitions in the header.
- Return type
int
See also
GetTypeDefData()
andInsertTypeDef()
.
- GetTypeDefData(i: int) → Pro.Core.CFFHeaderTypeDefData¶
Retrieves the data of a type definition.
- Parameters
i (int) – The index of the type definition.
- Returns
Returns the data of the type definition if successful; otherwise returns an empty data structure.
- Return type
See also
GetTypeDefCount()
andInsertTypeDef()
.
- InsertAlias(name: str, category: int, type: str, vtype: int, value: str) → None¶
Inserts or replaces an alias in the header file.
This method is supported only by SQLite-backed header files.
- Parameters
name (str) – The name of the alias.
category (int) – The category of the alias.
type (str) – The type of the alias.
vtype (int) – The value type of the alias.
value (str) – The value of the alias.
See also
GetAliasData()
andGetAliasCount()
.
- InsertStruct(schema: str) → None¶
Inserts or replaces a structure in the header file.
This method is supported only by SQLite-backed header files.
- Parameters
schema (str) – The XML schema of the structure.
See also
GetStructData()
andGetStructCount()
.
- InsertTypeDef(name: str, type: str) → None¶
Inserts or replaces a type definition in the header file.
This method is supported only by SQLite-backed header files.
- Parameters
name (str) – The name of the type definition.
type (str) – The type definition.
See also
GetTypeDefData()
andGetTypeDefCount()
.
- IsModified() → bool¶
- Returns
Returns
True
if the header was modified; otherwise returnsFalse
.- Return type
bool
See also
SetModified()
.
- IsNull() → bool¶
- Returns
Returns
True
if the header is invalid; otherwise returnsFalse
.- Return type
bool
See also
IsValid()
.
- IsValid() → bool¶
- Returns
Returns
True
if the header is valid; otherwise returnsFalse
.- Return type
bool
See also
IsNull()
.
- LoadFromFile(name: str) → bool¶
Loads a header file from an SQLite database.
- Parameters
name (str) – The name of the header file.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
LoadFromXml()
.
- LoadFromXml(xml: Union[Pro.Core.NTXml, str]) → bool¶
Initializes a header instance from XML data.
- Parameters
xml (Union[NTXml, str]) – Either an XML string or an
NTXml
instance.- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
LoadFromFile()
.
- SetModified(b: bool) → None¶
Sets the modified status for the header file.
- Parameters
b (bool) – If
True
, the header file is marked as modified.See also
IsModified()
.
- class CFFHeaderAliasData¶
Alias data of a header file.
See also
CFFHeader
.Attributes:
The category of the alias.
The name of the alias.
The type of the alias.
The value of the alias.
The value type of the alias.
- category¶
The category of the alias.
- name¶
The name of the alias.
- type¶
The type of the alias.
- value¶
The value of the alias.
- vtype¶
The value type of the alias.
- class CFFHeaderStructData¶
Structure data of a header file.
See also
CFFHeader
.Attributes:
The name of the structure.
The XML schema of the structure.
The type of the structure.
- name¶
The name of the structure.
- schema¶
The XML schema of the structure.
- type¶
The type of the structure.
- class CFFHeaderTypeDefData¶
Type definition data of a header file.
See also
CFFHeader
.Attributes:
The name of the type definition.
The type definition.
- name¶
The name of the type definition.
- type¶
The type definition.
- class CFFInitParams(wo: Optional[Pro.Core.NTIWait] = None, options: int = 0)¶
This class contains the initialization parameters for the
CFFObject.Initialize()
method.
- Parameters
wo (NTIWait) – The wait object.
options (int) – The parsing options.
Attributes:
This flag instructs the parser not to decrypt the file.
This flag instructs the parser to avoid parsing malformed data.
A boolean that signals the presence of a wait object that isn’t the default dummy one.
The maximum number of allowed child entries.
Options for the parser (e.g.,
StrictParser
).The wait object for operation.
- DontDecrypt: Final[int]¶
This flag instructs the parser not to decrypt the file.
Note
The parser might choose to ignore this flag.
See also
options
.
- StrictParser: Final[int]¶
This flag instructs the parser to avoid parsing malformed data.
Note
The parser might choose to ignore this flag.
See also
options
.
- has_wo¶
A boolean that signals the presence of a wait object that isn’t the default dummy one.
See also
wo
.
- max_children¶
The maximum number of allowed child entries.
- options¶
Options for the parser (e.g.,
StrictParser
).
- CFFKST_Raw: Final[int]¶
Key sub-type raw.
Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.
- CFFKST_String: Final[int]¶
Key sub-type string.
Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.
- CFFKST_UTF8: Final[int]¶
Key sub-type utf-8.
Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.
- CFFKT_Cert: Final[int]¶
Key type certificate.
Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.
See also
CFFGetKeyResult
.
- CFFKT_Invalid: Final[int]¶
Key type invalid.
Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.
See also
CFFGetKeyResult
.
- CFFKT_Pass: Final[int]¶
Key type password.
Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.
See also
CFFGetKeyResult
.
- class CFFKeyIndex¶
This class represents a key index.
Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.
See also
CFFObject.GetKey()
andCFFObject.KeyMatch()
.
- CFFN_Base: Final[int]¶
Base value for standard
CFFObject
notifications.See also
CFFObject.Notify()
.
- CFFN_Malformed: Final[int]¶
CFFObject
notification for malformed data.See also
CFFObject.Notify()
.
- CFFN_MoreFiles: Final[int]¶
CFFObject
notification for the file limit.See also
CFFObject.Notify()
.
- CFFN_NoDecrypt: Final[int]¶
CFFObject
notification for failed decryption.See also
CFFObject.Notify()
.
- CFFN_NoUnpack: Final[int]¶
CFFObject
notification for failed decompression.See also
CFFObject.Notify()
.
- CFFN_ParsingLimit: Final[int]¶
CFFObject
notification for an internal parsing limit.See also
CFFObject.Notify()
.
- CFFN_Recursive: Final[int]¶
CFFObject
notification for recursion.See also
CFFObject.Notify()
.
- CFFN_UnpackLimit: Final[int]¶
CFFObject
notification for the decompression limit.See also
CFFObject.Notify()
.
- CFFN_UnpackNestLimit: Final[int]¶
CFFObject
notification for the decompression nesting limit.See also
CFFObject.Notify()
.
- class CFFObject¶
Bases:
Pro.Core.CFSInterface
The class from which every format class is derived (ZipObject, PEObject, etc.).
The internal data of a
CFFObject
is anNTContainer
(SeeLoad()
).See also
NTContainer
,CFFStruct
,CFFHeader
andCFFBuffer
.Methods:
AdjustSign
(type, num)Makes the input number negative if the last bit is set and the input type is an integer.
Align
(AlignConst)Aligns the object to the specified size.
AppendTo
(nStartOffset, nLenght, pDst)Appends part of this object to a container.
Compare
(offset, bytes_or_uSize[, b])Compares the specified data to the one in the object.
CopyFrom
(Src, nDstOffset, nLenght[, …])Copies data from a container to the object.
CopyTo
(nStartOffset, nLenght, pDst[, …])Copies a part of the object to a container.
CustomKeyMatch
(kr)Marks a custom key as successfully having being used for decryption.
Disables ranges.
EnableRanges
(bits_per_element, granularity)Creates a range bit mask for the current object.
Fill
(offset, c, uSize)Fills a portion of the object with the specified byte.
Returns the default endianness of the object (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).Returns the default options for
CFFStruct
instances created from this object (e.g.,CFFSO_Pack1
).
GetKey
(ki, accepted_keys[, converter])Retrieves a decryption key.
Returns the list of matched decryption keys.
Returns the address at which this object is mapped if available; otherwise returns
INVALID_STREAM_OFFSET
.Returns the maximum amount of bytes which can be allocated for in-memory decompression algorithms.
Returns the file format name of the object if available; otherwise returns an empty string.
Returns the generic format name of the object if available; otherwise returns an empty string (e.g., the generic format name of HTML is XML).
Returns the name of the object if available; otherwise returns an empty string.
Returns the type name of the object if available; otherwise returns an empty string.
GetSize
()Returns the size of the internally referenced container.
GetSpecialData
(key[, defval])Retrieves special data associated to the object.
Returns the internally referenced container.
GetSubStream
(offset_or_range[, …])Retrieves a sub-stream of the internally referenced container.
GetTag
()Returns the tag name set for debugging purposes if present; otherwise returns an empty string.
GetTypeName
(Type)Returns the name of the specified type.
GetTypeNature
(Type)Returns the nature of the specified type.
Returns the limit for decompression operations.
Returns the nesting limit for decompression operations.
Returns
True
if file system support is available; otherwise returnsFalse
.
Initialize
([p])Provides a generic way to initialize an object.
IsMapped
()Returns
True
if the object has a mapping address; otherwise returnsFalse
.Returns
True
if the object was modified; otherwise returnsFalse
.
IsNull
()Returns
True
if the object is uninitialized; otherwise returnsFalse
.
IsTypeDynamicPersistent
(Type)Checks whether a type is persistently dynamic.
KeyMatch
(ki[, converter])Marks a key as successfully having being used for decryption.
Load
(Stream)Loads the object data.
LocationDescription
(offset)Provides a description for a specified location.
MakeStruct
(header, name, offset[, options])Returns a
CFFStruct
instance.
MakeStructArray
(header, name, offset, nentries)Returns an array of
CFFStruct
.
Modified
(b)Sets the modified status for the object.
NewContainer
(size[, reserve_size, max_size])Creates a new
NTContainer
object.
Notify
(code)Internally notifies the associated
ScanProvider
(if any) of a problem.Returns
True
if ranges are enabled for the current object; otherwise returnsFalse
.
Read
(offset, uSize)Reads data from the object.
ReadNumber
(offset, type, endianness, is_signed)Reads an integer from the object.
ReadUInt16
(offset[, endianness])Reads an unsigned 16-bit integer from the object.
ReadUInt16String
(offset, maxlen, endianness)Reads an utf-16 array from the object.
ReadUInt32
(offset[, endianness])Reads an unsigned 32-bit integer from the object.
ReadUInt32String
(offset, maxlen, endianness)Reads an utf-32 array from the object.
ReadUInt64
(offset[, endianness])Reads an unsigned 64-bit integer from the object.
ReadUInt8
(offset)Reads an unsigned 8-bit integer from the object.
ReadUInt8String
(offset, maxlen)Reads an utf-8 array from the object.
ReplaceStream
(NewStream)Replaces the internal data of the object.
SetDefaultEndianness
(nEndiannessType)Sets the default endianness for the object.
SetDefaultStructOptions
(options)Sets the default options for
CFFStruct
instances created from this object (e.g.,CFFSO_Pack1
).
SetFSSupport
(b)Sets the status of file system support.
SetMappingAddress
(mapping)Sets the address at which the object is mapped.
SetMemoryUnpackLimit
(limit)Sets the maximum amount of bytes which can be allocated for in-memory decompression algorithms.
SetObjectFormatName
(format)Sets the file format name of the object.
SetObjectGenericFormatName
(format)Sets the generic format name of the object (e.g., the generic format name of HTML is XML).
SetObjectName
(name)Sets the name of the object.
SetObjectTypeName
(type_name)Sets the type name of the object.
SetRange
(offset, size, val)Sets a range value for the current object.
SetRangeValue
(offset, size, val)Sets a range value for the current object.
SetSize
(NewSize)Resizes the internal data of the object.
SetSpecialData
(key, value)Sets special data associated to the object.
SetTag
(t)Sets the tag name of the object for debugging purposes
SetUnpackLimit
(limit)Sets the limit for decompression operations.
SetUnpackNestingLimit
(limit)Sets the nesting limit for decompression operations.
Shift
(uSize)Appends
uSize
bytes at the end of the object data and sets them to zero.
ToBuffer
(offset[, method])Returns a
CFFBuffer
that reads from the object.
ToUInt16
(n)Applies the default endianness of the object to the 16-bit input integer.
ToUInt32
(n)Applies the default endianness of the object to the 32-bit input integer.
ToUInt64
(n)Applies the default endianness of the object to the 64-bit input integer.
ValidRange
(offset, Size)Checks the validity of a range in the context of the object.
Write
(offset, bytes_or_uSize[, bytes])Writes data to the object.
WriteUInt16
(offset, n_or_nEndiannessType[, n])Writes an unsigned 16-bit integer to the object.
WriteUInt32
(offset, n_or_nEndiannessType[, n])Writes an unsigned 32-bit integer to the object.
WriteUInt64
(offset, n_or_nEndiannessType[, n])Writes an unsigned 64-bit integer to the object.
WriteUInt8
(offset, n)Writes an unsigned 8-bit integer to the object.
- AdjustSign(type: int, num: int) → int¶
Makes the input number negative if the last bit is set and the input type is an integer.
- Parameters
type (int) – The input type.
num (int) – The input number.
- Returns
Returns the adjusted number.
- Return type
int
- Align(AlignConst: int) → bool¶
Aligns the object to the specified size.
- Parameters
AlignConst (int) – The alignment.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
NTContainer.align()
andShift()
.
- AppendTo(nStartOffset: int, nLenght: int, pDst: Pro.Core.NTContainer) → bool¶
Appends part of this object to a container.
- Parameters
nStartOffset (int) – The offset of the range to append.
nLenght (int) – The size of the range to append.
pDst (NTContainer) – The destination container.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
NTContainer.appendTo()
.
- Compare(offset: int, bytes_or_uSize: Union[bytes, int], b: Optional[int] = None) → bool¶
Compares the specified data to the one in the object.
- Parameters
offset (int) – The start offset for the comparison.
bytes_or_uSize (Union[bytes, int]) – Either the data to compare or the size to compare.
b (Optional[int]) – If the previous parameter is the size to compare, this parameter is the byte which to compare the data to.
- Returns
Returns
True
if the data matches; otherwise returnsFalse
.- Return type
bool
See also
NTContainer.compare()
.
- CopyFrom(Src: Pro.Core.NTContainer, nDstOffset: int, nLenght: int, nSrcStartOffset: int = 0) → bool¶
Copies data from a container to the object.
- Parameters
Src (NTContainer) – The container from which to copy the data.
nDstOffset (int) – The offset at which to copy the data.
nLenght (int) – The size of the data to copy.
nSrcStartOffset (int) – The offset from which to copy the data in the container.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
NTContainer.copyTo()
.
- CopyTo(nStartOffset: int, nLenght: int, pDst: Pro.Core.NTContainer, nDstStartOffset: int = 0) → bool¶
Copies a part of the object to a container.
- Parameters
nStartOffset (int) – The offset of the data to copy.
nLenght (int) – The size of the data to copy.
pDst (NTContainer) – The destination container.
nDstStartOffset (int) – The offset at which to write the data to in the destination container.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
NTContainer.copyTo()
.
- CustomKeyMatch(kr: Pro.Core.CFFGetKeyResult) → None¶
Marks a custom key as successfully having being used for decryption.
Note
This method should be used for keys not returned by
GetKey()
.
- Parameters
kr (CFFGetKeyResult) – The custom key.
Available since Cerbero Suite 7.8 and Cerbero Engine 4.8.
See also
KeyMatch()
andGetKeyMatches()
.
- DisableRanges() → None¶
Disables ranges.
Available since Cerbero Suite 6.2 and Cerbero Engine 3.2.
See also
EnableRanges()
,RangesEnabled()
andSetRange()
.
- EnableRanges(bits_per_element: int, granularity: int, initval: int = 0) → None¶
Creates a range bit mask for the current object.
- Parameters
bits_per_element (int) – The mask bits for each element.
granularity (int) – The granularity of each element.
initval (int) – The initial value of each element.
Note
The granularity is might be changed for larger files to meet memory constraints.
Available since Cerbero Suite 6.2 and Cerbero Engine 3.2.
See also
DisableRanges()
,RangesEnabled()
andSetRange()
.
- Fill(offset: int, c: int, uSize: int) → bool¶
Fills a portion of the object with the specified byte.
- Parameters
offset (int) – The offset of the range to fill.
c (int) – The 8-bit value used for the fill operation.
uSize (int) – The size of the range to fill.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
NTContainer.fill()
.
- GetDefaultEndianness() → int¶
- Returns
Returns the default endianness of the object (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Return type
int
See also
SetDefaultEndianness()
.
- GetDefaultStructOptions() → int¶
- Returns
Returns the default options for
CFFStruct
instances created from this object (e.g.,CFFSO_Pack1
).- Return type
int
See also
SetDefaultStructOptions()
.
- GetKey(ki: Pro.Core.CFFKeyIndex, accepted_keys: int, converter: str = 'utf-8') → Pro.Core.CFFGetKeyResult¶
Retrieves a decryption key.
Example:
ki = CFFKeyIndex() while True: kres = self.GetKey(ki, CFFKT_Pass, "utf-8") if kres.key_type == CFFKT_Invalid: # if there are no more keys, exit the loop break if self.Decrypt(kres.data): # our decryption method # if the decryption was successful, mark the key and exit the loop self.KeyMatch(ki, "utf-8") break
- Parameters
ki (CFFKeyIndex) – The key index.
accepted_keys (int) – The mask of accepted key types (e.g.,
CFFKT_Pass
).converter (str) – The converter to use for passwords (e.g.,
"utf-8"
,"ascii"
,"utf-16-le"
).- Returns
Returns a key result if successful; otherwise
CFFGetKeyResult.key_type
isCFFKT_Invalid
.- Return type
Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.
See also
KeyMatch()
,GetKeyMatches()
andCFFGetKeyResult
.
- GetKeyMatches() → Pro.Core.CFFGetKeyResultList¶
- Returns
Returns the list of matched decryption keys.
- Return type
Available since Cerbero Suite 7.8 and Cerbero Engine 4.8.
See also
KeyMatch()
andCustomKeyMatch()
.
- GetMappingAddress() → int¶
- Returns
Returns the address at which this object is mapped if available; otherwise returns
INVALID_STREAM_OFFSET
.- Return type
int
See also
IsMapped()
andSetMappingAddress()
.
- GetMemoryUnpackLimit() → int¶
- Returns
Returns the maximum amount of bytes which can be allocated for in-memory decompression algorithms.
- Return type
int
See also
SetMemoryUnpackLimit()
.
- GetObjectFormatName() → str¶
- Returns
Returns the file format name of the object if available; otherwise returns an empty string.
- Return type
str
See also
SetObjectFormatName()
.
- GetObjectGenericFormatName() → str¶
- Returns
Returns the generic format name of the object if available; otherwise returns an empty string (e.g., the generic format name of HTML is XML).
- Return type
str
See also
SetObjectGenericFormatName()
.
- GetObjectName() → str¶
- Returns
Returns the name of the object if available; otherwise returns an empty string.
- Return type
str
See also
SetObjectName()
.
- GetObjectTypeName() → str¶
- Returns
Returns the type name of the object if available; otherwise returns an empty string.
- Return type
str
See also
SetObjectTypeName()
.
- GetSize() → int¶
- Returns
Returns the size of the internally referenced container.
- Return type
int
See also
NTContainer.resize()
andSetSize()
.
- GetSpecialData(key: str, defval: Pro.Core.NTContainer = NTContainer()) → Pro.Core.NTContainer¶
Retrieves special data associated to the object.
- Parameters
key (str) – The key of the data to retrieve.
defval (NTContainer) – The value to return if
key
is not present.- Returns
Returns the requested data if present; otherwise returns the default return value.
- Return type
See also
SetSpecialData()
.
- GetStream() → Pro.Core.NTContainer¶
- Returns
Returns the internally referenced container.
- Return type
See also
GetSubStream()
,Load()
andReplaceStream()
.
- GetSubStream(offset_or_range: Union[Pro.Core.NTOffsetRange, int], optimize_for_speed_or_size: Union[bool, int] = INVALID_STREAM_OFFSET, optimize_for_speed: bool = True) → Pro.Core.NTContainer¶
Retrieves a sub-stream of the internally referenced container.
Hint
This is a convenience method. Internally this method calls
GetStream()
followed byNTContainer.setRange()
.
- Parameters
offset_or_range (Union[NTOffsetRange, int]) – Either the offset or the range.
optimize_for_speed_or_size (Union[bool, int]) – Either the size or the
optimize_for_speed_or_size
parameter.optimize_for_speed (bool) – If
True
, might cause a deep copy under certain circumstances.- Returns
Returns the specified sub-stream.
- Return type
Available since Cerbero Suite 7.2 and Cerbero Engine 4.2.
See also
GetStream()
andNTContainer.setRange()
.
- GetTag() → str¶
- Returns
Returns the tag name set for debugging purposes if present; otherwise returns an empty string.
- Return type
str
See also
SetTag()
.
- GetTypeName(Type: int) → str¶
Returns the name of the specified type.
- Parameters
Type (int) – The type for which to return the name.
- Returns
Returns the type name if implemented; otherwise returns an empty string.
- Return type
str
See also
GetTypeNature()
.
- GetTypeNature(Type: int) → int¶
Returns the nature of the specified type.
- Parameters
Type (int) – The type for which to return the nature.
- Returns
Returns the nature of the type if successful; otherwise returns
NATURE_UNKNOWN
.- Return type
int
See also
NATURE_BYTEARRAY
,NATURE_NUMBER
,NATURE_REAL
andNATURE_STRING
.See also
GetTypeName()
.
- GetUnpackLimit() → int¶
- Returns
Returns the limit for decompression operations.
- Return type
int
See also
SetUnpackLimit()
.
- GetUnpackNestingLimit() → int¶
- Returns
Returns the nesting limit for decompression operations.
- Return type
int
See also
SetUnpackNestingLimit()
.
- HasFSSupport() → bool¶
- Returns
Returns
True
if file system support is available; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.
See also
SetFSSupport()
.
- Initialize(p: Pro.Core.CFFInitParams = CFFInitParams()) → bool¶
Provides a generic way to initialize an object.
Note
This method should be overridden by derived classes.
- Parameters
p (CFFInitParams) – The initialization parameters.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 7.2 and Cerbero Engine 4.2.
See also
CFFInitParams
andLoad()
.
- IsMapped() → bool¶
- Returns
Returns
True
if the object has a mapping address; otherwise returnsFalse
.- Return type
bool
See also
GetMappingAddress()
andSetMappingAddress()
.
- IsModified() → bool¶
- Returns
Returns
True
if the object was modified; otherwise returnsFalse
.- Return type
bool
See also
Modified()
.
- IsNull() → bool¶
- Returns
Returns
True
if the object is uninitialized; otherwise returnsFalse
.- Return type
bool
See also
Load()
.
- IsTypeDynamicPersistent(Type: int) → bool¶
Checks whether a type is persistently dynamic.
This means that the size of the type is dependent on the underlying data.
- Parameters
Type (int) – The type to check.
- Returns
Returns
True
if the type is persistently dynamic; otherwise returnsFalse
.- Return type
bool
- KeyMatch(ki: Pro.Core.CFFKeyIndex, converter: str = 'utf-8') → None¶
Marks a key as successfully having being used for decryption.
- Parameters
ki (CFFKeyIndex) – The key index.
converter (str) – The converter to use for passwords (e.g.,
"utf-8"
,"ascii"
,"utf-16-le"
).Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.
See also
GetKey()
,CFFGetKeyResult
andCustomKeyMatch()
.
- Load(Stream: Pro.Core.NTContainer) → bool¶
Loads the object data.
Note
In derived built-in classes this method also checks the signature file format.
- Parameters
Stream (NTContainer) – The data to load.
- Returns
Returns
True
if the data is accepted; otherwise returnsFalse
.- Return type
bool
See also
Initialize()
,GetStream()
andReplaceStream()
.
- LocationDescription(offset: int) → str¶
Provides a description for a specified location.
Note
This method is currently implemented only for executables such as PE, ELF and MachO.
- Parameters
offset (int) – The location offset.
- Returns
Returns the description if successful; otherwise returns an empty string.
- Return type
str
Available since Cerbero Suite 7.3 and Cerbero Engine 4.3.
- MakeStruct(header: Pro.Core.CFFHeader, name: str, offset: int, options: Optional[int] = None) → Pro.Core.CFFStruct¶
Returns a
CFFStruct
instance.
- Parameters
header (CFFHeader) – The header from which to fetch the definition of the structure.
name (str) – The name of the structure to return.
offset (int) – The offset at which to load the structure.
options (Optional[int]) – The options for the layout of the structure (e.g.,
CFFSO_Pack1
).- Returns
Returns a valid structure if successful; otherwise returns an invalid structure.
- Return type
See also
MakeStructArray()
,CFFStruct
andCFFHeader
.
- MakeStructArray(header: Pro.Core.CFFHeader, name: str, offset: int, nentries: int, options: Optional[int] = None) → Pro.Core.CFFStruct¶
Returns an array of
CFFStruct
.
- Parameters
header (CFFHeader) – The header from which to fetch the definition of the structure.
name (str) – The name of the structure to return.
offset (int) – The offset at which to load the structure.
nentries (int) – The number of array entries.
options (Optional[int]) – The options for the layout of the structure (e.g.,
CFFSO_Pack1
).- Returns
Returns a valid structure if successful; otherwise returns an invalid structure.
- Return type
See also
MakeStruct()
,CFFStruct
andCFFHeader
.
- Modified(b: bool) → None¶
Sets the modified status for the object.
- Parameters
b (bool) – If
True
, marks the object as modified; otherwise marks the object as unmodified.See also
IsModified()
.
- NewContainer(size: int, reserve_size: int = 1024, max_size: int = 0) → Pro.Core.NTContainer¶
Creates a new
NTContainer
object.Whether the container will be using an internal memory buffer or a file on disk is decided on the basis of available memory resources at the time of the call.
- Parameters
size (int) – The initial size of the container.
reserve_size (int) – The size to initially reserve for the container.
max_size (int) – The maximum size the container will ever reach. This is an optional parameter used to decide whether the container can operate on a memory buffer.
- Returns
Returns the created container if successful; otherwise returns an invalid container.
- Return type
See also
newContainer()
andNTContainer
.
- Notify(code: int) → bool¶
Internally notifies the associated
ScanProvider
(if any) of a problem.
- Parameters
code (int) – The notification code (e.g.,
CFFN_NoDecrypt
).- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
ScanProvider
.
- RangesEnabled() → bool¶
- Returns
Returns
True
if ranges are enabled for the current object; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 6.2 and Cerbero Engine 3.2.
See also
EnableRanges()
,DisableRanges()
andSetRange()
.
- Read(offset: int, uSize: int) → bytes¶
Reads data from the object.
- Parameters
offset (int) – The offset of the data to read.
uSize (int) – The size of the data to read.
- Returns
Returns the data read if successful; otherwise return an empty
bytes
object.- Return type
bytes
See also
Write()
.
- ReadNumber(offset: int, type: int, endianness: int, is_signed: bool) → tuple¶
Reads an integer from the object.
- Parameters
offset (int) – The offset of the integer to read.
type (int) – The type of integer to read.
endianness (int) – The endianness of the integer (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).is_signed (bool) – If
True
, the integer is treated as signed.- Returns
Returns a tuple containing the value read and a boolean. The boolean value is
True
if successful; otherwise it isFalse
.- Return type
tuple[int, bool]
See also
ReadUInt8()
,ReadUInt16()
,ReadUInt32()
andReadUInt64()
.
- ReadUInt16(offset: int, endianness: Optional[int] = None) → tuple¶
Reads an unsigned 16-bit integer from the object.
- Parameters
offset (int) – The offset of the value to read.
endianness (Optional[int]) – The endianness of the value (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns a tuple containing the value read and a boolean. The boolean value is
True
if successful; otherwise it isFalse
.- Return type
tuple[int, bool]
See also
WriteUInt16()
,ReadUInt8()
,ReadUInt32()
,ReadUInt64()
andReadNumber()
.
- ReadUInt16String(offset: int, maxlen: int, endianness: int) → tuple¶
Reads an utf-16 array from the object.
The method stops when either a null terminator or
maxlen
is reached.
- Parameters
offset (int) – The offset of the array to read.
maxlen (int) – The maximum length of the entry in characters.
endianness (int) – The endianness of the array (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns a tuple containing the array read and a boolean. The boolean value is
True
if successful; otherwise it isFalse
.- Return type
tuple[bytes, bool]
See also
ReadUInt8String()
andReadUInt32String()
.
- ReadUInt32(offset: int, endianness: Optional[int] = None) → tuple¶
Reads an unsigned 32-bit integer from the object.
- Parameters
offset (int) – The offset of the value to read.
endianness (Optional[int]) – The endianness of the value (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns a tuple containing the value read and a boolean. The boolean value is
True
if successful; otherwise it isFalse
.- Return type
tuple[int, bool]
See also
WriteUInt32()
,ReadUInt8()
,ReadUInt16()
,ReadUInt64()
andReadNumber()
.
- ReadUInt32String(offset: int, maxlen: int, endianness: int) → tuple¶
Reads an utf-32 array from the object.
The method stops when either a null terminator or
maxlen
is reached.
- Parameters
offset (int) – The offset of the array to read.
maxlen (int) – The maximum length of the entry in characters.
endianness (int) – The endianness of the array (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns a tuple containing the array read and a boolean. The boolean value is
True
if successful; otherwise it isFalse
.- Return type
tuple[bytes, bool]
See also
ReadUInt8String()
andReadUInt16String()
.
- ReadUInt64(offset: int, endianness: Optional[int] = None) → tuple¶
Reads an unsigned 64-bit integer from the object.
- Parameters
offset (int) – The offset of the value to read.
endianness (Optional[int]) – The endianness of the value (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns a tuple containing the value read and a boolean. The boolean value is
True
if successful; otherwise it isFalse
.- Return type
tuple[int, bool]
See also
WriteUInt64()
,ReadUInt8()
,ReadUInt16()
,ReadUInt32()
andReadNumber()
.
- ReadUInt8(offset: int) → tuple¶
Reads an unsigned 8-bit integer from the object.
- Parameters
offset (int) – The offset of the value to read.
- Returns
Returns a tuple containing the value read and a boolean. The boolean value is
True
if successful; otherwise it isFalse
.- Return type
tuple[int, bool]
See also
WriteUInt8()
,ReadUInt16()
,ReadUInt32()
,ReadUInt64()
andReadNumber()
.
- ReadUInt8String(offset: int, maxlen: int) → tuple¶
Reads an utf-8 array from the object.
The method stops when either a null terminator or
maxlen
is reached.
- Parameters
offset (int) – The offset of the array to read.
maxlen (int) – The maximum length of the entry in bytes.
- Returns
Returns a tuple containing the array read and a boolean. The boolean value is
True
if successful; otherwise it isFalse
.- Return type
tuple[bytes, bool]
See also
ReadUInt16String()
andReadUInt32String()
.
- ReplaceStream(NewStream: Pro.Core.NTContainer) → None¶
Replaces the internal data of the object.
- Parameters
NewStream (NTContainer) – The new internal container for the object.
See also
Load()
andGetStream()
.
- SetDefaultEndianness(nEndiannessType: int) → None¶
Sets the default endianness for the object.
- Parameters
nEndiannessType (int) – The default endianness for the object (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).See also
GetDefaultEndianness()
.
- SetDefaultStructOptions(options: int) → None¶
Sets the default options for
CFFStruct
instances created from this object (e.g.,CFFSO_Pack1
).These options are used whenever options are not explicitly specified when calling
MakeStruct()
orMakeStructArray()
.
- Parameters
options (int) – The default options.
See also
GetDefaultStructOptions()
.
- SetFSSupport(b: bool) → None¶
Sets the status of file system support.
- Parameters
b (bool) – If
True
, enables file system support; otherwise disables it.Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.
See also
HasFSSupport()
.
- SetMappingAddress(mapping: int) → None¶
Sets the address at which the object is mapped.
For instance, the mapping address is set for binaries loaded from a memory image.
- Parameters
mapping (int) – The mapping address.
See also
GetMappingAddress()
andIsMapped()
.
- SetMemoryUnpackLimit(limit: int) → None¶
Sets the maximum amount of bytes which can be allocated for in-memory decompression algorithms.
- Parameters
limit (int) – The limit in bytes.
See also
GetMemoryUnpackLimit()
.
- SetObjectFormatName(format: str) → None¶
Sets the file format name of the object.
- Parameters
format (str) – The file format name.
See also
GetObjectFormatName()
.
- SetObjectGenericFormatName(format: str) → None¶
Sets the generic format name of the object (e.g., the generic format name of HTML is XML).
- Parameters
format (str) – The generic format name.
See also
GetObjectGenericFormatName()
.
- SetObjectName(name: str) → None¶
Sets the name of the object.
- Parameters
name (str) – The object name.
See also
GetObjectName()
.
- SetObjectTypeName(type_name: str) → None¶
Sets the type name of the object.
- Parameters
type_name (str) – The object type name.
See also
GetObjectTypeName()
.
- SetRange(offset: int, size: int, val: int) → None¶
Sets a range value for the current object.
Warning
This method is deprecated and should not be confused with
NTContainer.setRange()
. UseSetRangeValue()
instead.
- Parameters
offset (int) – The offset of the range.
size (int) – The size of the range.
val (int) – The value of the range (e.g.,
CFFRange_Used
).Available since Cerbero Suite 6.2 and Cerbero Engine 3.2.
See also
SetRangeValue()
,EnableRanges()
,DisableRanges()
andRangesEnabled()
.
- SetRangeValue(offset: int, size: int, val: int) → None¶
Sets a range value for the current object.
- Parameters
offset (int) – The offset of the range.
size (int) – The size of the range.
val (int) – The value of the range (e.g.,
CFFRange_Used
).Available since Cerbero Suite 7.3 and Cerbero Engine 4.3.
See also
EnableRanges()
,DisableRanges()
andRangesEnabled()
.
- SetSize(NewSize: int) → bool¶
Resizes the internal data of the object.
- Parameters
NewSize (int) – The new size of the data.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
NTContainer.setResizable()
andGetSize()
.
- SetSpecialData(key: str, value: Pro.Core.NTContainer) → None¶
Sets special data associated to the object.
- Parameters
key (str) – The key of the data to set.
value (NTContainer) – The data.
See also
GetSpecialData()
.
- SetTag(t: str) → None¶
Sets the tag name of the object for debugging purposes
- Parameters
t (str) – The tag name.
See also
GetTag()
.
- SetUnpackLimit(limit: int) → None¶
Sets the limit for decompression operations.
- Parameters
limit (int) – The limit in bytes.
See also
GetUnpackLimit()
.
- SetUnpackNestingLimit(limit: int) → None¶
Sets the nesting limit for decompression operations.
- Parameters
limit (int) – The limit.
See also
GetUnpackNestingLimit()
.
- Shift(uSize: int) → bool¶
Appends
uSize
bytes at the end of the object data and sets them to zero.
- Parameters
uSize (int) – The number of bytes to append.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
NTContainer.shift()
andAlign()
.
- ToBuffer(offset: int, method: int = Bufferize_Forwards) → Pro.Core.CFFBuffer¶
Returns a
CFFBuffer
that reads from the object.
- Parameters
offset (int) – The start offset.
method (int) – The buffering method to use. Defaults to
Bufferize_Forwards
.- Returns
Returns the
CFFBuffer
instance.- Return type
See also
CFFBuffer
.
- ToUInt16(n: int) → int¶
Applies the default endianness of the object to the 16-bit input integer.
The bytes of the integer will be inverted only if the default endianness of the object doesn’t match the endianness of the current platform.
- Parameters
n (int) – The input integer.
- Returns
Returns the inverted integer if the the default endianness of the object doesn’t match the endianness of the current platform; otherwise returns the input integer.
- Return type
int
See also
ToUInt32()
andToUInt64()
.
- ToUInt32(n: int) → int¶
Applies the default endianness of the object to the 32-bit input integer.
- Parameters
n (int) – The input integer.
- Returns
Returns the inverted integer if the the default endianness of the object doesn’t match the endianness of the current platform; otherwise returns the input integer.
- Return type
int
See also
ToUInt16()
andToUInt64()
.
- ToUInt64(n: int) → int¶
Applies the default endianness of the object to the 64-bit input integer.
- Parameters
n (int) – The input integer.
- Returns
Returns the inverted integer if the the default endianness of the object doesn’t match the endianness of the current platform; otherwise returns the input integer.
- Return type
int
See also
ToUInt16()
andToUInt32()
.
- ValidRange(offset: int, Size: int) → bool¶
Checks the validity of a range in the context of the object.
- Parameters
offset (int) – The offset of the range to check.
Size (int) – The size of the range to check.
- Returns
Returns
True
if the range is valid; otherwise returnsFalse
.- Return type
bool
See also
NTContainer.validRange()
.
- Write(offset: int, bytes_or_uSize: Union[bytes, int], bytes: Optional[bytes] = None) → bool¶
Writes data to the object.
- Parameters
offset (int) – The offset at which to write the data.
bytes_or_uSize (Union[bytes, int]) – Either the data to write or the number of bytes to write.
bytes (Optional[bytes]) – The data to write.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
Read()
.
- WriteUInt16(offset: int, n_or_nEndiannessType: int, n: Optional[int] = None) → bool¶
Writes an unsigned 16-bit integer to the object.
- Parameters
offset (int) – The offset at which to write the value.
n_or_nEndiannessType (int) – Either the value to write or the endianness (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
) to use when writing the value. If the endianness is not specified, the value is written using the default endianness of the object.n (Optional[int]) – The value to write.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
ReadUInt16()
,WriteUInt8()
,WriteUInt32()
andWriteUInt64()
.
- WriteUInt32(offset: int, n_or_nEndiannessType: int, n: Optional[int] = None) → bool¶
Writes an unsigned 32-bit integer to the object.
- Parameters
offset (int) – The offset at which to write the value.
n_or_nEndiannessType (int) – Either the value to write or the endianness (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
) to use when writing the value. If the endianness is not specified, the value is written using the default endianness of the object.n (Optional[int]) – The value to write.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
ReadUInt32()
,WriteUInt8()
,WriteUInt16()
andWriteUInt64()
.
- WriteUInt64(offset: int, n_or_nEndiannessType: int, n: Optional[int] = None) → bool¶
Writes an unsigned 64-bit integer to the object.
- Parameters
offset (int) – The offset at which to write the value.
n_or_nEndiannessType (int) – Either the value to write or the endianness (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
) to use when writing the value. If the endianness is not specified, the value is written using the default endianness of the object.n (Optional[int]) – The value to write.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
ReadUInt64()
,WriteUInt8()
,WriteUInt16()
andWriteUInt32()
.
- WriteUInt8(offset: int, n: int) → bool¶
Writes an unsigned 8-bit integer to the object.
- Parameters
offset (int) – The offset at which to write the value.
n (int) – The value to write.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
ReadUInt8()
,WriteUInt16()
,WriteUInt32()
andWriteUInt64()
.
- CFFPtrMaxSize: Final[int]¶
The maximum supported pointer size.
This value is reserved for future use.
See also
CFFObject
.
- CFFPtrMinSize: Final[int]¶
The minimum supported pointer size.
This value is reserved for future use.
See also
CFFObject
.
- CFFPtrSize16: Final[int]¶
16-bit pointer size.
This value is reserved for future use.
See also
CFFObject
.
- CFFPtrSize32: Final[int]¶
32-bit pointer size.
This value is reserved for future use.
See also
CFFObject
.
- CFFPtrSize64: Final[int]¶
64-bit pointer size.
This value is reserved for future use.
See also
CFFObject
.
- CFFRange_Custom: Final[int]¶
Range value.
Available since Cerbero Suite 6.2 and Cerbero Engine 3.2.
See also
CFFObject.SetRange()
.
- CFFRange_Last: Final[int]¶
Last range value plus one.
Available since Cerbero Suite 6.2 and Cerbero Engine 3.2.
- CFFRange_Unknown: Final[int]¶
Range value (alias of
CFFRange_Unreferenced
).Available since Cerbero Suite 6.2 and Cerbero Engine 3.2.
See also
CFFObject.SetRange()
.
- CFFRange_Unreferenced: Final[int]¶
Range value.
Available since Cerbero Suite 6.2 and Cerbero Engine 3.2.
See also
CFFObject.SetRange()
.
- CFFRange_Unused: Final[int]¶
Range value.
Available since Cerbero Suite 6.2 and Cerbero Engine 3.2.
See also
CFFObject.SetRange()
.
- CFFRange_Used: Final[int]¶
Range value.
Available since Cerbero Suite 6.2 and Cerbero Engine 3.2.
See also
CFFObject.SetRange()
.
- CFFSO_Clang: Final[int]¶
This flag specifies that the structure was generated by the Clang compiler.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_CompilerMask: Final[int]¶
Compiler mask for the flags of the structure.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_EndianBig: Final[int]¶
This flag specifies that the structure is big-endian.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_EndianDefault: Final[int]¶
This flag specifies that the structure uses the default endianness.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_EndianLittle: Final[int]¶
This flag specifies that the structure is little-endian.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_EndiannessBig: Final[int]¶
This flag specifies that the structure is big-endian.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_EndiannessDefault: Final[int]¶
This flag specifies that the structure uses the default endianness.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_EndiannessLittle: Final[int]¶
This flag specifies that the structure is little-endian.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_EndiannessMask: Final[int]¶
Endianness mask for the flags of the structure.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_GCC: Final[int]¶
This flag specifies that the structure was generated by the GCC compiler.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_NoCompiler: Final[int]¶
This flag specifies that the structure wasn’t generated by a specific compiler.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_NoPlatform: Final[int]¶
This flag specifies that the structure isn’t bound to specific platform.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_Pack1: Final[int]¶
This flag specifies that the structure has an alignment of 1.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_Pack16: Final[int]¶
This flag specifies that the structure has an alignment of 16.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_Pack2: Final[int]¶
This flag specifies that the structure has an alignment of 2.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_Pack4: Final[int]¶
This flag specifies that the structure has an alignment of 4.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_Pack8: Final[int]¶
This flag specifies that the structure has an alignment of 8.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_PackMask: Final[int]¶
Alignment mask for the flags of the structure.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_PackNone: Final[int]¶
This flag specifies that the structure doesn’t have an alignment.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_PlatformMask: Final[int]¶
Platform mask for the flags of the structure.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_Pointer16: Final[int]¶
This flag specifies that the pointer size of the structure is 16-bits.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_Pointer32: Final[int]¶
This flag specifies that the pointer size of the structure is 32-bits.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_Pointer64: Final[int]¶
This flag specifies that the pointer size of the structure is 64-bits.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_PointerDefault: Final[int]¶
This flag specifies that the pointer size of the structure is the default one for the object.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_PointerMask: Final[int]¶
Pointer mask for the flags of the structure.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_VC: Final[int]¶
This flag specifies that the structure was generated by the Visual C++ compiler.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- CFFSO_Windows: Final[int]¶
This flag specifies that the structure was generated for the Windows platform.
See also
CFFObject.SetDefaultStructOptions()
andCFFStruct
.
- class CFFStruct¶
This class represents a data structure and references a
CFFObject
instance.Instances of
CFFStruct
can be returned fromCFFObject
derived classes or by usingCFFObject.MakeStruct()
in combination with an instance ofCFFHeader
.Example:
from Pro.Core import * from Pro.PE import * def printDOSHeader(fname): c = createContainerFromFile(fname) if c.isNull(): return pe = PEObject() if not pe.Load(c): return out = NTTextBuffer() pe.DosHeader().Dump(out) # CFFStruct.Dump print(out.buffer)See also
CFFStruct
,CFFHeader
andCFFObject.MakeStruct()
.Methods:
Add
(i)If the current instance represents an array of structures, this method changes which entry is currently referenced.
At
(i)Retrieves a specific structure among an array of structures.
Bytes
(i_or_name)Returns the byte-array representation of a member of the structure.
Context
()Returns the context helper class for the current structure.
Count
()Returns the number of entries in the current array of structures.
Dump
(out)Outputs the members of the structure to a text stream according to their type nature.
Equals
(s)Checks whether two structures reference the same internal data.
Fill
(c_or_i_or_name[, c])Fills the entire structure or a member of it with a specified 8-bit value.
Flags
(i_or_name)Returns the flags for a member of the structure.
Returns the start offset of the structure.
Checks whether the structure contains members whose size depends upon the underlying data.
HasFlags
([i_or_name])Checks whether at least one member or a specific member of the structure has flags associated with it.
IsArray
()Returns
True
if the current instance represents an array of structures; otherwise returnsFalse
.
IsFixed
()Returns
True
if the structures has a fixed size; otherwise returnsFalse
.
IsNull
()Returns
True
if the structure is invalid; otherwise returnsFalse
.
IsValid
()Returns
True
if the structure is valid; otherwise returnsFalse
.Returns the length of the longer member name of the structure.
Converts an array of structure into a single structure.
Returns the number of members in the structure.
MemberName
(i)Retrieves the name of a member of the structure by its index.
MemberNature
(i_or_name)Retrieves the type nature of a member of the structure.
MemberOffset
(i_or_name)Retrieves the offset of a member of the structure.
MemberPosition
(name)Retrieves the index of a member of the structure.
MemberSize
(i_or_name)Retrieves the size of a member of the structure.
MemberType
(i)Retrieves the type of a member of the structure.
Retrieves the type name of a member of the structure.
Returns a list of indexes of those members in the structure which have flags.
Num
(i_or_name)Returns the numeric representation of a member of the structure.
Object
()Returns the internally referenced object.
Offset
()Returns the start offset of the structure.
Raw
(i_or_name)Returns the raw data of a member of the structure.
Set
(i_or_name, bytes_or_number_or_str)Sets a member of the structure.
SetContext
(ctx)Sets the context helper class for the current structure.
SetCount
(n)Sets the number of entries in the array of structures.
Sets the number of members that the structure has.
SetObject
(obj)Sets the internally referenced object.
SetOffset
(o)Sets the start offset of the structure.
SetRaw
(i_or_name, bytes)Sets the raw data of a member of the structure.
Size
()Returns the size of the structure.
Str
(i_or_name[, align_nums])Returns the string representation of a member of the structure.
Returns the name of the structure.
SubStruct
(i_or_name)Retrieves a sub-structure of the current structure.
Returns the total size occupied by the array of structures.
Uns
(i_or_name)Returns the unsigned integer representation of a member of the structure.
Zero
([i_or_name])Fills the entire structure or a member of it with zero.
iterator
()Returns an iterator for an array of structures.
- Add(i: int) → Pro.Core.CFFStruct¶
If the current instance represents an array of structures, this method changes which entry is currently referenced.
- Parameters
i (int) – The iterator can be increased by a negative amount.
- Returns
Returns the requested structure if within the limit of available entries; otherwise returns an invalid structure.
- Return type
See also
At()
,Count()
anditerator()
.
- At(i: int) → Pro.Core.CFFStruct¶
Retrieves a specific structure among an array of structures.
- Parameters
i (int) – The index of the structure to retrieve.
- Returns
Returns the requested structure if within the limit of available entries; otherwise returns an invalid structure.
- Return type
See also
Count()
,At()
anditerator()
.
- Bytes(i_or_name: Union[int, str]) → bytes¶
Returns the byte-array representation of a member of the structure.
This method automatically handles the endianness of the requested data.
- Parameters
i_or_name (Union[int, str]) – The index or name of the member of the structure.
- Returns
Returns the requested data if successful; otherwise returns an empty
bytes
object.- Return type
bytes
- Context() → Pro.Core.CFFContext¶
- Returns
Returns the context helper class for the current structure.
- Return type
See also
SetContext()
.
- Count() → int¶
- Returns
Returns the number of entries in the current array of structures.
- Return type
int
See also
SetCount()
,At()
anditerator()
.
- Dump(out: Pro.Core.NTTextStream) → bool¶
Outputs the members of the structure to a text stream according to their type nature.
- Parameters
out (NTTextStream) – The text stream for the output.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
NTTextStream
.
- Equals(s: Pro.Core.CFFStruct) → bool¶
Checks whether two structures reference the same internal data.
- Parameters
s (CFFStruct) – The other structure.
- Returns
Returns
True
if the structure reference the same internal data; otherwise returnsFalse
.- Return type
bool
- Fill(c_or_i_or_name: Union[int, str], c: Optional[int] = None) → bool¶
Fills the entire structure or a member of it with a specified 8-bit value.
- Parameters
c_or_i_or_name (Union[int, str]) – Either the 8-bit value used to fill the structure or the index or name of the member of the structure to fill.
c (Optional[int]) – The 8-bit value used to fill the member of the structure.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
Zero()
.
- Flags(i_or_name: Union[int, str]) → Pro.Core.CFFFlags¶
Returns the flags for a member of the structure.
- Parameters
i_or_name (Union[int, str]) – The index or name of the member of the structure.
- Returns
Returns a valid
CFFFlags
instance if successful; otherwise returns an invalidCFFFlags
instance.- Return type
See also
HasFlags()
,MembersWithFlags()
andCFFFlags
.
- GetOffset() → int¶
- Returns
Returns the start offset of the structure.
- Return type
int
See also
Offset()
,SetOffset()
andSize()
.
- HasDynamicSize() → bool¶
Checks whether the structure contains members whose size depends upon the underlying data.
Note
In an array of dynamic structures every entry can potentially have a different size than the other entries. Knowing whether or not a structure is dynamic is important for optimization purposes: skipping multiple entries in an array of dynamic structures requires to read the data for each entry to perform the calculation (e.g.,
Add()
).
- Returns
Returns
True
if the structure contains members whose size depends upon the underlying data; otherwise returnsFalse
.- Return type
bool
- HasFlags(i_or_name: Optional[Union[int, str]] = None) → bool¶
Checks whether at least one member or a specific member of the structure has flags associated with it.
- Parameters
i_or_name (Optional[Union[int, str]]) – The index or name of the member of the structure.
- Returns
Returns
True
if flags are available; otherwise returnsFalse
.- Return type
bool
See also
Flags()
,MembersWithFlags()
andCFFFlags
.
- IsArray() → bool¶
- Returns
Returns
True
if the current instance represents an array of structures; otherwise returnsFalse
.- Return type
bool
See also
Count()
andMakeSingle()
.
- IsFixed() → bool¶
- Returns
Returns
True
if the structures has a fixed size; otherwise returnsFalse
.- Return type
bool
- IsNull() → bool¶
- Returns
Returns
True
if the structure is invalid; otherwise returnsFalse
.- Return type
bool
See also
IsValid()
.
- IsValid() → bool¶
- Returns
Returns
True
if the structure is valid; otherwise returnsFalse
.- Return type
bool
See also
IsNull()
.
- LongestMemberName() → int¶
- Returns
Returns the length of the longer member name of the structure.
- Return type
int
See also
MemberName()
.
- MakeSingle() → Pro.Core.CFFStruct¶
Converts an array of structure into a single structure.
- Returns
Returns the currently referenced structure in the array as a single structure.
- Return type
- MemberCount() → int¶
- Returns
Returns the number of members in the structure.
- Return type
int
See also
SetMemberCount()
.
- MemberName(i: int) → str¶
Retrieves the name of a member of the structure by its index.
- Parameters
i (int) – The index of the member of the structure.
- Returns
Returns the member name if successful; otherwise returns an empty string.
- Return type
str
See also
MemberPosition()
,MemberOffset()
andMemberSize()
.
- MemberNature(i_or_name: Union[int, str]) → int¶
Retrieves the type nature of a member of the structure.
- Parameters
i_or_name (Union[int, str]) – The index or name of the member of the structure.
- Returns
Returns the type nature if successful; otherwise returns
NATURE_UNKNOWN
.- Return type
int
See also
MemberName()
,MemberOffset()
andMemberSize()
.
- MemberOffset(i_or_name: Union[int, str]) → int¶
Retrieves the offset of a member of the structure.
- Parameters
i_or_name (Union[int, str]) – The index or name of the member of the structure.
- Returns
Returns the offset if successful; otherwise returns
INVALID_STREAM_OFFSET
.- Return type
int
See also
MemberName()
,MemberSize()
andMemberPosition()
.
- MemberPosition(name: str) → int¶
Retrieves the index of a member of the structure.
- Parameters
name (str) – The name of the member of the structure.
- Returns
Returns the index if successful; otherwise returns
-1
.- Return type
int
See also
MemberName()
,MemberOffset()
andMemberSize()
.
- MemberSize(i_or_name: Union[int, str]) → int¶
Retrieves the size of a member of the structure.
- Parameters
i_or_name (Union[int, str]) – The index or name of the member of the structure.
- Returns
Returns the size if successful; otherwise returns
0
.- Return type
int
See also
MemberOffset()
,MemberName()
andMemberPosition()
.
- MemberType(i: int) → int¶
Retrieves the type of a member of the structure.
- Parameters
i (int) – The index or name of the member of the structure.
- Returns
Returns the type if successful; otherwise returns
0xFFFFFFFFFFFFFFFF
.- Return type
int
See also
MemberTypeName()
,MemberName()
,MemberOffset()
andMemberSize()
.
- MemberTypeName(i: int) → str¶
Retrieves the type name of a member of the structure.
- Parameters
i (int) – The index or name of the member of the structure.
- Returns
Returns the type name if successful; otherwise returns an empty string.
- Return type
str
See also
MemberType()
,MemberName()
,MemberOffset()
andMemberSize()
.
- MembersWithFlags() → Pro.Core.NTIntList¶
- Returns
Returns a list of indexes of those members in the structure which have flags.
- Return type
See also
HasFlags()
,Flags()
andCFFFlags
.
- Num(i_or_name: Union[int, str]) → int¶
Returns the numeric representation of a member of the structure.
Important
If the member to retrieve is an unsigned integer which doesn’t exceed 64 bit in size, then the slightly faster
Uns()
method can be used instead ofNum()
.This method automatically handles the endianness of the requested data.
- Parameters
i_or_name (Union[int, str]) – The index or name of the member of the structure.
- Returns
Returns the numeric value if successful; otherwise returns
0
.- Return type
int
- Object() → Pro.Core.CFFObject¶
- Returns
Returns the internally referenced object.
- Return type
See also
SetObject()
.
- Offset() → int¶
- Returns
Returns the start offset of the structure.
- Return type
int
See also
GetOffset()
,SetOffset()
andSize()
.
- Raw(i_or_name: Union[int, str]) → bytes¶
Returns the raw data of a member of the structure.
- Parameters
i_or_name (Union[int, str]) – The index or name of the member of the structure.
- Returns
Returns the requested data if successful; otherwise returns an empty
bytes
object.- Return type
bytes
See also
SetRaw()
.
- Set(i_or_name: Union[int, str], bytes_or_number_or_str: Union[bytes, int, str]) → bool¶
Sets a member of the structure.
This method automatically handles the endianness of the data to set.
- Parameters
i_or_name (Union[int, str]) – The index or name of the member of the structure.
bytes_or_number_or_str (Union[bytes, int, str]) – The data to set. This value is automatically converted to the raw data.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
- SetContext(ctx: Pro.Core.CFFContext) → None¶
Sets the context helper class for the current structure.
- Parameters
ctx (CFFContext) – The context helper class to set.
See also
Context()
.
- SetCount(n: int) → None¶
Sets the number of entries in the array of structures.
- Parameters
n (int) – The number of entries to set.
See also
Count()
,At()
anditerator()
.
- SetMemberCount(n: int) → None¶
Sets the number of members that the structure has.
Note
This method can only reduce the number of members initially available in the structure and it’s used to adapt structures which have different number of members depending on a version or size field.
- Parameters
n (int) – The number of members to set.
See also
MemberCount()
.
- SetObject(obj: Pro.Core.CFFObject) → None¶
Sets the internally referenced object.
- Parameters
obj (CFFObject) – The object to set.
See also
Object()
.
- SetOffset(o: int) → None¶
Sets the start offset of the structure.
- Parameters
o (int) – The start offset to set.
See also
Offset()
,GetOffset()
andSize()
.
- SetRaw(i_or_name: Union[int, str], bytes: bytes) → bool¶
Sets the raw data of a member of the structure.
- Parameters
i_or_name (Union[int, str]) – The index or name of the member of the structure.
bytes (bytes) – The raw data to set.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
Raw()
.
- Size() → int¶
- Returns
Returns the size of the structure.
- Return type
int
See also
TotalSize()
,Offset()
andGetOffset()
.
- Str(i_or_name: Union[int, str], align_nums: bool = False) → str¶
Returns the string representation of a member of the structure.
This method automatically handles the endianness of the requested data.
- Parameters
i_or_name (Union[int, str]) – The index or name of the member of the structure.
align_nums (bool) – If
True
, aligns numbers using zero-padding.- Returns
Returns the string if successful; otherwise returns an empty string.
- Return type
str
- StructName() → str¶
- Returns
Returns the name of the structure.
- Return type
str
- SubStruct(i_or_name: Union[int, str]) → Pro.Core.CFFStruct¶
Retrieves a sub-structure of the current structure.
This method is available only to fixed size structures.
- Parameters
i_or_name (Union[int, str]) – The name or index of the sub-structure to retrieve.
- Returns
Returns the sub-structure if successful; otherwise returns an invalid structure.
- Return type
See also
IsFixed()
.
- TotalSize() → int¶
- Returns
Returns the total size occupied by the array of structures.
- Return type
int
See also
Size()
,Offset()
andGetOffset()
.
- Uns(i_or_name: Union[int, str]) → int¶
Returns the unsigned integer representation of a member of the structure.
Important
The maximum supported size for unsigned integers returned by this method is 64 bits. To retrieve larger or negative integers
Num()
must be used. The difference between the two methods is thatUns()
is slightly faster thanNum()
.This method automatically handles the endianness of the requested data.
- Parameters
i_or_name (Union[int, str]) – The index or name of the member of the structure.
- Returns
Returns the numeric value if successful; otherwise returns
0
.- Return type
int
Available since Cerbero Suite 5.0 and Cerbero Engine 2.0.
- Zero(i_or_name: Optional[Union[int, str]] = None) → bool¶
Fills the entire structure or a member of it with zero.
- Parameters
i_or_name (Optional[Union[int, str]]) – The index or name of the member of the structure.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
Fill()
.
- iterator() → Pro.Core.CFFStructIt¶
- Returns
Returns an iterator for an array of structures.
- Return type
See also
CFFStructIt
.
- class CFFStructIt(s: Pro.Core.CFFStruct)¶
Iterator for an array of
CFFStruct
structures.
- Parameters
s (CFFStruct) – The array of structures to iterate over.
See also
CFFStruct.iterator()
andCFFStruct
.Methods:
HasNext
()Returns
True
if there is an entry after the current one; otherwise returnsFalse
.
Next
()Returns the entry after the current one and moves the iterator if successful; otherwise returns an invalid structure.
hasNext
()Returns
True
if there is an entry after the current one; otherwise returnsFalse
.
next
()Returns the entry after the current one and moves the iterator if successful; otherwise returns an invalid structure.
- HasNext() → bool¶
- Returns
Returns
True
if there is an entry after the current one; otherwise returnsFalse
.- Return type
bool
- Next() → Pro.Core.CFFStruct¶
- Returns
Returns the entry after the current one and moves the iterator if successful; otherwise returns an invalid structure.
- Return type
- hasNext() → bool¶
- Returns
Returns
True
if there is an entry after the current one; otherwise returnsFalse
.- Return type
bool
- next() → Pro.Core.CFFStruct¶
- Returns
Returns the entry after the current one and moves the iterator if successful; otherwise returns an invalid structure.
- Return type
- class CFFStructList¶
List of
CFFStruct
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: Pro.Core.CFFStruct) → None¶
Inserts
value
at the end of the list.
- Parameters
value (CFFStruct) – The value to add to the list.
See also
insert()
.
- at(i: int) → Pro.Core.CFFStruct¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
- clear() → None¶
Removes all items from the list.
- contains(value: Pro.Core.CFFStruct) → bool¶
Checks the presence of an element in the list.
- Parameters
value (CFFStruct) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: Pro.Core.CFFStruct) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (CFFStruct) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: Pro.Core.CFFStruct, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (CFFStruct) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: Pro.Core.CFFStruct) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (CFFStruct) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.CFFStructListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: Pro.Core.CFFStruct) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (CFFStruct) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → Pro.Core.CFFStruct¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
See also
removeAt()
.
- class CFFStructListIt(obj: Pro.Core.CFFStructList)¶
Iterator class for
CFFStructList
.
- Parameters
obj (CFFStructList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → Pro.Core.CFFStruct¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
See also
hasNext()
andprevious()
.
- previous() → Pro.Core.CFFStruct¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- CFF_ARRAY_NULL_TERMINATED: Final[int]¶
If specified, makes an array of structure be null-terminated.
See also
CFFObject.MakeStructArray()
.
- class CFSEntry(iface: Optional[Pro.Core.CFSEntryInterface] = None)¶
Wrapper class for a
CFSEntryInterface
instance.
- Parameters
iface (Optional[CFSEntryInterface]) – The
CFSEntryInterface
instance to be wrapped.Important
When wrapping an instance of
CFSEntryInterface
, it is necessary to call__disown__()
on it to avoid Python freeing the allocated object. The object will be freed automatically by theCFSEntry
wrapper.Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.
See also
CFSEntryInterface
.Attributes:
Access time type.
Creation time type.
Directory entry type.
Drive entry type.
Fast data flag.
File entry type.
Invalid entry type.
Modification time type.
Symbolic link flag.
Methods:
AddProperty
(name, value[, offset])Adds a property to the entry.
Data
([wo])Retrieves the data associated with the entry.
Returns the offset of the entry data if available; otherwise returns
INVALID_STREAM_OFFSET
.
DataSize
()Returns the size of the entry data if available; otherwise returns
0
.
Flags
()Returns the flags of the entry (e.g.,
FastData
).
HasData
()Returns
True
if entry data is available; otherwise returnsFalse
.Returns
True
if entry data size is available; otherwise returnsFalse
.
IsNull
()Returns
True
if the entry is invalid; otherwise returnsFalse
.Returns
True
if the entry is a symbolic link; otherwise returnsFalse
.
IsValid
()Returns
True
if the entry is valid; otherwise returnsFalse
.
Name
()Returns the entry name if available; otherwise returns an empty string.
Path
()Returns the full path of the entry, including the file name.
Property
(name)Retrieves a property of the entry.
Returns the number of properties available.
Returns the list of property names.
PropertyOffset
(name)Retrieves the offset of a property.
SetData
(data)Sets the data of the entry.
SetDataOffset
(offset)Sets the offset of the entry data.
SetDataSize
(size)Sets the size of the entry data.
SetFlags
(flags)Sets the flags of the entry.
SetName
(name)Sets the name of the entry.
SetPath
(path)Sets the full path of the entry.
SetTime
(ttype, t)Sets a specific file time of the entry.
SetType
(type)Sets the type of the entry.
Time
(ttype)Retrieves a specific file time of the entry.
ToXML
([sort, include_data])Converts the entry to an XML string.
Type
()Returns the entry type (e.g.,
Directory
).
- AddProperty(name: str, value: Optional[Union[int, float, bool, bytes, str]], offset: int = INVALID_STREAM_OFFSET) → None¶
Adds a property to the entry.
- Parameters
name (str) – The name of the property.
value (BasicType) – The value of the property.
offset (int) – The optional offset of the property.
See also
Property()
,PropertyCount()
andPropertyNames()
.
- Data(wo: Optional[Pro.Core.NTIWait] = None) → Pro.Core.NTContainer¶
Retrieves the data associated with the entry.
- Parameters
wo (NTIWait) – The optional wait operation for the retrieval of the data.
- Returns
Returns a valid
NTContainer
if successful; otherwise returns an invalidNTContainer
.- Return type
See also
SetData()
,DataOffset()
,DataSize()
andHasData()
.
- DataOffset() → int¶
- Returns
Returns the offset of the entry data if available; otherwise returns
INVALID_STREAM_OFFSET
.- Return type
int
See also
Data()
,SetData()
,DataSize()
andHasData()
.
- DataSize() → int¶
- Returns
Returns the size of the entry data if available; otherwise returns
0
.- Return type
int
Note
The size of the entry data is returned only when set previously using
SetDataSize()
. This method will not internally callData()
to return the size of the data.See also
HasDataSize()
,SetDataSize()
,DataOffset()
,Data()
andSetData()
.
- Drive: Final[int]¶
Drive entry type.
- FastData: Final[int]¶
Fast data flag.
- Flags() → int¶
- Returns
Returns the flags of the entry (e.g.,
FastData
).- Return type
int
Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.
See also
SetFlags()
.
- HasData() → bool¶
- Returns
Returns
True
if entry data is available; otherwise returnsFalse
.- Return type
bool
See also
Data()
,SetData()
,DataOffset()
andDataSize()
.
- HasDataSize() → bool¶
- Returns
Returns
True
if entry data size is available; otherwise returnsFalse
.- Return type
bool
See also
DataSize()
,DataOffset()
,Data()
,SetData()
andHasData()
.
- IsNull() → bool¶
- Returns
Returns
True
if the entry is invalid; otherwise returnsFalse
.- Return type
bool
See also
IsValid()
.
- IsSymbolicLink() → bool¶
- Returns
Returns
True
if the entry is a symbolic link; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 8.1 and Cerbero Engine 5.1.
See also
SymbolicLink
.
- IsValid() → bool¶
- Returns
Returns
True
if the entry is valid; otherwise returnsFalse
.- Return type
bool
See also
IsNull()
.
- Name() → str¶
- Returns
Returns the entry name if available; otherwise returns an empty string.
- Return type
str
See also
SetName()
.
- Path() → str¶
- Returns
Returns the full path of the entry, including the file name.
- Return type
str
Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.
See also
SetPath()
.
- Property(name: str) → Optional[Union[int, float, bool, bytes, str]]¶
Retrieves a property of the entry.
- Parameters
name (str) – The name of the property to retrieve.
- Returns
Returns the property value if successful; otherwise returns
None
.- Return type
BasicType
See also
PropertyCount()
,PropertyNames()
,AddProperty()
andPropertyOffset()
.
- PropertyCount() → int¶
- Returns
Returns the number of properties available.
- Return type
int
See also
Property()
,PropertyNames()
,AddProperty()
andPropertyOffset()
.
- PropertyNames() → Pro.Core.NTStringList¶
- Returns
Returns the list of property names.
- Return type
See also
Property()
,PropertyCount()
,AddProperty()
andPropertyOffset()
.
- PropertyOffset(name: str) → int¶
Retrieves the offset of a property.
- Parameters
name (str) – The name of the property.
- Returns
Returns the of offset of the property if available; otherwise returns
INVALID_STREAM_OFFSET
.- Return type
int
See also
Property()
,PropertyCount()
,PropertyNames()
andAddProperty()
.
- SetData(data: Pro.Core.NTContainer) → None¶
Sets the data of the entry.
- Parameters
data (NTContainer) – The data of the entry.
See also
Data()
,DataOffset()
,DataSize()
andHasData()
.
- SetDataOffset(offset: int) → None¶
Sets the offset of the entry data.
- Parameters
offset (int) – The offset of the entry data.
See also
DataOffset()
,DataSize()
,Data()
andSetData()
.
- SetDataSize(size: int) → None¶
Sets the size of the entry data.
- Parameters
size (int) – The size of the entry data.
See also
DataOffset()
,DataSize()
,Data()
andSetData()
.
- SetFlags(flags: int) → None¶
Sets the flags of the entry.
- Parameters
flags (int) – The flags of the entry (e.g.,
FastData
).Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.
See also
Flags()
.
- SetName(name: str) → None¶
Sets the name of the entry.
- Parameters
name (str) – The name of the entry.
See also
Name()
.
- SetPath(path: str) → None¶
Sets the full path of the entry.
- Parameters
path (str) – The full path of the entry, including the file name.
Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.
See also
Path()
.
- SetTime(ttype: int, t: Pro.Core.NTDateTime) → None¶
Sets a specific file time of the entry.
- Parameters
ttype (int) – The type of time to set (e.g.,
ModificationTime
).t (NTDateTime) – The time to set.
See also
Time()
.
- SetType(type: int) → None¶
Sets the type of the entry.
- Parameters
type (int) – The type to set (e.g.,
Directory
).See also
Type()
.
- SymbolicLink: Final[int]¶
Symbolic link flag.
- Time(ttype: int) → Pro.Core.NTDateTime¶
Retrieves a specific file time of the entry.
- Parameters
ttype (int) – The type of time to retrieve (e.g.,
ModificationTime
).- Returns
Returns a valid
NTDateTime
if successful; otherwise returns an invalidNTDateTime
instance.- Return type
See also
SetTime()
.
- ToXML(sort: bool = True, include_data: bool = False) → str¶
Converts the entry to an XML string.
- Parameters
sort (bool) – If
True
, sorts the properties alphabetically.include_data (bool) – If
True
, includes the data of the entry encoded as base64.- Returns
Returns the XML string if successful; otherwise returns an empty string.
- Return type
str
- class CFSEntryInterface¶
This class represents a single file system entry.
Its method should never be called directly, but through
CFSEntry
.Hint
All methods used to retrieve data in this class can be overridden. Alternatively, set methods can be used to set the data and thus removing the need to create a derived class that overrides get methods. The two approaches can also be combined. This design leaves to the developer the choice of how to use the interface.
Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.
See also
CFSEntry
.Methods:
AddProperty
(name, value[, offset])Adds a property to the entry.
Data
([wo])Retrieves the data associated with the entry.
Returns the offset of the entry data if available; otherwise returns
INVALID_STREAM_OFFSET
.
DataSize
()Returns the size of the entry data if available; otherwise returns
0
.
Flags
()Returns the flags of the entry (e.g.,
FastData
).
HasData
()Returns
True
if entry data is available; otherwise returnsFalse
.Returns
True
if entry data size is available; otherwise returnsFalse
.
Name
()Returns the entry name if available; otherwise returns an empty string.
Path
()Returns the full path of the entry, including the file name.
Property
(name)Retrieves a property of the entry.
Returns the number of properties available.
Returns the list of property names.
PropertyOffset
(name)Retrieves the offset of a property.
SetData
(data)Sets the data of the entry.
SetDataOffset
(offset)Sets the offset of the entry data.
SetDataSize
(size)Sets the size of the entry data.
SetFlags
(flags)Sets the flags of the entry.
SetName
(name)Sets the name of the entry.
SetPath
(path)Sets the full path of the entry.
SetTime
(ttype, t)Sets a specific file time of the entry.
SetType
(type)Sets the type of the entry.
Time
(ttype)Retrieves a specific file time of the entry.
Type
()Returns the entry type (e.g.,
Directory
).
- AddProperty(name: str, value: Optional[Union[int, float, bool, bytes, str]], offset: int = INVALID_STREAM_OFFSET) → None¶
Adds a property to the entry.
- Parameters
name (str) – The name of the property.
value (BasicType) – The value of the property.
offset (int) – The optional offset of the property.
See also
Property()
,PropertyCount()
andPropertyNames()
.
- Data(wo: Optional[Pro.Core.NTIWait] = None) → Pro.Core.NTContainer¶
Retrieves the data associated with the entry.
- Parameters
wo (NTIWait) – The optional wait operation for the retrieval of the data.
- Returns
Returns a valid
NTContainer
if successful; otherwise returns an invalidNTContainer
.- Return type
See also
SetData()
,DataOffset()
,DataSize()
andHasData()
.
- DataOffset() → int¶
- Returns
Returns the offset of the entry data if available; otherwise returns
INVALID_STREAM_OFFSET
.- Return type
int
See also
Data()
,SetData()
,DataSize()
andHasData()
.
- DataSize() → int¶
- Returns
Returns the size of the entry data if available; otherwise returns
0
.- Return type
int
Note
The size of the entry data is returned only when set previously using
SetDataSize()
. This method will not internally callData()
to return the size of the data.See also
HasDataSize()
,SetDataSize()
,DataOffset()
,Data()
andSetData()
.
- Flags() → int¶
- Returns
Returns the flags of the entry (e.g.,
FastData
).- Return type
int
Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.
See also
SetFlags()
.
- HasData() → bool¶
- Returns
Returns
True
if entry data is available; otherwise returnsFalse
.- Return type
bool
See also
Data()
,SetData()
,DataOffset()
andDataSize()
.
- HasDataSize() → bool¶
- Returns
Returns
True
if entry data size is available; otherwise returnsFalse
.- Return type
bool
See also
DataSize()
,DataOffset()
,Data()
,SetData()
andHasData()
.
- Name() → str¶
- Returns
Returns the entry name if available; otherwise returns an empty string.
- Return type
str
See also
SetName()
.
- Path() → str¶
- Returns
Returns the full path of the entry, including the file name.
- Return type
str
Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.
See also
SetPath()
.
- Property(name: str) → Optional[Union[int, float, bool, bytes, str]]¶
Retrieves a property of the entry.
- Parameters
name (str) – The name of the property to retrieve.
- Returns
Returns the property value if successful; otherwise returns
None
.- Return type
BasicType
See also
PropertyCount()
,PropertyNames()
,AddProperty()
andPropertyOffset()
.
- PropertyCount() → int¶
- Returns
Returns the number of properties available.
- Return type
int
See also
Property()
,PropertyNames()
,AddProperty()
andPropertyOffset()
.
- PropertyNames() → Pro.Core.NTStringList¶
- Returns
Returns the list of property names.
- Return type
See also
Property()
,PropertyCount()
,AddProperty()
andPropertyOffset()
.
- PropertyOffset(name: str) → int¶
Retrieves the offset of a property.
- Parameters
name (str) – The name of the property.
- Returns
Returns the of offset of the property if available; otherwise returns
INVALID_STREAM_OFFSET
.- Return type
int
See also
Property()
,PropertyCount()
,PropertyNames()
andAddProperty()
.
- SetData(data: Pro.Core.NTContainer) → None¶
Sets the data of the entry.
- Parameters
data (NTContainer) – The data of the entry.
See also
Data()
,DataOffset()
,DataSize()
andHasData()
.
- SetDataOffset(offset: int) → None¶
Sets the offset of the entry data.
- Parameters
offset (int) – The offset of the entry data.
See also
DataOffset()
,DataSize()
,Data()
andSetData()
.
- SetDataSize(size: int) → None¶
Sets the size of the entry data.
- Parameters
size (int) – The size of the entry data.
See also
DataOffset()
,DataSize()
,Data()
andSetData()
.
- SetFlags(flags: int) → None¶
Sets the flags of the entry.
- Parameters
flags (int) – The flags of the entry (e.g.,
FastData
).Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.
See also
Flags()
.
- SetName(name: str) → None¶
Sets the name of the entry.
- Parameters
name (str) – The name of the entry.
See also
Name()
.
- SetPath(path: str) → None¶
Sets the full path of the entry.
- Parameters
path (str) – The full path of the entry, including the file name.
Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.
See also
Path()
.
- SetTime(ttype: int, t: Pro.Core.NTDateTime) → None¶
Sets a specific file time of the entry.
- Parameters
ttype (int) – The type of time to set (e.g.,
CFSEntry.ModificationTime
).t (NTDateTime) – The time to set.
See also
Time()
.
- SetType(type: int) → None¶
Sets the type of the entry.
- Parameters
type (int) – The type to set (e.g.,
Directory
).See also
Type()
.
- Time(ttype: int) → Pro.Core.NTDateTime¶
Retrieves a specific file time of the entry.
- Parameters
ttype (int) – The type of time to retrieve (e.g.,
CFSEntry.ModificationTime
).- Returns
Returns a valid
NTDateTime
if successful; otherwise returns an invalidNTDateTime
instance.- Return type
See also
SetTime()
.
- class CFSInstance(iface: Optional[Pro.Core.CFSInterface] = None)¶
Wrapper class for a
CFSInterface
instance.
- Parameters
iface (Optional[CFSInterface]) – The
CFSInterface
instance to be wrapped.Important
When wrapping an instance of
CFSEntryInterface
, it is necessary to call__disown__()
on it to avoid Python freeing the allocated object. The object will be freed automatically by theCFSInstance
wrapper.Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.
See also
CFSInterface
.Methods:
Returns
True
if the file system is case sensitive; otherwise returnsFalse
.
FSGetEntry
(path[, wo])Retrieves an entry by its full path name.
FSIterator
([path, wo])Retrieves an iterator for the specified path.
FSList
([path, wo])Retrieves an entry list for the specified path.
FSNameFromFullName
(full_name)Retrieves the name of the entry from its full path name.
FSPathFromFullName
(full_name)Retrieves the path of the entry from its full path name.
Returns the root path of the file system.
Returns the path separator of the file system.
HasFSFeature
(feature)Checks for the presence of a specific file system feature.
IsNull
()Returns
True
if the current instance is invalid; otherwise returnsFalse
.
IsValid
()Returns
True
if the current instance is valid; otherwise returnsFalse
.
- FSCaseSensitive() → bool¶
- Returns
Returns
True
if the file system is case sensitive; otherwise returnsFalse
.- Return type
bool
- FSGetEntry(path: str, wo: Optional[Pro.Core.NTIWait] = None) → Pro.Core.CFSEntry¶
Retrieves an entry by its full path name.
- Parameters
path (str) – The full path name of the entry to retrieve.
wo (NTIWait) – An optional wait object for the operation.
- Returns
Returns a valid entry if successful; otherwise returns an invalid
CFSEntry
.- Return type
See also
FSIterator()
andFSList()
.
- FSIterator(path: str = str(), wo: Optional[Pro.Core.NTIWait] = None) → Pro.Core.CFSIterator¶
Retrieves an iterator for the specified path.
- Parameters
path (str) – The path.
wo (NTIWait) – An optional wait object for the operation.
- Returns
Returns a valid
CFSIterator
if successful; otherwise returns an invalidCFSIterator
.- Return type
See also
FSList()
andFSGetEntry()
.
- FSList(path: str = str(), wo: Optional[Pro.Core.NTIWait] = None) → Pro.Core.CFSList¶
Retrieves an entry list for the specified path.
- Parameters
path (str) – The path.
wo (NTIWait) – An optional wait object for the operation.
- Returns
Returns a valid
CFSList
if successful; otherwise returns an invalidCFSList
.- Return type
See also
FSIterator()
andFSGetEntry()
.
- FSNameFromFullName(full_name: str) → str¶
Retrieves the name of the entry from its full path name.
- Parameters
full_name (str) – The full path name.
- Returns
Returns the entry name.
- Return type
str
See also
FSPathFromFullName()
.
- FSPathFromFullName(full_name: str) → str¶
Retrieves the path of the entry from its full path name.
- Parameters
full_name (str) – The full path name.
- Returns
Returns the path of the entry.
- Return type
str
See also
FSNameFromFullName()
.
- FSRootDirectory() → str¶
- Returns
Returns the root path of the file system.
- Return type
str
- FSSeparator() → str¶
- Returns
Returns the path separator of the file system.
- Return type
str
- HasFSFeature(feature: str) → bool¶
Checks for the presence of a specific file system feature.
Available features are: metadata, mtime, size and physical.
- Parameters
feature (str) – The name of the file system feature.
- Returns
Returns
True
if the file system feature is available; otherwise returnsFalse
.- Return type
bool
- class CFSInterface¶
This class represents a file system interface
This interface is inherited by
CFFObject
, but can also be also wrapped insideCFSInstance
.Hint
All methods apart from
FSIterator()
andFSList()
in this class can be overridden. To implement the creation of file system iterators or lists, theNewFSIterator()
andNewFSList()
methods must be overridden. It is sufficient to override just one of these two methods: the internal code is capable of creating a file system list from an iterator and vice-versa, leaving to the developer the choice of which of the two methods is easier to implement for a specific file system.Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.
See also
CFSInstance
.Methods:
Returns the case sensitivity of the file system.
FSGetEntry
(path[, wo])Retrieves an entry by its full path name.
FSIterator
([path, wo])Retrieves an iterator for the specified path.
FSList
([path, wo])Retrieves an entry list for the specified path.
FSNameFromFullName
(full_name)Retrieves the name of the entry from its full path name.
FSPathFromFullName
(full_name)Retrieves the path of the entry from its full path name.
Retrieves the root path of the file system.
Retrieves the path separator of the file system.
HasFSFeature
(feature)Checks for the presence of a specific file system feature.
NewFSIterator
(path, wo)Retrieves an iterator for the specified path.
NewFSList
(path, wo)Retrieves an entry list for the specified path.
- FSCaseSensitive() → bool¶
Returns the case sensitivity of the file system.
By default this method returns
True
.
- Returns
Returns
True
if the file system is case sensitive; otherwise returnsFalse
.- Return type
bool
- FSGetEntry(path: str, wo: Optional[Pro.Core.NTIWait] = None) → Pro.Core.CFSEntry¶
Retrieves an entry by its full path name.
Hint
If this method is not overridden, it will fall back to use
FSIterator()
to retrieve the entry.
- Parameters
path (str) – The full path name of the entry to retrieve.
wo (NTIWait) – An optional wait object for the operation.
- Returns
Returns a valid entry if successful; otherwise returns an invalid
CFSEntry
.- Return type
See also
FSIterator()
andFSList()
.
- FSIterator(path: str = str(), wo: Optional[Pro.Core.NTIWait] = None) → Pro.Core.CFSIterator¶
Retrieves an iterator for the specified path.
Hint
Internally this method calls
NewFSIterator()
.
- Parameters
path (str) – The path.
wo (NTIWait) – An optional wait object for the operation.
- Returns
Returns a valid
CFSIterator
if successful; otherwise returns an invalidCFSIterator
.- Return type
See also
NewFSIterator()
andFSList()
.
- FSList(path: str = str(), wo: Optional[Pro.Core.NTIWait] = None) → Pro.Core.CFSList¶
Retrieves an entry list for the specified path.
Hint
Internally this method calls
NewFSList()
.
- Parameters
path (str) – The path.
wo (NTIWait) – An optional wait object for the operation.
- Returns
Returns a valid
CFSList
if successful; otherwise returns an invalidCFSList
.- Return type
See also
NewFSList()
andFSIterator()
.
- FSNameFromFullName(full_name: str) → str¶
Retrieves the name of the entry from its full path name.
- Parameters
full_name (str) – The full path name.
- Returns
Returns the entry name.
- Return type
str
See also
FSPathFromFullName()
.
- FSPathFromFullName(full_name: str) → str¶
Retrieves the path of the entry from its full path name.
- Parameters
full_name (str) – The full path name.
- Returns
Returns the path of the entry.
- Return type
str
See also
FSNameFromFullName()
.
- FSRootDirectory() → str¶
Retrieves the root path of the file system.
By default this method returns an empty string.
- Returns
Returns the root path of the file system.
- Return type
str
- FSSeparator() → str¶
Retrieves the path separator of the file system.
By default this method returns
"/"
.
- Returns
Returns the path separator of the file system.
- Return type
str
- HasFSFeature(feature: str) → bool¶
Checks for the presence of a specific file system feature.
Available features are: metadata, mtime, size and physical.
- Parameters
feature (str) – The name of the file system feature.
- Returns
Returns
True
if the file system feature is available; otherwise returnsFalse
.- Return type
bool
- NewFSIterator(path: str, wo: Pro.Core.NTIWait) → Pro.Core.CFSIterator¶
Retrieves an iterator for the specified path.
Important
This method can be overridden to implement the functionality, but should not be called directly: the wrapper method
FSIterator()
should be called instead.
- Parameters
path (str) – The path.
wo (NTIWait) – An optional wait object for the operation.
- Returns
Returns a valid
CFSIterator
if successful; otherwise returns an invalidCFSIterator
.- Return type
See also
FSIterator()
andNewFSList()
.
- NewFSList(path: str, wo: Pro.Core.NTIWait) → Pro.Core.CFSList¶
Retrieves an entry list for the specified path.
Important
This method can be overridden to implement the functionality, but should not be called directly: the wrapper method
FSList()
should be called instead.
- Parameters
path (str) – The path.
wo (NTIWait) – An optional wait object for the operation.
- Returns
Returns a valid
CFSList
if successful; otherwise returns an invalidCFSList
.- Return type
See also
FSList()
andNewFSIterator()
.
- class CFSIterator(iface: Optional[Pro.Core.CFSIteratorInterface] = None)¶
Wrapper class for a
CFSIteratorInterface
instance.
- Parameters
iface (Optional[CFSIteratorInterface]) – The
CFSIteratorInterface
instance to be wrapped.Important
When wrapping an instance of
CFSIteratorInterface
, it is necessary to call__disown__()
on it to avoid Python freeing the allocated object. The object will be freed automatically by theCFSIterator
wrapper.Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.
See also
CFSIteratorInterface
.Methods:
HasNext
()Returns
True
if there is an entry after the current one; otherwise returnsFalse
.
IsNull
()Returns
True
if the iterator is invalid; otherwise returnsFalse
.
IsValid
()Returns
True
if the iterator is valid; otherwise returnsFalse
.
Next
()Returns the entry after the current one and moves the iterator if successful; otherwise returns an invalid
CFSEntry
.
- HasNext() → bool¶
- Returns
Returns
True
if there is an entry after the current one; otherwise returnsFalse
.- Return type
bool
See also
Next()
.
- IsNull() → bool¶
- Returns
Returns
True
if the iterator is invalid; otherwise returnsFalse
.- Return type
bool
See also
IsValid()
.
- IsValid() → bool¶
- Returns
Returns
True
if the iterator is valid; otherwise returnsFalse
.- Return type
bool
See also
IsNull()
.
- Next() → Pro.Core.CFSEntry¶
- Returns
Returns the entry after the current one and moves the iterator if successful; otherwise returns an invalid
CFSEntry
.- Return type
See also
HasNext()
.
- class CFSIteratorInterface¶
This class represents a file system iterator.
Its method should never be called directly, but through
CFSIterator
.Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.
See also
CFSIterator
.Methods:
HasNext
()Returns
True
if there is an entry after the current one; otherwise returnsFalse
.
Next
()Returns the entry after the current one and moves the iterator if successful; otherwise returns an invalid
CFSEntry
.
- HasNext() → bool¶
- Returns
Returns
True
if there is an entry after the current one; otherwise returnsFalse
.- Return type
bool
See also
Next()
.
- Next() → Pro.Core.CFSEntry¶
- Returns
Returns the entry after the current one and moves the iterator if successful; otherwise returns an invalid
CFSEntry
.- Return type
See also
HasNext()
.
- class CFSList(iface: Optional[Pro.Core.CFSListInterface] = None)¶
Wrapper class for a
CFSListInterface
instance.
- Parameters
iface (Optional[CFSListInterface]) – The
CFSListInterface
instance to be wrapped.Important
When wrapping an instance of
CFSListInterface
, it is necessary to call__disown__()
on it to avoid Python freeing the allocated object. The object will be freed automatically by theCFSList
wrapper.Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.
See also
CFSListInterface
.Methods:
At
(i)Retrieves a specific entry in the list.
Count
()Returns the number of entries in the list.
IsNull
()Returns
True
if the list is invalid; otherwise returnsFalse
.
IsValid
()Returns
True
if the list is valid; otherwise returnsFalse
.
Sort
([case_insensitive, dirs_first])Sorts in place the list.
- At(i: int) → Pro.Core.CFSEntry¶
Retrieves a specific entry in the list.
- Parameters
i (int) – The position of the entry to retrieve.
- Returns
Returns the entry if successful; otherwise returns an invalid
CFSEntry
.- Return type
See also
Count()
.
- IsNull() → bool¶
- Returns
Returns
True
if the list is invalid; otherwise returnsFalse
.- Return type
bool
See also
IsValid()
.
- IsValid() → bool¶
- Returns
Returns
True
if the list is valid; otherwise returnsFalse
.- Return type
bool
See also
IsNull()
.
- Sort(case_insensitive: bool = True, dirs_first: bool = True) → None¶
Sorts in place the list.
- Parameters
case_insensitive (bool) – If
True
, sorts the list ignoring the case; otherwise respects the case.dirs_first (bool) – If
True
, places directories before file entries; otherwise mixes directory and file entries.
- class CFSListInterface¶
This class represents a file system list.
Its method should never be called directly, but through
CFSList
.Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.
See also
CFSList
.Methods:
At
(i)Retrieves a specific entry in the list.
Count
()Returns the number of entries in the list.
- At(i: int) → Pro.Core.CFSEntry¶
Retrieves a specific entry in the list.
- Parameters
i (int) – The position of the entry to retrieve.
- Returns
Returns the entry if successful; otherwise returns an invalid
CFSEntry
.- Return type
See also
Count()
.
- class CFSNonRecursiveEnum(inst_or_intf: Union[Pro.Core.CFSInstance, Pro.Core.CFSInterface])¶
This class serves the purpose of enumerating files without using recursion.
Available since Cerbero Suite 8.1 and Cerbero Engine 5.1.
- Parameters
inst_or_intf (Union[CFSInstance, CFSInterface]) – Either a
CFSInterface
or aCFSInstance
.Methods:
AddPath
(path)Adds a path to the paths to walk.
EnableReturnDirectories
([return_dirs])Sets whether directories should be returned by the
Next()
method.
EnableSymbolicLinks
([dirs, files])Sets the behavior for symbolic links.
GetPaths
()Returns the paths to be walked.
IncludeSubDirectories
(include_subdirs)Sets whether sub-directories should be included in the enumeration.
Next
([wo])Retrieves the next file name.
SetFileExtensions
(exts)Sets the file extensions for the enumeration.
SetPaths
(paths)Sets the paths to walk.
- AddPath(path: str) → None¶
Adds a path to the paths to walk.
- Parameters
path (str) – The path to add.
See also
SetPaths()
andGetPaths()
.
- EnableReturnDirectories(return_dirs: bool = True) → None¶
Sets whether directories should be returned by the
Next()
method.By default, directories are not returned.
- Parameters
return_dirs (bool) – If
True
, the class returns directories; otherwise directories are not returned.See also
EnableSymbolicLinks()
andIncludeSubDirectories()
.
- EnableSymbolicLinks(dirs: bool = True, files: bool = True) → None¶
Sets the behavior for symbolic links.
By default, the enumeration returns symbolic link files but doesn’t follow symbolic directory links.
- Parameters
dirs (bool) – If
True
, the enumeration follows symbolic directories; otherwise they are not followed.files (bool) – If
True
, symbolic file links are returned.See also
EnableReturnDirectories()
andIncludeSubDirectories()
.
- GetPaths() → Pro.Core.NTStringList¶
- Returns
Returns the paths to be walked.
- Return type
See also
AddPath()
andSetPaths()
.
- IncludeSubDirectories(include_subdirs: bool) → None¶
Sets whether sub-directories should be included in the enumeration.
Note
This class is specifically designed to walk sub-directories, but sometimes it can be useful to enumerate files in a list of directories without including their sub-directories.
- Parameters
include_subdirs (bool) – If
True
, sub-directories are included in the enumeration; otherwise they are excluded.See also
EnableReturnDirectories()
andEnableSymbolicLinks()
.
- Next(wo: Optional[Pro.Core.NTIWait] = None) → str¶
Retrieves the next file name.
- Parameters
wo (NTIWait) – An optional wait object for the operation.
- Returns
Returns the next file name if available; otherwise returns an empty string.
- Return type
str
See also
AddPath()
andSetPaths()
.
- SetFileExtensions(exts: Pro.Core.NTStringList) → None¶
Sets the file extensions for the enumeration.
Hint
This method is useful if the enumeration should return only files with specific extensions.
- Parameters
exts (NTStringList) – The list of file extensions that should be returned.
- SetPaths(paths: Pro.Core.NTStringList) → None¶
Sets the paths to walk.
- Parameters
paths (NTStringList) – The path list.
See also
AddPath()
andGetPaths()
.
- CT_ActionScript2: Final[int]¶
Scan entry type for ActionScript2.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_ActionScript3: Final[int]¶
Scan entry type for ActionScript3.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_AppLaunch: Final[int]¶
Scan entry type for application launches.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_AttackSurface: Final[int]¶
Scan entry type for attack surfaces.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_BinaryData: Final[int]¶
Scan entry type for binary data.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_Blacklisted: Final[int]¶
Scan entry type for a blacklisted item.
Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_ByteCode: Final[int]¶
Scan entry type for byte-code.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_DalvikByteCode: Final[int]¶
Scan entry type for Dalvik byte-code.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_DataEntriesEnd: Final[int]¶
Scan entry type for data entries end.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_DataEntriesStart: Final[int]¶
Scan entry type for data entries start.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_DebugData: Final[int]¶
Scan entry type for debug data.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_DecompressionBomb: Final[int]¶
Scan entry type for decompression bombs.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_EmbeddedFile: Final[int]¶
Scan entry type for embedded objects.
See also
SEC_File
,ScanProvider.addEntry()
andScanEntryData
.
- CT_EntryLimit: Final[int]¶
Scan entry type for entry limits.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_FileSystemLimit: Final[int]¶
Scan entry type for when a file system objects exceeds the maximum size at which its files are automatically scanned.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_ForeignData: Final[int]¶
Scan entry type for foreign data.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_FreePages: Final[int]¶
Scan entry type for free pages.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_Geolocation: Final[int]¶
Scan entry type for geo-locations.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_HiddenSheets: Final[int]¶
Scan entry type for hidden sheets.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_Intelligence: Final[int]¶
Scan entry type for an intelligence report.
Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_InteractiveForm: Final[int]¶
Scan entry type for interactive forms.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_InvalidCertificate: Final[int]¶
Scan entry type for invalid certificates.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_JavaByteCode: Final[int]¶
Scan entry type for Java byte-code.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_JavaScript: Final[int]¶
Scan entry type for JavaScript.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_MSILByteCode: Final[int]¶
Scan entry type for MSIL byte-code.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_Malformed: Final[int]¶
Scan entry type for malformed data.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_MalformedDocument: Final[int]¶
Scan entry type for malformed documents.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_MetaData: Final[int]¶
Scan entry type for meta-data.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_MetaDataUnknown: Final[int]¶
Scan entry type for unknown meta-data.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_NativeCode: Final[int]¶
Scan entry type for native code.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_NoDecompress: Final[int]¶
Scan entry type for failed decompression.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_NoDecrypt: Final[int]¶
Scan entry type for failed decryption.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_OKDecompressed: Final[int]¶
Scan entry type for successful decompression.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_OKDecrypted: Final[int]¶
Scan entry type for successful decryption.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_PersonalData: Final[int]¶
Scan entry type for personal data.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_Privileges: Final[int]¶
Scan entry type for required privileges.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_Recursive: Final[int]¶
Scan entry type for recursion.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_Report: Final[int]¶
Scan entry type for a report.
Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_Resources: Final[int]¶
Scan entry type for issues in resources.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_Script: Final[int]¶
Scan entry type for scripts.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_ShellCode: Final[int]¶
Scan entry type for shellcode.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_SignatureMatch: Final[int]¶
Scan entry type for signature matches.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_SpreadsheetFormulas: Final[int]¶
Scan entry type for spreadsheet formulas.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_SymbolicLink: Final[int]¶
Scan entry type for symbolic links.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_Thumbnail: Final[int]¶
Scan entry type for thumbnails.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_TrueType: Final[int]¶
Scan entry type for TrueType fonts.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_TrustedCertificate: Final[int]¶
Scan entry type for trusted certificates.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_Type1: Final[int]¶
Scan entry type for Type1 fonts.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_Type2: Final[int]¶
Scan entry type for Type2 fonts.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_UnaccountedSpace: Final[int]¶
Scan entry type for unaccounted space.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_UnknownFont: Final[int]¶
Scan entry type for unknown fonts.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_UnpackLimit: Final[int]¶
Scan entry type for the decompression limit.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_UnpackNestLimit: Final[int]¶
Scan entry type for the decompression nesting limit.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_UnreferencedData: Final[int]¶
Scan entry type for unreferenced data.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_UntrustedCertificate: Final[int]¶
Scan entry type for untrusted certificates.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_UnverifiedCertificate: Final[int]¶
Scan entry type for unverified certificates.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_VBAScript: Final[int]¶
Scan entry type for VBA code.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_VBSScript: Final[int]¶
Scan entry type for VBS scripts.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_VersionInfo: Final[int]¶
Scan entry type for version information.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_Whitelisted: Final[int]¶
Scan entry type for a whitelisted item.
Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_WrongCheckSum: Final[int]¶
Scan entry type for invalid checksums.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_WrongDigest: Final[int]¶
Scan entry type for invalid digests.
See also
ScanProvider.addEntry()
andScanEntryData
.
- CT_WrongHash: Final[int]¶
Scan entry type for invalid hashes.
See also
ScanProvider.addEntry()
andScanEntryData
.
- class CommonSystem¶
Logic providers return classes derived from this class to define a scanning behaviour.
See also
LocalSystem
andProCoreContext.getSystem()
.Methods:
addFile
(file[, name])Adds a file to the queue of files to scan.
addFiles
(files[, names])Adds a a list of files to the queue of files to scan.
addPath
(path)Adds a path to the queue of paths to scan.
addPaths
(paths)Adds a list of paths to the queue of paths to scan.
allPaths
()Scans all available paths.
clear
()Clears the scan system.
Returns the path separator for the current platform.
Retrieves the scan context for the system.
Returns the path separator for the system.
Returns
True
if the system performs a batch scan; otherwise returnsFalse
.
last
()Returns the last
FileToScan
returned by callingnext()
.
next
()Returns the next file to scan if available; otherwise returns an invalid
FileToScan
instance.
nextFile
()This method must be overwritten by derived classes to provide the next
FileToScan
data.
setBatchScan
(b)Sets the batch scan status of the system.
Sets the path separator for the current platform.
Sets the scan context for the system.
setDefaultSeparator
(sep)Sets the path separator for the system.
setExtensions
(exts)Sets the file extensions to scan.
setPrefixReplace
(before, after)Sets a replacement rule for file prefixes.
- addFile(file: str, name: str = str()) → None¶
Adds a file to the queue of files to scan.
- Parameters
file (str) – The name of the file to scan on disk.
name (str) – An optional name for the file.
See also
addFiles()
andaddPath()
.
- addFiles(files: Pro.Core.NTStringList, names: Pro.Core.NTStringList = NTStringList()) → None¶
Adds a a list of files to the queue of files to scan.
- Parameters
files (NTStringList) – A list with the names of the files to scan on disk.
names (NTStringList) – A list with optional names for the files.
See also
addFile()
andaddPaths()
.
- addPath(path: str) → None¶
Adds a path to the queue of paths to scan.
- Parameters
path (str) – The path to scan.
See also
addPaths()
,addFile()
andallPaths()
.
- addPaths(paths: Pro.Core.NTStringList) → None¶
Adds a list of paths to the queue of paths to scan.
- Parameters
paths (NTStringList) – A list of the paths to scan.
See also
addPath()
,addFiles()
andallPaths()
.
- allPaths() → None¶
Scans all available paths.
See also
addFiles()
andaddPaths()
.
- clear() → None¶
Clears the scan system.
See also
addFile()
andaddPaths()
.
- defaultLocalSeparator() → int¶
- Returns
Returns the path separator for the current platform.
- Return type
int
See also
setDefaultLocalSeparator()
anddefaultSeparator()
.
- defaultScanContext() → str¶
Retrieves the scan context for the system.
Note
This method is served for future use.
- Returns
Returns the scan context.
- Return type
str
See also
setDefaultScanContext()
.
- defaultSeparator() → int¶
- Returns
Returns the path separator for the system.
- Return type
int
See also
setDefaultSeparator()
anddefaultLocalSeparator()
.
- isBatchScan() → bool¶
- Returns
Returns
True
if the system performs a batch scan; otherwise returnsFalse
.- Return type
bool
See also
setBatchScan()
.
- last() → Pro.Core.FileToScan¶
- Returns
Returns the last
FileToScan
returned by callingnext()
.- Return type
See also
next()
.
- next() → Pro.Core.FileToScan¶
- Returns
Returns the next file to scan if available; otherwise returns an invalid
FileToScan
instance.- Return type
See also
last()
andnextFile()
.
- nextFile() → Pro.Core.FileToScan¶
This method must be overwritten by derived classes to provide the next
FileToScan
data.Warning
This method must not be called directly! Instead,
next()
must be called.
- Returns
Returns the next file to scan if available; otherwise returns an invalid
FileToScan
instance.- Return type
- setBatchScan(b: bool) → None¶
Sets the batch scan status of the system.
By default the batch scan status is set to
True
.
- Parameters
b (bool) – If
True
, the system performs a batch scan; otherwise it performs a single scan.See also
isBatchScan()
.
- setDefaultLocalSeparator(sep: int) → None¶
Sets the path separator for the current platform.
- Parameters
sep (int) – The local path separator.
See also
defaultLocalSeparator()
andsetDefaultSeparator()
.
- setDefaultScanContext(ctx: str) → None¶
Sets the scan context for the system.
Note
This method is served for future use.
- Parameters
ctx (str) – The scan context.
See also
defaultScanContext()
.
- setDefaultSeparator(sep: int) → None¶
Sets the path separator for the system.
- Parameters
sep (int) – The path separator.
See also
defaultSeparator()
andsetDefaultLocalSeparator()
.
- setExtensions(exts: Pro.Core.NTStringList) → None¶
Sets the file extensions to scan.
- Parameters
exts (NTStringList) – The list of file extensions to scan.
See also
addFiles()
andaddPaths()
.
- setPrefixReplace(before: str, after: str) → None¶
Sets a replacement rule for file prefixes.
- Parameters
before (str) – The prefix to replace.
after (str) – The new prefix.
See also
addFiles()
andaddPaths()
.
- CurrentEndianness() → int¶
- Returns
Returns the endianness of the system (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Return type
int
- DSNF_NoAccessSpecifier: Final[int]¶
Doesn’t include the member type (i.e.: public, protected, private) in the unmangled symbol.
See also
DemangleSymbolName()
.
- DSNF_NoCallingConvention: Final[int]¶
Doesn’t include the calling convention in the unmangled symbol.
See also
DemangleSymbolName()
.
- DSNF_NoMemberType: Final[int]¶
Doesn’t include the member type (i.e.: static, virtual, extern) in the unmangled symbol.
See also
DemangleSymbolName()
.
- DSNF_NoReturnType: Final[int]¶
Doesn’t include the return type in the unmangled symbol.
See also
DemangleSymbolName()
.
- DSNF_SimpleSignature: Final[int]¶
Returns a simplified signature of the unmangled symbol.
Combination of
DSNF_NoAccessSpecifier
,DSNF_NoCallingConvention
,DSNF_NoReturnType
andDSNF_NoMemberType
.See also
DemangleSymbolName()
.
- DemangleSymbolName(mangled: str, flags: int = 0) → str¶
Unmangles a decorated symbol. Symbols generated by Visual C++ and GCC are supported.
- Parameters
mangled (str) – The mangled symbol.
flags (int) – Optional flags (e.g.:
DSNF_SimpleSignature
).- Returns
Returns the unmangled symbol.
- Return type
str
See also
MethodNameFromSimpleSignature()
andDSNF_SimpleSignature
.
- DisasmOpt_FileOffsets: Final[int]¶
Shows offsets in disassemblies shown in the text view.
See also
proDisasmOptions()
.
- DisasmOpt_Opcodes: Final[int]¶
Shows opcodes in disassemblies shown in the text view.
See also
proDisasmOptions()
.
- ENDIANNESS_BIG: Final[int]¶
Big-endian option.
See also
ENDIANNESS_LITTLE
andCFFObject.SetDefaultEndianness()
.
- ENDIANNESS_LITTLE: Final[int]¶
Little-endian option.
See also
ENDIANNESS_BIG
andCFFObject.SetDefaultEndianness()
.
- EXPLICIT_OFLAGS_MASK: Final[int]¶
The mask for explicit object flags.
Explicit flags are set by the scan provider during the scanning process.
See also
ScanProvider
andIMPLICIT_OFLAG_UNKNOWN_FORMAT
.
- class FileToScan¶
This class contains information about the file to scan returned by classes derived from
CommonSystem
.See also
CommonSystem.next()
andCommonSystem
.Methods:
clear
()Clears the instance.
context
()Returns the scan context for the file.
format
()Returns the format to be used to scan the file.
isValid
()Returns
True
if the file to scan is valid; otherwise returnsFalse
.Returns the name of the file to scan on disk.
name
()Returns the optional name of the file to scan.
setContext
(context)Sets the scan context for the file.
setFormat
(format)Sets the format to be used to scan the file.
setLocalName
(locname)Sets the name of the file to scan on disk.
setName
(name)Sets the optional name of the file to scan.
- context() → str¶
- Returns
Returns the scan context for the file.
- Return type
str
See also
setContext()
andCommonSystem.defaultScanContext()
.
- format() → str¶
- Returns
Returns the format to be used to scan the file.
- Return type
str
See also
setFormat()
.
- isValid() → bool¶
- Returns
Returns
True
if the file to scan is valid; otherwise returnsFalse
.- Return type
bool
See also
clear()
.
- localName() → str¶
- Returns
Returns the name of the file to scan on disk.
- Return type
str
See also
setLocalName()
andname()
.
- name() → str¶
- Returns
Returns the optional name of the file to scan.
- Return type
str
See also
setName()
andlocalName()
.
- setContext(context: str) → None¶
Sets the scan context for the file.
- Parameters
context (str) – The scan context.
See also
context()
andCommonSystem.setDefaultScanContext()
.
- setFormat(format: str) → None¶
Sets the format to be used to scan the file.
- Parameters
format (str) – The file format.
See also
format()
.
- setLocalName(locname: str) → None¶
Sets the name of the file to scan on disk.
- Parameters
locname (str) – The name of the file on disk.
See also
localName()
andsetName()
.
- setName(name: str) → None¶
Sets the optional name of the file to scan.
- Parameters
name (str) – The optional name of the file.
See also
name()
andsetLocalName()
.
- FormatGroup_AddressSpace: Final[int]¶
Address space format group.
See also
getFormatGroup()
.
- FormatGroup_Archive: Final[int]¶
Archive format group.
See also
getFormatGroup()
.
- FormatGroup_Audio: Final[int]¶
Audio format group.
See also
getFormatGroup()
.
- FormatGroup_Certificate: Final[int]¶
Certificate format group.
See also
getFormatGroup()
.
- FormatGroup_Database: Final[int]¶
Database format group.
See also
getFormatGroup()
.
- FormatGroup_Document: Final[int]¶
Document format group.
See also
getFormatGroup()
.
- FormatGroup_Email: Final[int]¶
Email format group.
See also
getFormatGroup()
.
- FormatGroup_Executable: Final[int]¶
Executable format group.
See also
getFormatGroup()
.
- FormatGroup_FS: Final[int]¶
File system format group.
See also
getFormatGroup()
.
- FormatGroup_First: Final[int]¶
First format group.
See also
getFormatGroup()
.
- FormatGroup_Font: Final[int]¶
Font format group.
See also
getFormatGroup()
.
- FormatGroup_Image: Final[int]¶
Image format group.
See also
getFormatGroup()
.
- FormatGroup_Last: Final[int]¶
Last format group (not included).
See also
getFormatGroup()
.
- FormatGroup_ManagedExecutable: Final[int]¶
Managed executable format group.
See also
getFormatGroup()
.
- FormatGroup_Memory: Final[int]¶
Memory format group.
See also
getFormatGroup()
.
- FormatGroup_P2P: Final[int]¶
P2P format group.
See also
getFormatGroup()
.
- FormatGroup_Script: Final[int]¶
Script format group.
See also
getFormatGroup()
.
- FormatGroup_System: Final[int]¶
System file format group.
See also
getFormatGroup()
.
- FormatGroup_Unknown: Final[int]¶
Unknown format group.
See also
getFormatGroup()
.
- FormatGroup_Video: Final[int]¶
Video format group.
See also
getFormatGroup()
.
- class FormatItemInfo¶
The information about a format item returned by
ScanProvider._formatViewInfo()
.Attributes:
The background color.
The format item id.
An integer which represents the public icon to be used for the item.
The text to be used as label for the item.
Methods:
clear
()Clears the fields of the class.
- clear() → None¶
Clears the fields of the class.
- fid¶
The format item id. This is the id provided when creating the
FormatTree
.
- icon¶
An integer which represents the public icon to be used for the item. Public icons are defined in the Pro.UI module.
- text¶
The text to be used as label for the item.
- class FormatTree¶
Bases:
Pro.Core.NTUIntTree
Tree of
FormatTreeNode
nodes.
- class FormatTreeNode¶
Bases:
Pro.Core.NTUIntTreeNode
This class represents a node of
FormatTree
.
- class FormatTreeNodeList¶
Bases:
Pro.Core.NTUIntTreeNodeList
List of
FormatTreeNode
elements.
- class FormatTreeNodeListIt(obj: Pro.Core.FormatTreeNodeList)¶
Bases:
Pro.Core.NTUIntTreeNodeListIt
Iterator class for
FormatTreeNodeList
.
- Parameters
obj (FormatTreeNodeList) – The object to iterate over.
- GB_SIZE: Final[int]¶
This constant defines the size of a gigabyte.
- GSP_FDFL_DONT_SORT: Final[int]¶
Don’t sort scan providers flag.
See also
getSupportedFormatsAndDescr()
.
- GSP_FDFL_INCLUDE_DUMMY: Final[int]¶
Include dummy provider flag.
See also
getSupportedFormatsAndDescr()
.
- GSP_FDFL_ONLY_EXTERNALS: Final[int]¶
Include external scan providers flag.
See also
getSupportedFormatsAndDescr()
.
- GSP_FDFL_ONLY_FORMATS: Final[int]¶
Include only formats and not extensions flag.
See also
getSupportedFormatsAndDescr()
.
- IMPLICIT_OFLAG_UNKNOWN_FORMAT: Final[int]¶
Implicit object flag.
This flag is automatically set if no matching file format could be found for the scanned object or one of its embedded objects.
See also
ScanProvider
andEXPLICIT_OFLAGS_MASK
.
- INVALID_OFFSET: Final[int]¶
Invalid file or data offset.
The equivalent of
INVALID_STREAM_OFFSET
.See also
NTContainer
andCFFObject
.
- INVALID_STREAM_OFFSET: Final[int]¶
Invalid file or data offset.
The equivalent of
INVALID_OFFSET
.See also
NTContainer
andCFFObject
.
- KB_SIZE: Final[int]¶
This constant defines the size of a kilobyte.
- class KROffset¶
Match for a byte search in
NTContainer
.See also
NTContainer.find()
,NTContainer.findFirst()
andNTContainer.findMulti()
.Attributes:
The start offset of the matche sequence.
The index of the matched pattern.
- offset¶
The start offset of the matche sequence. It’s
INVALID_STREAM_OFFSET
in case of no match.
- pattern¶
The index of the matched pattern. This value applies only to
NTContainer.findMulti()
.
- class Layout¶
Layouts are used to create ranges and associate structures to hex views.
Layouts can be exported and imported as XML data.
Note
Structures referenced by layouts must be stored in SQLite-backed header files. In the future we plan to allow XML header data to be stored inside the layout itself.
In the following code example a simple layout is created for a 64-bit Elf file and is then associated to the current hex view:
from Pro.Core import * from Pro.UI import * def buildElfLayout(obj, l): # load the SQLite-backed header file hname = "elf" hdr = CFFHeader() if not hdr.LoadFromFile(hname): return # specify the packing options for the structures we add to the layout sopts = CFFSO_GCC | CFFSO_Pack1 d = LayoutData() d.setTypeOptions(sopts) # add the Elf header to the layout ehdr = obj.MakeStruct(hdr, "_Elf64_Ehdr", 0, sopts) d.setColor(ntRgba(255, 0, 0, 70)) d.setStruct(hname, "_Elf64_Ehdr") l.add(0, ehdr.Size(), d) # add the sections (we assume that e_shentsize is 0x40) to the layout e_shoff = ehdr.Num("e_shoff") e_shnum = ehdr.Num("e_shnum") esects = obj.MakeStructArray(hdr, "_Elf64_Shdr", e_shoff, e_shnum, sopts) d.setStruct(hname, "_Elf64_Shdr") d.setArraySize(e_shnum) l.add(e_shoff, esects.TotalSize(), d) # get the current view hv = proContext().getCurrentView() # it must be a hew view if hv.isValid() and hv.type() == ProView.Type_Hex: # get the container referenced by the hex view c = hv.getData() obj = CFFObject() obj.Load(c) # create a new layout named "ELF_ANALYSIS" lname = "ELF_ANALYSIS" l = proContext().getLayout(lname) # build the layout buildElfLayout(obj, l) # apply the layout to the current hex view hv.setLayoutName(lname)See also
LayoutInterval
,LayoutData
,LayoutPair
andCFFHeader
.Methods:
add
(interval_or_offset, data_or_size[, data])Associates
LayoutData
to an interval.
at
(i_or_interval_or_lp)Retrieves the index of the layout entry if an interval or layout pair are specified; otherwise returns a layout pair if an index is specified.
clear
()Clears the current layout.
count
()Returns the number of layout entries.
fromXml
(xstr)Imports a layout from XML data.
getMatches
(offset, size)Retrieves a list of layout pairs which match exactly the specified interval.
getOverlappingWith
(offset, size)Retrieves a list of layout pairs which overlap with the specified interval.
Returns
True
if the layout was modified; otherwise returnsFalse
.
isNull
()Returns
True
if the layout is invalid; otherwise returnsFalse
.
isValid
()Returns
True
if the layout is valid; otherwise returnsFalse
.Returns the name of the layout.
remove
(interval_or_offset[, size])Removes layout entries matching a specified interval.
renameLayout
(name)Renames the layout.
Saves the layout to the current project if the layout was modified.
setModified
(b)Sets the modified status of the layout.
toXml
()Exports the layout to XML.
- add(interval_or_offset: Union[Pro.Core.LayoutInterval, int], data_or_size: Union[Pro.Core.LayoutData, int], data: Optional[Pro.Core.LayoutData] = None) → None¶
Associates
LayoutData
to an interval.
- Parameters
interval_or_offset (Union[LayoutInterval, int]) – Either the interval or the start offset of the interval.
data_or_size (Union[LayoutData, int]) – Either the data to associate or the size of the interval.
data (Optional[LayoutData]) – The data to associate.
- at(i_or_interval_or_lp: Union[Pro.Core.LayoutInterval, Pro.Core.LayoutPair, int]) → Union[Pro.Core.LayoutPair, int]¶
Retrieves the index of the layout entry if an interval or layout pair are specified; otherwise returns a layout pair if an index is specified.
- Parameters
i_or_interval_or_lp (Union[LayoutInterval, LayoutPair, int]) – Either the index of the layout entry, the interval or the layout pair.
- Returns
Returns the index of the layout entry if an interval or layout pair are specified and successful; otherwise returns
0
. Alternatively, returns a layout pair if an index is specified and successful; otherwise returns an invalid layout pair.- Return type
Union[LayoutPair, int]
- count() → int¶
- Returns
Returns the number of layout entries.
- Return type
int
- fromXml(xstr: str) → bool¶
Imports a layout from XML data.
- Parameters
xstr (str) – The XML string.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
toXml()
.
- getMatches(offset: int, size: int) → Pro.Core.LayoutPairList¶
Retrieves a list of layout pairs which match exactly the specified interval.
- Parameters
offset (int) – The start offset of the interval.
size (int) – The size of the interval.
- Returns
Returns a list of layout pairs.
- Return type
See also
getOverlappingWith()
.
- getOverlappingWith(offset: int, size: int) → Pro.Core.LayoutPairList¶
Retrieves a list of layout pairs which overlap with the specified interval.
- Parameters
offset (int) – The start offset of the interval.
size (int) – The size of the interval.
- Returns
Returns a list of layout pairs.
- Return type
See also
getMatches()
.
- isModified() → bool¶
- Returns
Returns
True
if the layout was modified; otherwise returnsFalse
.- Return type
bool
See also
setModified()
.
- isNull() → bool¶
- Returns
Returns
True
if the layout is invalid; otherwise returnsFalse
.- Return type
bool
See also
isValid()
.
- isValid() → bool¶
- Returns
Returns
True
if the layout is valid; otherwise returnsFalse
.- Return type
bool
See also
isNull()
.
- layoutName() → str¶
- Returns
Returns the name of the layout.
- Return type
str
See also
renameLayout()
.
- remove(interval_or_offset: Union[Pro.Core.LayoutInterval, int], size: Optional[int] = None) → None¶
Removes layout entries matching a specified interval.
- Parameters
interval_or_offset (Union[LayoutInterval, int]) – Either the interval or the start offset of the interval.
size (Optional[int]) – The size of the interval.
- renameLayout(name: str) → bool¶
Renames the layout.
- Parameters
name (str) – The new name of the layout.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
layoutName()
.
- saveIfModified() → None¶
Saves the layout to the current project if the layout was modified.
See also
isModified()
.
- setModified(b: bool) → None¶
Sets the modified status of the layout.
- Parameters
b (bool) – If
True
, the layout is marked as modified.See also
isModified()
.
- class LayoutData¶
This class contains the data of a layout entry.
See also
Layout
.Methods:
Returns the size of the array of structures.
getColor
()Returns the background color of the netry.
Returns the description of the entry.
Returns the name of header which contains the referenced structure.
getType
()Returns the name of the associated structure.
setArraySize
(n)Sets the size of the array of structures.
setColor
(rgba)Sets the background color.
setDescription
(description)Sets the description of the entry.
setStruct
(hdr, type)Sets the associated structure.
setTypeOptions
(opt)Sets the options for the associated structure.
Returuns the options for associated structure.
- arraySize() → int¶
- Returns
Returns the size of the array of structures.
- Return type
int
See also
setArraySize()
.
- getColor() → int¶
- Returns
Returns the background color of the netry.
- Return type
int
See also
setColor()
.
- getDescription() → str¶
- Returns
Returns the description of the entry.
- Return type
str
See also
setDescription()
.
- getHeader() → str¶
- Returns
Returns the name of header which contains the referenced structure.
- Return type
str
See also
setStruct()
.
- getType() → str¶
- Returns
Returns the name of the associated structure.
- Return type
str
See also
setStruct()
.
- setArraySize(n: int) → None¶
Sets the size of the array of structures.
- Parameters
n (int) – The size of the array.
See also
arraySize()
.
- setColor(rgba: int) → None¶
Sets the background color.
- Parameters
rgba (int) – The background color.
See also
getColor()
.
- setDescription(description: str) → None¶
Sets the description of the entry.
- Parameters
description (str) – The description of the entry.
See also
getDescription()
.
- setStruct(hdr: str, type: str) → None¶
Sets the associated structure.
- Parameters
hdr (str) – The name of the header file which contains the structure.
type (str) – The name of the structure.
See also
getHeader()
andgetType()
.
- setTypeOptions(opt: int) → None¶
Sets the options for the associated structure.
- Parameters
opt (int) – The options for the associated structure (e.g.,
CFFSO_Pack1
).See also
typeOptions()
andsetStruct()
.
- typeOptions() → int¶
- Returns
Returuns the options for associated structure.
- Return type
int
See also
setTypeOptions()
andsetStruct()
.
- class LayoutInterval¶
This class represents a layout interval.
See also
Layout
.Attributes:
The end offset of the interval.
The start offset of the interval.
- end¶
The end offset of the interval.
- start¶
The start offset of the interval.
- class LayoutPair(t1: Optional[Pro.Core.LayoutInterval] = None, t2: Optional[Pro.Core.LayoutData] = None)¶
Pair of (
LayoutInterval
,LayoutData
) elements.
- Parameters
t1 (Optional[LayoutInterval]) – The first element of the pair.
t2 (Optional[LayoutData]) – The second element of the pair.
Methods:
first
()Returns the first element in the pair.
second
()Returns the second element in the pair.
setFirst
(v)Sets the first element in the pair.
setSecond
(v)Sets the second element in the pair.
- first() → Pro.Core.LayoutInterval¶
- Returns
Returns the first element in the pair.
- Return type
See also
second()
andsetFirst()
.
- second() → Pro.Core.LayoutData¶
- Returns
Returns the second element in the pair.
- Return type
See also
first()
andsetSecond()
.
- setFirst(v: Pro.Core.LayoutInterval) → None¶
Sets the first element in the pair.
- Parameters
v (LayoutInterval) – The value of the element.
See also
first()
andsetSecond()
.
- setSecond(v: Pro.Core.LayoutData) → None¶
Sets the second element in the pair.
- Parameters
v (LayoutData) – The value of the element.
See also
second()
andsetFirst()
.
- class LayoutPairList¶
List of
LayoutPair
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: Pro.Core.LayoutPair) → None¶
Inserts
value
at the end of the list.
- Parameters
value (LayoutPair) – The value to add to the list.
See also
insert()
.
- at(i: int) → Pro.Core.LayoutPair¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
- clear() → None¶
Removes all items from the list.
- contains(value: Pro.Core.LayoutPair) → bool¶
Checks the presence of an element in the list.
- Parameters
value (LayoutPair) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: Pro.Core.LayoutPair) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (LayoutPair) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: Pro.Core.LayoutPair, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (LayoutPair) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: Pro.Core.LayoutPair) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (LayoutPair) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.LayoutPairListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: Pro.Core.LayoutPair) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (LayoutPair) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → Pro.Core.LayoutPair¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
See also
removeAt()
.
- class LayoutPairListIt(obj: Pro.Core.LayoutPairList)¶
Iterator class for
LayoutPairList
.
- Parameters
obj (LayoutPairList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → Pro.Core.LayoutPair¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
See also
hasNext()
andprevious()
.
- previous() → Pro.Core.LayoutPair¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class LocalSystem¶
Bases:
Pro.Core.CommonSystem
CommonSystem
derived class used to perform local file system scans.See also
CommonSystem
andProCoreContext.getSystem()
.
- MB_SIZE: Final[int]¶
This constant defines the size of a megabyte.
- METAFLAG_STRING: Final[int]¶
Specifies the string nature of the meta-data.
See also
ScanMetaDataEntry.flags
andScanProvider.addMetaDataString()
.
- MethodNameFromSimpleSignature(signature: str) → str¶
Extracts the function or method name from a simple signature. A simple method signature doesn’t include a return type or other specifiers before the method name.
When working with mangled symbols, the simple signature must first be obtained by calling
DemangleSymbolName()
withDSNF_SimpleSignature
.
- Parameters
signature (str) – The simple signature.
- Returns
Returns the method name.
- Return type
str
See also
DemangleSymbolName()
.
- NATURE_BYTEARRAY: Final[int]¶
Byte-array type nature.
See also
CFFObject.GetTypeNature()
.
- NATURE_NUMBER: Final[int]¶
Integer number type nature.
See also
CFFObject.GetTypeNature()
.
- NATURE_REAL: Final[int]¶
Real number type nature.
See also
CFFObject.GetTypeNature()
.
- NATURE_STRING: Final[int]¶
String type nature.
See also
CFFObject.GetTypeNature()
.
- NATURE_UNKNOWN: Final[int]¶
Unknown type nature.
See also
CFFObject.GetTypeNature()
.
- class NTAddressSpace¶
This class is used to apply address spaces to containers.
See also
NTContainer.addAddressSpace()
,createAddressSpace()
andcreateSparseAddressSpace()
.Methods:
addSparseRange
(address, size[, offset, flags])Adds a sparse range to the address space.
Returns the start and end address of the address space.
Returns
True
if address translation caching is enabled; otherwise returnsFalse
.
flags
()Returns the flags for the address space (e.g.,
NT_ASF_IgnoreInvalidPages
).
getPageFlagsLabels
(pflags[, all])Converts page flags into a list of strings.
isNull
()Returns
True
if the address space is invalid; otherwise returnsFalse
.
pageFlags
(c, address)Returns the page flags for the specified address.
pageSize
()Returns the page size of the address space.
Sets the status of address translation caching.
setFlags
(f)Sets the flags for the address space.
size
()Returns the size of the address space.
stdPageFlags
(c, address)Returns standard page flags such as
NT_ASPSF_EXECUTE
for a specified address.
toAddress
(c, offset)Converts an offset to an address.
toOffset
(c, address)Converts an address to an offset.
toStdPageFlags
(pflags)Converts address specific page flags retrieved by calling
pageFlags()
into standard page flags (e.g.,NT_ASPSF_EXECUTE
).
- addSparseRange(address: int, size: int, offset: int = INVALID_STREAM_OFFSET, flags: int = - 1) → None¶
Adds a sparse range to the address space.
- Parameters
address (int) – The address of the range.
size (int) – The size of the range.
offset (int) – The offset at which to map the address.
flags (int) – Optional page flags for the range (e.g.,
NT_ASPSF_EXECUTE
).See also
createSparseAddressSpace()
.
- addressRange() → tuple¶
- Returns
Returns the start and end address of the address space.
- Return type
tuple[int, int]
See also
size()
.
- cacheEnabled() → bool¶
- Returns
Returns
True
if address translation caching is enabled; otherwise returnsFalse
.- Return type
bool
See also
setCacheEnabled()
.
- flags() → int¶
- Returns
Returns the flags for the address space (e.g.,
NT_ASF_IgnoreInvalidPages
).- Return type
int
See also
setFlags()
.
- getPageFlagsLabels(pflags: int, all: bool = False) → Pro.Core.NTStringList¶
Converts page flags into a list of strings.
- Parameters
pflags (int) – The page flags.
all (bool) – If
True
, includes every known flag.- Returns
Returns a list of flag labels.
- Return type
See also
pageFlags()
.
- isNull() → bool¶
- Returns
Returns
True
if the address space is invalid; otherwise returnsFalse
.- Return type
bool
- pageFlags(c: Pro.Core.NTContainer, address: int) → tuple¶
Returns the page flags for the specified address.
The returned flags can be platform specific and may not be standard page flags such as
NT_ASPSF_EXECUTE
. To convert the returned flags into standard page flags, usetoStdPageFlags()
. Alternatively,stdPageFlags()
can be called instead of this method to retrieve standard page flags for a specified address.
- Parameters
c (NTContainer) – The source container.
address (int) – The address for which to retrieve the page flags.
- Returns
Returns the result of the operation (possible values are
NT_ASR_UNSUPPORTED
,NT_ASR_INVALID
andNT_ASR_OK
) and the page flags if the first value isNT_ASR_OK
.- Return type
tuple[int, int]
See also
getPageFlagsLabels()
,toStdPageFlags()
andstdPageFlags()
.
- pageSize() → int¶
- Returns
Returns the page size of the address space.
- Return type
int
- setCacheEnabled(b: bool) → None¶
Sets the status of address translation caching.
Caching is automatically enabled for address spaces with a page size which is equal or greater than 1 KB.
- Parameters
b (bool) – If
True
, enables address translation caching.See also
cacheEnabled()
.
- setFlags(f: int) → None¶
Sets the flags for the address space.
- Parameters
f (int) – The flags to set (e.g.,
NT_ASF_IgnoreInvalidPages
).See also
flags()
.
- size() → int¶
- Returns
Returns the size of the address space.
- Return type
int
See also
addressRange()
.
- stdPageFlags(c: Pro.Core.NTContainer, address: int) → tuple¶
Returns standard page flags such as
NT_ASPSF_EXECUTE
for a specified address.
- Parameters
c (NTContainer) – The source container.
address (int) – The address for which to retrieve the standard page flags.
- Returns
Returns the result of the operation (possible values are
NT_ASR_UNSUPPORTED
,NT_ASR_INVALID
andNT_ASR_OK
) and the standard page flags if the first value isNT_ASR_OK
.- Return type
tuple[int, int]
See also
pageFlags()
andtoStdPageFlags()
.
- toAddress(c: Pro.Core.NTContainer, offset: int) → int¶
Converts an offset to an address.
Note
Not all address spaces support this functionality.
- Parameters
c (NTContainer) – The source container.
offset (int) – The offset to convert.
- Returns
Returns the address if successful; otherwise returns
INVALID_STREAM_OFFSET
.- Return type
int
See also
toOffset()
.
- toOffset(c: Pro.Core.NTContainer, address: int) → int¶
Converts an address to an offset.
- Parameters
c (NTContainer) – The source container.
address (int) – The address to convert.
- Returns
Returns the offset if successful; otherwise returns
INVALID_STREAM_OFFSET
.- Return type
int
See also
toAddress()
.
- toStdPageFlags(pflags: int) → int¶
Converts address specific page flags retrieved by calling
pageFlags()
into standard page flags (e.g.,NT_ASPSF_EXECUTE
).
- Parameters
pflags (int) – The page flags to convert.
- Returns
Returns the standard page flags.
- Return type
int
See also
pageFlags()
andstdPageFlags()
.
- class NTBuffer¶
Base class for buffered read operations.
This class will throw an
IndexError
exception on error.See also
NTContainerBuffer
andCFFBuffer
.Methods:
_d64
([endianness])Reads a C double backwards.
_f32
([endianness])Reads a C float backwards.
_i16
([endianness])Reads an int16 backwards.
_i32
([endianness])Reads an int32 backwards.
_i64
([endianness])Reads an int64 backwards.
_i8
()Reads an int8 backwards.
_u16
([endianness])Reads an uint16 backwards.
_u32
([endianness])Reads an uint32 backwards.
_u64
([endianness])Reads an uint64 backwards.
_u8
()Reads an uint8 backwards.
d64
([endianness])Reads a C double.
Returns the default endianness for the buffer.
f32
([endianness])Reads a C float.
Returns the current bit position.
Returns the current offset.
i16
([endianness])Reads an int16.
i32
([endianness])Reads an int32.
i64
([endianness])Reads an int64.
i8
()Reads an int8.
isNull
()Returns
True
if the buffer is uninitialized; otherwise returnsFalse
.
isValid
()Returns
True
if the buffer is initialized; otherwise returnsFalse
.
read
(n)Reads a number of bytes from the buffer.
setBufferSize
(size)Sets the internal buffer size.
setDefaultEndianness
(endianness)Sets the default endianness for the buffer.
setOffset
(offset)Sets the current offset for the buffer.
size
()Returns the size of the object referenced by the buffer.
skip
(size)Skips the specified amount of data.
u16
([endianness])Reads an uint16.
u32
([endianness])Reads an uint32.
u64
([endianness])Reads an uint64.
u8
()Reads an uint8.
ubits
(nbits[, fromMSB])Reads an amount of bits.
Reads a specified amount of bytes without using the internal buffer.
- _d64(endianness: Optional[int] = None) → float¶
Reads a C double backwards.
- Parameters
endianness (Optional[int]) – The endianness of the value (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns the numeric value.
- Return type
float
See also
d64()
.
- _f32(endianness: Optional[int] = None) → float¶
Reads a C float backwards.
- Parameters
endianness (Optional[int]) – The endianness of the value (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns the numeric value.
- Return type
float
See also
f32()
.
- _i16(endianness: Optional[int] = None) → int¶
Reads an int16 backwards.
- Parameters
endianness (Optional[int]) – The endianness of the value (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns the numeric value.
- Return type
int
See also
i16()
.
- _i32(endianness: Optional[int] = None) → int¶
Reads an int32 backwards.
- Parameters
endianness (Optional[int]) – The endianness of the value (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns the numeric value.
- Return type
int
See also
i32()
.
- _i64(endianness: Optional[int] = None) → int¶
Reads an int64 backwards.
- Parameters
endianness (Optional[int]) – The endianness of the value (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns the numeric value.
- Return type
int
See also
i64()
.
- _i8() → int¶
Reads an int8 backwards.
- Returns
Returns the numeric value.
- Return type
int
See also
i8()
.
- _u16(endianness: Optional[int] = None) → int¶
Reads an uint16 backwards.
- Parameters
endianness (Optional[int]) – The endianness of the value (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns the numeric value.
- Return type
int
See also
u16()
.
- _u32(endianness: Optional[int] = None) → int¶
Reads an uint32 backwards.
- Parameters
endianness (Optional[int]) – The endianness of the value (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns the numeric value.
- Return type
int
See also
u32()
.
- _u64(endianness: Optional[int] = None) → int¶
Reads an uint64 backwards.
- Parameters
endianness (Optional[int]) – The endianness of the value (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns the numeric value.
- Return type
int
See also
u64()
.
- _u8() → int¶
Reads an uint8 backwards.
- Returns
Returns the numeric value.
- Return type
int
See also
u8()
.
- d64(endianness: Optional[int] = None) → float¶
Reads a C double.
- Parameters
endianness (Optional[int]) – The endianness of the value (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns the numeric value.
- Return type
float
See also
_d64()
.
- defaultEndianness() → int¶
- Returns
Returns the default endianness for the buffer.
- Return type
int
See also
setDefaultEndianness()
,ENDIANNESS_LITTLE
andENDIANNESS_BIG
.
- f32(endianness: Optional[int] = None) → float¶
Reads a C float.
- Parameters
endianness (Optional[int]) – The endianness of the value (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns the numeric value.
- Return type
float
See also
_f32()
.
- getOffset() → int¶
- Returns
Returns the current offset.
- Return type
int
See also
setOffset()
.
- i16(endianness: Optional[int] = None) → int¶
Reads an int16.
- Parameters
endianness (Optional[int]) – The endianness of the value (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns the numeric value.
- Return type
int
See also
_i16()
.
- i32(endianness: Optional[int] = None) → int¶
Reads an int32.
- Parameters
endianness (Optional[int]) – The endianness of the value (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns the numeric value.
- Return type
int
See also
_i32()
.
- i64(endianness: Optional[int] = None) → int¶
Reads an int64.
- Parameters
endianness (Optional[int]) – The endianness of the value (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns the numeric value.
- Return type
int
See also
_i64()
.
- isNull() → bool¶
- Returns
Returns
True
if the buffer is uninitialized; otherwise returnsFalse
.- Return type
bool
See also
isValid()
.
- isValid() → bool¶
- Returns
Returns
True
if the buffer is initialized; otherwise returnsFalse
.- Return type
bool
See also
isNull()
.
- read(n: int) → bytes¶
Reads a number of bytes from the buffer.
- Parameters
n (int) – The number of bytes to read.
- Returns
Returns the bytes read.
- Return type
bytes
See also
unbufferedRead()
andsetBufferSize()
.
- setBufferSize(size: int) → None¶
Sets the internal buffer size. This method must be called before any read operation are performed. If not called, the size will default 1 KB.
- Parameters
size (int) – The size of the internal buffer.
- setDefaultEndianness(endianness: int) → None¶
Sets the default endianness for the buffer.
- Parameters
endianness (int) – The default endianness for the buffer (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).See also
defaultEndianness()
.
- setOffset(offset: int) → None¶
Sets the current offset for the buffer.
- Parameters
offset (int) – The current offset.
See also
getOffset()
andskip()
.
- size() → int¶
- Returns
Returns the size of the object referenced by the buffer.
- Return type
int
See also
getOffset()
.
- skip(size: int) → None¶
Skips the specified amount of data.
Note
Internally this method calls
setOffset()
and resets the internal buffer.
- Parameters
size (int) – The amount of data to skip.
Available since Cerbero Suite 7.8 and Cerbero Engine 4.8.
See also
setOffset()
.
- u16(endianness: Optional[int] = None) → int¶
Reads an uint16.
- Parameters
endianness (Optional[int]) – The endianness of the value (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns the numeric value.
- Return type
int
See also
_u16()
.
- u32(endianness: Optional[int] = None) → int¶
Reads an uint32.
- Parameters
endianness (Optional[int]) – The endianness of the value (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns the numeric value.
- Return type
int
See also
_u32()
.
- u64(endianness: Optional[int] = None) → int¶
Reads an uint64.
- Parameters
endianness (Optional[int]) – The endianness of the value (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).- Returns
Returns the numeric value.
- Return type
int
See also
_u64()
.
- ubits(nbits: int, fromMSB: bool = False) → int¶
Reads an amount of bits.
- Parameters
nbits (int) – The number of bits to read.
fromMSB (bool) – If
True
reads from the most significant bit; otherwise reads from the least significant bit.- Returns
Returns the bits read.
- Return type
int
See also
getBitPosition()
.
- unbufferedRead(n: int) → bytes¶
Reads a specified amount of bytes without using the internal buffer.
Hint
This method is intended to read that exceeds the buffer size set via
setBufferSize()
.
- Parameters
n (int) – The number of bytes to read.
- Returns
Returns the bytes read.
- Return type
bytes
Available since Cerbero Suite 7.8 and Cerbero Engine 4.8.
See also
read()
andsetBufferSize()
.
- class NTByteArrayList¶
List of
bytes
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: bytes) → None¶
Inserts
value
at the end of the list.
- Parameters
value (bytes) – The value to add to the list.
See also
insert()
.
- at(i: int) → bytes¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
bytes
- clear() → None¶
Removes all items from the list.
- contains(value: bytes) → bool¶
Checks the presence of an element in the list.
- Parameters
value (bytes) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: bytes) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (bytes) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: bytes, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (bytes) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: bytes) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (bytes) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTByteArrayListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: bytes) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (bytes) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → bytes¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
bytes
See also
removeAt()
.
- class NTByteArrayListIt(obj: Pro.Core.NTByteArrayList)¶
Iterator class for
NTByteArrayList
.
- Parameters
obj (NTByteArrayList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → bytes¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
bytes
See also
hasNext()
andprevious()
.
- previous() → bytes¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
bytes
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class NTContainer¶
This is a generic container used to encapsulate data such as files and memory.
Containers can be created through functions such as
createContainerFromFile()
andnewContainer()
.See also
createContainerFromFile()
,newContainer()
,NTContainerBuffer
andNTAddressSpace
.Attributes:
Type of data internally referenced by the container.
Type of data internally referenced by the container.
Type of data internally referenced by the container.
Type of data internally referenced by the container.
Type of data internally referenced by the container.
Type of data internally referenced by the container.
Type of data internally referenced by the container.
Type of data internally referenced by the container.
Type of data internally referenced by the container.
Type of data internally referenced by the container.
Type of data internally referenced by the container.
Type of data internally referenced by the container.
Type of data internally referenced by the container.
Type of data internally referenced by the container.
Type of data internally referenced by the container.
Methods:
addAddressSpace
(aspace)Adds an address space to the current container and returns a new container as the result.
align
(align_to)Aligns the container to the specified size.
append
(bytes)Appends data to the container.
appendTo
(dst_or_offset[, size, dst])Appends this container to another container.
clear
()Deferences the data currently being referenced by this container.
clone
()Returns a container holding a new reference to the internal data.
compare
(offset, bytes_or_size[, b])Compares the specified data to the one in the container.
copyTo
(offset, size, dst[, dst_offset])Copies a part of the current container to another container.
copyToEx
(wait, offset, size, dst[, dst_offset])Copies a part of the current container to another container.
Copies the data referenced by the current container to a new container.
copyToNewContainerEx
(wait[, offset, size])Copies the data referenced by the current container to a new container.
dataType
()Returns the internal data type referenced by the container.
Returns a file name if the container directly references a file on disk; otherwise returns an empty string.
equals
(s)Checks whether the current container references the same data as the specified container.
fill
(offset, b, size)Fills a portion of the container with the specified byte.
find
(cb, ud, pattern[, offset, size, down])Searches for a specified pattern.
findFirst
(pattern[, offset, size, down])Searches for the first occurrence of a specified pattern.
findMulti
(cb, ud, patterns[, offset, size])Searches for any pattern in a specified list.
findMultiFirst
(patterns[, offset, size])Searches for the first occurrence of any pattern in a specified list.
Returns the address space of the container if present; otherwise returns an invalid address space.
getRange
()Returns a tuple containing a boolean and two integers. If the boolean is
True
, then the container has a range and the two integers are the offset and the size of the range.Returns the internal container referenced by the current container if any; otherwise returns an invalid container.
Returns
True
if the current container has an address space; otherwise returnsFalse
.
hasRange
()Returns
True
if the current container has a range; otherwise returnsFalse
.Returns
True
if the current container has a reference container; otherwise returnsFalse
.
isChild
(s)Checks whether the specified container is a child of the current one.
isNull
()Returns
True
if the current container is invalid; otherwise returnsFalse
.Returns
True
if the current container is resizable; otherwise returnsFalse
.
isValid
()Returns
True
if the current container is valid; otherwise returnsFalse
.
isValidAddress
(address)Checks whether the specified address is valid in the context of the current container.
name
()Returns the internal name of the container. A container may have a name only if created from a named object like a file.
read
(offset, size)Reads data from the container.
readU16BE
(offset)Reads a big-endian 16-bit unsigned integer from the container.
readU16LE
(offset)Reads a little-endian 16-bit unsigned integer from the container.
readU32BE
(offset)Reads a big-endian 32-bit unsigned integer from the container.
readU32LE
(offset)Reads a little-endian 32-bit unsigned integer from the container.
readU64BE
(offset)Reads a big-endian 64-bit unsigned integer from the container.
readU64LE
(offset)Reads a little-endian 64-bit unsigned integer from the container.
readU8
(offset)Reads an 8-bit unsigned integer from the container.
Returns the reference container if any; otherwise returns
None
.Resets the range of the container.
resize
(new_size[, zero])Resizes the container.
save
(fname[, offset, size])Copies the container, or part of it, to a specified file.
setData
(data[, own_or_size])Sets the internal data referenced by the container.
setRange
(offset, size[, optimize_for_speed])Sets the internal range for the container.
setResizable
(b)Sets the resizable status of the container.
Sets the internally referenced container.
setTag
(t)Sets an internal tag name for debugging purposes.
shift
(size)Appends
size
bytes at the end of the container and sets them to zero.
size
()Returns the size of the container. This might be the size of the underlying data referenced by the container, the size specified by
setRange()
or the size returned by the address space of the container if present.Returns
True
if the data referenced by the container supports concurrent I/O operation; otherwise returnsFalse
.
tag
()Returns the tag name set for debugging purposes if present; otherwise returns an empty string.
Returns the internal byte-array list referenced by the container.
toBytes
()Returns the internal bytes referenced by the container if the
dataType()
isBytes
; otherwise returns and emptybytes
object.If the container references a process, this method applies an address space that makes the memory of the process appear contiguous.
toFile
()Returns the internal file referenced by the container if the
dataType()
isFile
; otherwise returnsNone
.Returns the internal process referenced by the container if the
dataType()
isProcess
; otherwise returnsNone
.
toString
()Returns the internal string referenced by the container if the
dataType()
isString
; otherwise returns an empty string.Returns the internal string list referenced by the container.
Returns the internal text tags referenced by the container.
validRange
(offset, size)Checks the validity of a range in the context of the container.
validRawRange
(offset, size)Checks the validity of a range in the context of the container ignoring the range set on the container through
setRange()
.
write
(offset, bytes_or_c)Write data to the container.
writeU16BE
(offset, n)Writes a big-endian 16-bit unsigned integer to the container.
writeU16LE
(offset, n)Writes a little-endian 16-bit unsigned integer to the container.
writeU32BE
(offset, n)Writes a big-endian 32-bit unsigned integer to the container.
writeU32LE
(offset, n)Writes a little-endian 32-bit unsigned integer to the container.
writeU64BE
(offset, n)Writes a big-endian 64-bit unsigned integer to the container.
writeU64LE
(offset, n)Writes a little-endian 64-bit unsigned integer to the container.
writeU8
(offset, n)Writes an 8-bit unsigned integer to the container.
- ByteArrayList: Final[int]¶
Type of data internally referenced by the container.
See also
dataType()
.
- Bytes: Final[int]¶
Type of data internally referenced by the container.
See also
dataType()
.
- BytesTree: Final[int]¶
Type of data internally referenced by the container.
See also
dataType()
.
- File: Final[int]¶
Type of data internally referenced by the container.
See also
dataType()
.
- Filled: Final[int]¶
Type of data internally referenced by the container.
See also
dataType()
.
- Filter: Final[int]¶
Type of data internally referenced by the container.
See also
dataType()
.
- Memory: Final[int]¶
Type of data internally referenced by the container.
See also
dataType()
.
- NoType: Final[int]¶
Type of data internally referenced by the container.
See also
dataType()
.
- Process: Final[int]¶
Type of data internally referenced by the container.
See also
dataType()
.
- Stream: Final[int]¶
Type of data internally referenced by the container.
See also
dataType()
.
- String: Final[int]¶
Type of data internally referenced by the container.
See also
dataType()
.
- StringList: Final[int]¶
Type of data internally referenced by the container.
See also
dataType()
.
- StringTree: Final[int]¶
Type of data internally referenced by the container.
See also
dataType()
.
- SubContainer: Final[int]¶
Type of data internally referenced by the container.
See also
dataType()
.
- TextTags: Final[int]¶
Type of data internally referenced by the container.
See also
dataType()
.
- addAddressSpace(aspace: Pro.Core.NTAddressSpace) → Pro.Core.NTContainer¶
Adds an address space to the current container and returns a new container as the result.
- Parameters
aspace (NTAddressSpace) – The address space.
- Returns
Returns the new container.
- Return type
See also
hasAddressSpace()
,getAddressSpace()
andgetSubContainer()
.
- align(align_to: int) → bool¶
Aligns the container to the specified size.
The container must be resizable for this method to succeed.
- Parameters
align_to (int) – The alignment.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
setResizable()
,isResizable()
,shift()
andappend()
.
- append(bytes: bytes) → bool¶
Appends data to the container.
The container must be resizable for this method to succeed.
- Parameters
bytes (bytes) – The data to append.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
setResizable()
,isResizable()
,shift()
andalign()
.
- appendTo(dst_or_offset: Union[Pro.Core.NTContainer, int], size: Optional[int] = None, dst: Optional[Pro.Core.NTContainer] = None) → bool¶
Appends this container to another container.
The other container must be resizable for this method to succeed.
- Parameters
dst_or_offset (Union[NTContainer, int]) – Either the destination container or the start offset of the current container.
size (Optional[int]) – The size of the data to append.
dst (Optional[NTContainer]) – The destination container.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
setResizable()
,copyTo()
andcopyToEx()
.
- clear() → None¶
Deferences the data currently being referenced by this container.
If no other container holds references to the data, the data is freed.
- clone() → Pro.Core.NTContainer¶
- Returns
Returns a container holding a new reference to the internal data.
- Return type
See also
copyToNewContainer()
.
- compare(offset: int, bytes_or_size: Union[bytes, int], b: Optional[int] = None) → bool¶
Compares the specified data to the one in the container.
- Parameters
offset (int) – The start offset for the comparison.
bytes_or_size (Union[bytes, int]) – Either the data to compare or the size to compare.
b (Optional[int]) – If the previous parameter is the size to compare, this parameter is the byte which to compare the data to.
- Returns
Returns
True
if the data matches; otherwise returnsFalse
.- Return type
bool
See also
read()
.
- copyTo(offset: int, size: int, dst: Pro.Core.NTContainer, dst_offset: int = 0) → bool¶
Copies a part of the current container to another container.
- Parameters
offset (int) – The offset of the data to copy.
size (int) – The size of the data to copy.
dst (NTContainer) – The destination container.
dst_offset (int) – The offset at which to write the data to in the destination container.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
copyToEx()
,appendTo()
andsave()
.
- copyToEx(wait: Pro.Core.NTIWait, offset: int, size: int, dst: Pro.Core.NTContainer, dst_offset: int = 0) → bool¶
Copies a part of the current container to another container.
- Parameters
wait (NTIWait) – The wait interface.
offset (int) – The offset of the data to copy.
size (int) – The size of the data to copy.
dst (NTContainer) – The destination container.
dst_offset (int) – The offset at which to write the data to in the destination container.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
copyTo()
,appendTo()
andsave()
.
- copyToNewContainer() → Pro.Core.NTContainer¶
Copies the data referenced by the current container to a new container.
This method performs a deep copy, unlike
clone()
which only creates a new reference.
- Returns
Returns the new container if successful; otherwise returns an invalid container.
- Return type
See also
clone()
andcopyToNewContainerEx()
.
- copyToNewContainerEx(wait: Pro.Core.NTIWait, offset: Optional[int] = None, size: Optional[int] = None) → Pro.Core.NTContainer¶
Copies the data referenced by the current container to a new container.
This method performs a deep copy, unlike
clone()
which only creates a new reference.
- Parameters
wait (NTIWait) – The wait interface.
offset (Optional[int]) – The offset of the data to copy.
size (Optional[int]) – The size of the data to copy.
- Returns
Returns the new container if successful; otherwise returns an invalid container.
- Return type
See also
clone()
andcopyToNewContainer()
.
- dataType() → int¶
- Returns
Returns the internal data type referenced by the container.
- Return type
int
See also
NoType
,Stream
,SubContainer
andFile
.
- diskFileName() → str¶
- Returns
Returns a file name if the container directly references a file on disk; otherwise returns an empty string.
- Return type
str
Available since Cerbero Suite 7.3 and Cerbero Engine 4.3.
See also
name()
.
- equals(s: Pro.Core.NTContainer) → bool¶
Checks whether the current container references the same data as the specified container.
- Parameters
s (NTContainer) – The other container.
- Returns
Returns
True
if container reference the same data; otherwise returnsFalse
.- Return type
bool
- fill(offset: int, b: int, size: int) → bool¶
Fills a portion of the container with the specified byte.
- Parameters
offset (int) – The offset of the range to fill.
b (int) – The 8-bit value used for the fill operation.
size (int) – The size of the range to fill.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
write()
.
- find(cb: object, ud: object, pattern: bytes, offset: int = 0, size: int = INVALID_STREAM_OFFSET, down: bool = True) → bool¶
Searches for a specified pattern.
Example:
from Pro.Core import * def findCallback(offset, pattern, ud): print(offset) return 0 c = NTContainer() c.setData(b"FooBarFooBarFooBar") c.find(findCallback, None, b"Bar")
- Parameters
cb (object) – The callback for each match. This callback must return a value equal or bigger than zero to continue the search. To stop the search it must return a negative value.
ud (object) – The user data passed to the callback.
pattern (bytes) – The pattern to search for.
offset (int) – The offset of the range to search.
size (int) – The size of the range to search.
down (bool) – The search direction. If
True
, the search is downwards; otherwise it’s upwards.- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
findFirst()
,findMulti()
andfindMultiFirst()
.
- findFirst(pattern: bytes, offset: int = 0, size: int = INVALID_STREAM_OFFSET, down: bool = True) → Pro.Core.KROffset¶
Searches for the first occurrence of a specified pattern.
Example:
from Pro.Core import * c = NTContainer() c.setData(b"FooBarFooBarFooBar") m = c.findFirst(b"Bar") if m.offset != INVALID_STREAM_OFFSET: print(m.offset)
- Parameters
pattern (bytes) – The pattern to search for.
offset (int) – The offset of the range to search.
size (int) – The size of the range to search.
down (bool) – The search direction. If
True
, the search is downwards; otherwise it’s upwards.- Returns
Returns the first match if any; otherwise
KROffset.offset
isINVALID_STREAM_OFFSET
.- Return type
See also
find()
,findMulti()
andfindMultiFirst()
.
- findMulti(cb: object, ud: object, patterns: Pro.Core.NTByteArrayList, offset: int = 0, size: int = INVALID_STREAM_OFFSET) → bool¶
Searches for any pattern in a specified list.
The patterns in the specified list must have the same length.
Example:
from Pro.Core import * def findCallback(offset, pattern, ud): # pattern is the index of the matched pattern into the passed list of patterns print("offset:", offset, "pattern:", pattern) return 0 c = NTContainer() c.setData(b"FooBarFooBarFooBar") patterns = NTByteArrayList() patterns.append(b"Foo") patterns.append(b"Bar") c.findMulti(findCallback, None, patterns)
- Parameters
cb (object) – The callback for each match. This callback must return a value equal or bigger than zero to continue the search. To stop the search it must return a negative value.
ud (object) – The user data passed to the callback.
patterns (NTByteArrayList) – The list of patterns to search for.
offset (int) – The offset of the range to search.
size (int) – The size of the range to search.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
find()
,findFirst()
andfindMultiFirst()
.
- findMultiFirst(patterns: Pro.Core.NTByteArrayList, offset: int = 0, size: int = INVALID_STREAM_OFFSET) → Pro.Core.KROffset¶
Searches for the first occurrence of any pattern in a specified list.
The patterns in the specified list must have the same length.
Example:
from Pro.Core import * c = NTContainer() c.setData(b"FooBarFooBarFooBar") patterns = NTByteArrayList() patterns.append(b"Foo") patterns.append(b"Bar") m = c.findMultiFirst(patterns) if m.offset != INVALID_STREAM_OFFSET: print(m.offset, m.pattern)
- Parameters
patterns (NTByteArrayList) – The list of patterns to search for.
offset (int) – The offset of the range to search.
size (int) – The size of the range to search.
- Returns
Returns the first match if any; otherwise
KROffset.offset
isINVALID_STREAM_OFFSET
.- Return type
See also
find()
,findFirst()
andfindMulti()
.
- getAddressSpace() → Pro.Core.NTAddressSpace¶
- Returns
Returns the address space of the container if present; otherwise returns an invalid address space.
- Return type
See also
addAddressSpace()
andhasAddressSpace()
.
- getRange() → tuple¶
- Returns
Returns a tuple containing a boolean and two integers. If the boolean is
True
, then the container has a range and the two integers are the offset and the size of the range.- Return type
tuple[bool, int, int]
See also
hasRange()
,setRange()
andresetRange()
.
- getSubContainer() → Pro.Core.NTContainer¶
- Returns
Returns the internal container referenced by the current container if any; otherwise returns an invalid container.
- Return type
See also
setSubContainer()
.
- hasAddressSpace() → bool¶
- Returns
Returns
True
if the current container has an address space; otherwise returnsFalse
.- Return type
bool
See also
getAddressSpace()
andaddAddressSpace()
.
- hasRange() → bool¶
- Returns
Returns
True
if the current container has a range; otherwise returnsFalse
.- Return type
bool
See also
getRange()
,setRange()
andresetRange()
.
- hasReferenceContainer() → bool¶
- Returns
Returns
True
if the current container has a reference container; otherwise returnsFalse
.- Return type
bool
See also
referenceContainer()
.
- isChild(s: Pro.Core.NTContainer) → bool¶
Checks whether the specified container is a child of the current one.
This means that the data referenced by both container must be the same and the child must have a range that is within the range of the parent.
- Parameters
s (NTContainer) – The child container.
- Returns
Returns
True
if the specified container is a child of the current one; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 7.7 and Cerbero Engine 4.7.
See also
equals()
.
- isNull() → bool¶
- Returns
Returns
True
if the current container is invalid; otherwise returnsFalse
.- Return type
bool
See also
isValid()
.
- isResizable() → bool¶
- Returns
Returns
True
if the current container is resizable; otherwise returnsFalse
.- Return type
bool
See also
setResizable()
.
- isValid() → bool¶
- Returns
Returns
True
if the current container is valid; otherwise returnsFalse
.- Return type
bool
See also
isNull()
.
- isValidAddress(address: int) → bool¶
Checks whether the specified address is valid in the context of the current container.
- Parameters
address (int) – The address to check.
- Returns
Returns
True
if the address is valid; otherwise returnsFalse
.- Return type
bool
See also
validRange()
andvalidRawRange()
.
- name() → str¶
- Returns
Returns the internal name of the container. A container may have a name only if created from a named object like a file.
- Return type
str
See also
diskFileName()
,dataType()
andsetData()
.
- read(offset: int, size: int) → bytes¶
Reads data from the container.
- Parameters
offset (int) – The offset of the data to read.
size (int) – The size of the data to read.
- Returns
Returns the requested data if successful; otherwise returns an empty
bytes
object.- Return type
bytes
See also
write()
.
- readU16BE(offset: int) → tuple¶
Reads a big-endian 16-bit unsigned integer from the container.
- Parameters
offset (int) – The offset of the value to read.
- Returns
Returns a tuple consisting of the value and a boolean which indicates the success of the operation.
- Return type
tuple[int, bool]
See also
readU16LE()
andwriteU16BE()
.
- readU16LE(offset: int) → tuple¶
Reads a little-endian 16-bit unsigned integer from the container.
- Parameters
offset (int) – The offset of the value to read.
- Returns
Returns a tuple consisting of the value and a boolean which indicates the success of the operation.
- Return type
tuple[int, bool]
See also
readU16BE()
andwriteU16LE()
.
- readU32BE(offset: int) → tuple¶
Reads a big-endian 32-bit unsigned integer from the container.
- Parameters
offset (int) – The offset of the value to read.
- Returns
Returns a tuple consisting of the value and a boolean which indicates the success of the operation.
- Return type
tuple[int, bool]
See also
readU32LE()
andwriteU32BE()
.
- readU32LE(offset: int) → tuple¶
Reads a little-endian 32-bit unsigned integer from the container.
- Parameters
offset (int) – The offset of the value to read.
- Returns
Returns a tuple consisting of the value and a boolean which indicates the success of the operation.
- Return type
tuple[int, bool]
See also
readU32BE()
andwriteU32LE()
.
- readU64BE(offset: int) → tuple¶
Reads a big-endian 64-bit unsigned integer from the container.
- Parameters
offset (int) – The offset of the value to read.
- Returns
Returns a tuple consisting of the value and a boolean which indicates the success of the operation.
- Return type
tuple[int, bool]
See also
readU64LE()
andwriteU64BE()
.
- readU64LE(offset: int) → tuple¶
Reads a little-endian 64-bit unsigned integer from the container.
- Parameters
offset (int) – The offset of the value to read.
- Returns
Returns a tuple consisting of the value and a boolean which indicates the success of the operation.
- Return type
tuple[int, bool]
See also
readU64BE()
andwriteU64LE()
.
- readU8(offset: int) → tuple¶
Reads an 8-bit unsigned integer from the container.
- Parameters
offset (int) – The offset of the value to read.
- Returns
Returns a tuple consisting of the value and a boolean which indicates the success of the operation.
- Return type
tuple[int, bool]
See also
read()
.
- referenceContainer() → Pro.Core.NTContainer¶
- Returns
Returns the reference container if any; otherwise returns
None
.- Return type
See also
hasReferenceContainer()
.
- resetRange() → None¶
Resets the range of the container.
See also
hasRange()
,getRange()
andsetRange()
.
- resize(new_size: int, zero: bool = True) → bool¶
Resizes the container.
The container must be resizable for this method to succeed.
- Parameters
new_size (int) – The new size of the container.
zero (bool) – If
True
, makes sure that additionally allocated size is initialized to zero.- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
- save(fname: str, offset: int = 0, size: int = INVALID_STREAM_OFFSET) → bool¶
Copies the container, or part of it, to a specified file.
- Parameters
fname (str) – The file name.
offset (int) – The offset of the range to save.
size (int) – The size of the range to save.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
appendTo()
,copyTo()
andcopyToNewContainer()
.
- setData(data: Union[NTByteArrayList, NTContainer, NTStringList, NTTextTags, NT_FILE, NT_PROCESS, bytes, int, str], own_or_size: Union[bool, int] = True) → None¶
Sets the internal data referenced by the container.
- Parameters
data (Union[NTByteArrayList, NTContainer, NTStringList, NT_FILE, NT_PROCESS, bytes, int, str]) – The data to set.
own_or_size (Union[bool, int]) – If the data set is an
NT_FILE
, then theown
parameter ifTrue
ensures that the file handle is automatically closed when the internal reference counter of the container reaches zero. If the data set is an 8-bit integer, then thesize
parameter determines how many times the 8-bit integer will be repeated.See also
dataType()
.
- setRange(offset: int, size: int, optimize_for_speed: bool = True) → None¶
Sets the internal range for the container.
Example:
from Pro.Core import * c = NTContainer() c.setData(b"Hello, world!") # increase the reference count of c c2 = c.clone() # set a new range for c2 c2.setRange(7, 5) # prints out "Hello, world!" print(c.read(0, c.size()).decode("utf-8")) # prints out "world" print(c2.read(0, c2.size()).decode("utf-8"))This is usually an inexpensive operation, unless the container has an address space and
optimize_for_speed
isTrue
. In that case, the memory might be copied to allow faster I/O operations on it.
- Parameters
offset (int) – The offset of the range.
size (int) – The size of the range.
optimize_for_speed (bool) – If
True
, might cause a deep copy under certain circumstances.See also
hasRange()
,getRange()
andresetRange()
.
- setResizable(b: bool) → None¶
Sets the resizable status of the container.
By default containers are not resizable.
- Parameters
b (bool) – If
True
, the container becomes resizable.See also
isResizable()
.
- setSubContainer(c: Pro.Core.NTContainer) → None¶
Sets the internally referenced container.
- Parameters
c (NTContainer) – The sub-container to set.
See also
getSubContainer()
.
- setTag(t: str) → None¶
Sets an internal tag name for debugging purposes.
- Parameters
t (str) – The tag name.
See also
tag()
.
- shift(size: int) → bool¶
Appends
size
bytes at the end of the container and sets them to zero.The container must be resizable for this method to succeed.
- Parameters
size (int) – The amount of bytes to append.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
- size() → int¶
- Returns
Returns the size of the container. This might be the size of the underlying data referenced by the container, the size specified by
setRange()
or the size returned by the address space of the container if present.- Return type
int
See also
getRange()
andaddAddressSpace()
.
- supportsConcurrency() → bool¶
- Returns
Returns
True
if the data referenced by the container supports concurrent I/O operation; otherwise returnsFalse
.- Return type
bool
See also
setData()
.
- tag() → str¶
- Returns
Returns the tag name set for debugging purposes if present; otherwise returns an empty string.
- Return type
str
See also
setTag()
.
- toByteArrayList() → Pro.Core.NTByteArrayList¶
- Returns
Returns the internal byte-array list referenced by the container.
- Return type
See also
dataType()
.
- toBytes() → bytes¶
- Returns
Returns the internal bytes referenced by the container if the
dataType()
isBytes
; otherwise returns and emptybytes
object.- Return type
bytes
See also
dataType()
.
- toContiguousProcess() → Pro.Core.NTContainer¶
If the container references a process, this method applies an address space that makes the memory of the process appear contiguous.
- Returns
Returns the contiguous memory of the process.
- Return type
See also
setData()
.
- toFile() → NT_FILE¶
- Returns
Returns the internal file referenced by the container if the
dataType()
isFile
; otherwise returnsNone
.- Return type
NT_FILE
Available since Cerbero Suite 7.4 and Cerbero Engine 4.4.
See also
dataType()
.
- toProcess() → NT_PROCESS¶
- Returns
Returns the internal process referenced by the container if the
dataType()
isProcess
; otherwise returnsNone
.- Return type
NT_PROCESS
Available since Cerbero Suite 7.4 and Cerbero Engine 4.4.
See also
dataType()
.
- toString() → str¶
- Returns
Returns the internal string referenced by the container if the
dataType()
isString
; otherwise returns an empty string.- Return type
str
See also
dataType()
.
- toStringList() → Pro.Core.NTStringList¶
- Returns
Returns the internal string list referenced by the container.
- Return type
See also
dataType()
.
- toTextTags() → Pro.Core.NTTextTags¶
- Returns
Returns the internal text tags referenced by the container.
- Return type
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
See also
dataType()
.
- validRange(offset: int, size: int) → bool¶
Checks the validity of a range in the context of the container.
- Parameters
offset (int) – The offset of the range to check.
size (int) – The size of the range to check.
- Returns
Returns
True
if the range is valid; otherwise returnsFalse
.- Return type
bool
See also
validRawRange()
andisValidAddress()
.
- validRawRange(offset: int, size: int) → bool¶
Checks the validity of a range in the context of the container ignoring the range set on the container through
setRange()
.
- Parameters
offset (int) – The offset of the range to check.
size (int) – The size of the range to check.
- Returns
Returns
True
if the range is valid; otherwise returnsFalse
.- Return type
bool
See also
validRange()
andisValidAddress()
.
- write(offset: int, bytes_or_c: Union[Pro.Core.NTContainer, bytes]) → bool¶
Write data to the container.
- Parameters
offset (int) – The offset at which to write the data.
bytes_or_c (Union[NTContainer, bytes]) – The data to write. Can be a
bytes
object or a container.- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
read()
.
- writeU16BE(offset: int, n: int) → bool¶
Writes a big-endian 16-bit unsigned integer to the container.
- Parameters
offset (int) – The offset at which to write the value.
n (int) – The value to write.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
writeU16LE()
andreadU16BE()
.
- writeU16LE(offset: int, n: int) → bool¶
Writes a little-endian 16-bit unsigned integer to the container.
- Parameters
offset (int) – The offset at which to write the value.
n (int) – The value to write.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
writeU16BE()
andreadU16LE()
.
- writeU32BE(offset: int, n: int) → bool¶
Writes a big-endian 32-bit unsigned integer to the container.
- Parameters
offset (int) – The offset at which to write the value.
n (int) – The value to write.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
writeU32LE()
andreadU32BE()
.
- writeU32LE(offset: int, n: int) → bool¶
Writes a little-endian 32-bit unsigned integer to the container.
- Parameters
offset (int) – The offset at which to write the value.
n (int) – The value to write.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
writeU32BE()
andreadU32LE()
.
- writeU64BE(offset: int, n: int) → bool¶
Writes a big-endian 64-bit unsigned integer to the container.
- Parameters
offset (int) – The offset at which to write the value.
n (int) – The value to write.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
writeU64LE()
andreadU64BE()
.
- writeU64LE(offset: int, n: int) → bool¶
Writes a little-endian 64-bit unsigned integer to the container.
- Parameters
offset (int) – The offset at which to write the value.
n (int) – The value to write.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
writeU64BE()
andreadU64LE()
.
- class NTContainerBuffer(container: Pro.Core.NTContainer, endianness: int, offset: int, method: int = Bufferize_Forwards)¶
Bases:
Pro.Core.NTBuffer
This class provides buffered read capability for
NTContainer
.
- Parameters
container (NTContainer) – The object to read from.
endianness (int) – The default endianness for the buffer (
ENDIANNESS_LITTLE
orENDIANNESS_BIG
).offset (int) – The start offset to read from.
method (int) – The buffering method to use. Defaults to
Bufferize_Forwards
.
- class NTDate(y: Optional[int] = None, m: Optional[int] = None, d: Optional[int] = None)¶
This class provides date functions.
Optionally initializes a date from the input parameters.
- Parameters
y (Optional[int]) – The year.
m (Optional[int]) – The month.
d (Optional[int]) – The day.
See also
NTTime
andNTDateTime
.Methods:
addDays
(ndays)Returns an
NTDate
object containing a datendays
later than the date of this object (or earlier ifndays
is negative).
addMonths
(nmonths)Returns an
NTDate
object containing a datenmonths
later than the date of this object (or earlier ifnmonths
is negative).
addYears
(nyears)Returns an
NTDate
object containing a datenyears
later than the date of this object (or earlier ifnyears
is negative).Returns the current date, as reported by the system clock.
day
()Returns the day of the month for this date.
Returns the weekday (
1
=NTMonday
to7
=NTSunday
) for this date.Returns the day of the year (
1
for the first day) for this date.Returns the number of days in the month for this date.
Returns the number of days in the year for this date.
daysTo
(d)Returns the number of days from this date to
d
(which is negative ifd
is earlier than this date).
fromJulianDay
(jd)Converts the Julian day
jd
to anNTDate
object.
fromString
(string[, format])Converts a string to an
NTDate
object.
isLeapYear
(year)Checks if the specified year is a leap year in the Gregorian calendar.
isNull
()Returns
True
if the date is null; otherwise returnsFalse
.
isValid
()Checks the validity of the current date.
month
()Returns the month-number for the date (
1
= January) if the date is valid; otherwise returns 0.
setDate
(year, month, day)Sets this to represent the date, in the Gregorian calendar, with the given
year
,month
andday
numbers.Converts the date to a Julian day.
toString
([format])Returns the date as a string.
Returns the ISO 8601 week number (1 to 53).
year
()Returns the year of this date if the date is valid; otherwise returns 0.
- addDays(ndays: int) → Pro.Core.NTDate¶
Returns an
NTDate
object containing a datendays
later than the date of this object (or earlier ifndays
is negative).Returns a null date if the current date is invalid or the new date is out of range.
- Parameters
ndays (int) – The days to add.
- Returns
Returns a valid date if successful; otherwise returns a null date.
- Return type
See also
addMonths()
,addYears()
anddaysTo()
.
- addMonths(nmonths: int) → Pro.Core.NTDate¶
Returns an
NTDate
object containing a datenmonths
later than the date of this object (or earlier ifnmonths
is negative).Note
If the ending day/month combination does not exist in the resulting month/year, this function will return a date that is the latest valid date in the selected month.
- Parameters
nmonths (int) – The months to add.
- Returns
Returns a valid date if successful; otherwise returns a null date.
- Return type
See also
addDays()
andaddYears()
.
- addYears(nyears: int) → Pro.Core.NTDate¶
Returns an
NTDate
object containing a datenyears
later than the date of this object (or earlier ifnyears
is negative).Note
If the ending day/month combination does not exist in the resulting year (e.g., for the Gregorian calendar, if the date was Feb 29 and the final year is not a leap year), this function will return a date that is the latest valid date in the given month (in the example, Feb 28).
- Parameters
nyears (int) – The years to add.
- Returns
Returns a valid date if successful; otherwise returns a null date.
- Return type
See also
addMonths()
andaddYears()
.
- static currentDate() → Pro.Core.NTDate¶
- Returns
Returns the current date, as reported by the system clock.
- Return type
See also
NTTime.currentTime()
andNTDateTime.currentDateTime()
.
- day() → int¶
- Returns
Returns the day of the month for this date.
- Return type
int
See also
year()
,month()
anddayOfWeek()
.
- dayOfWeek() → int¶
See also
day()
anddayOfYear()
.
- dayOfYear() → int¶
- Returns
Returns the day of the year (
1
for the first day) for this date.- Return type
int
See also
day()
anddayOfWeek()
.
- daysInMonth() → int¶
- Returns
Returns the number of days in the month for this date.
- Return type
int
See also
day()
anddaysInYear()
.
- daysInYear() → int¶
- Returns
Returns the number of days in the year for this date.
- Return type
int
See also
day()
anddaysInMonth()
.
- daysTo(d: Pro.Core.NTDate) → int¶
Returns the number of days from this date to
d
(which is negative ifd
is earlier than this date).
- Parameters
d (NTDate) – The date for which to compute the difference in days.
- Returns
Returns the number of days or 0 if either date is invalid.
- Return type
int
See also
addDays()
.
- static fromJulianDay(jd: int) → Pro.Core.NTDate¶
Converts the Julian day
jd
to anNTDate
object.
- Parameters
jd (int) – The Julian day.
- Returns
Returns the date object.
- Return type
See also
toJulianDay()
.
- static fromString(string: str, format: Union[NTDateFormat, str] = NTTextDate) → NTDate¶
Converts a string to an
NTDate
object.
- Parameters
string (str) – The string to convert.
format (Union[NTDateFormat, str]) – The format of the string.
- Returns
Returns the converted date if successful; otherwise returns an invalid date.
- Return type
See also
toString()
,NTDate.fromString()
andNTDateTime.fromString()
.
- static isLeapYear(year: int) → bool¶
Checks if the specified year is a leap year in the Gregorian calendar.
- Parameters
year (int) – The year to check.
- Returns
Returns
True
if the specified year is a leap year in the Gregorian calendar; otherwise returnsFalse
.- Return type
bool
- isNull() → bool¶
- Returns
Returns
True
if the date is null; otherwise returnsFalse
.- Return type
bool
See also
isValid()
.
- isValid() → bool¶
Checks the validity of the current date.
- Returns
Returns
True
if the date is valid; otherwise returnsFalse
.- Return type
bool
See also
isNull()
.
- month() → int¶
- Returns
Returns the month-number for the date (
1
= January) if the date is valid; otherwise returns 0.- Return type
int
- setDate(year: int, month: int, day: int) → bool¶
Sets this to represent the date, in the Gregorian calendar, with the given
year
,month
andday
numbers.
- Parameters
year (int) – The year.
month (int) – The month.
day (int) – The day.
- Returns
Returns
True
if the resulting date is valid; otherwise returnsFalse
.- Return type
bool
See also
isValid()
.
- toJulianDay() → int¶
Converts the date to a Julian day.
- Returns
Returns the Julian day.
- Return type
int
See also
fromJulianDay()
.
- toString(format: Union[NTDateFormat, str] = NTTextDate) → str¶
Returns the date as a string. The format
parameter
determines the format of the string.
- Parameters
format (Union[NTDateFormat, str]) – Optionally specify the format of the string.
- Returns
Returns the date string if successful; otherwise returns an empty string.
- Return type
str
See also
fromString()
.
- class NTDateTime(date: Optional[NTDate] = None, time: Optional[NTTime] = None, spec: NTTimeSpec = NTLocalTime)¶
This class provides date and time functions.
Optionally constructs the
NTDateTime
from anNTTime
and anNTDate
.
- Parameters
date (Optional[NTDate]) – The date object.
time (Optional[NTTime]) – The time object.
spec (NTTimeSpec) – Time specification. The default is
NTLocalTime
.Methods:
addDays
(ndays)Returns an
NTDateTime
object containing a datetimendays
days later than the datetime of this object (or earlier ifndays
is negative).
addMSecs
(msecs)Returns an
NTDateTime
object containing a datetimemsecs
milliseconds later than the datetime of this object (or earlier ifmsecs
is negative).
addMonths
(nmonths)Returns an
NTDateTime
object containing a datetimenmonths
months later than the datetime of this object (or earlier ifnmonths
is negative).
addSecs
(s)Returns an
NTDateTime
object containing a datetimes
seconds later than the datetime of this object (or earlier ifs
is negative).
addYears
(nyears)Returns an
NTDateTime
object containing a datetimenyears
years later than the datetime of this object (or earlier ifnyears
is negative).Returns the current datetime, as reported by the system clock, in the local time zone.
Returns the current datetime, as reported by the system clock, in UTC.
Returns the number of milliseconds since 1970-01-01T00:00:00 Universal Coordinated Time. This number is like the POSIX time_t variable, but expressed in milliseconds instead.
date
()Returns the date part of the datetime.
daysTo
(other)Returns the number of days from this datetime to the
other
datetime.
fromMSecsSinceEpoch
(msecs[, spec, offsetSeconds])Returns a datetime whose date and time are the number of milliseconds,
msecs
, that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (NTUTC
), and converted toNTLocalTime
.
fromString
(string[, format])Returns the datetime represented by
string
using theformat
format.
fromTime_t
(seconds[, spec, offsetSeconds])Returns a datetime whose date and time are the number of
seconds
that have passed since 1970-01-01T00:00:00, Coordinated Universal Time (NTUTC
).Returns
True
if this datetime falls in Daylight-Saving Time; otherwise returnsFalse
.
isNull
()Returns
True
if both the date and the time are null; otherwise returnsFalse
.
isValid
()Returns
True
if both the date and the time are valid and they are valid in the currentNTTimeSpec
; otherwise returnsFalse
.
msecsTo
(other)Returns the number of milliseconds from this datetime to the
other
datetime.Returns this datetime’s Offset From UTC in seconds.
secsTo
(other)Returns the number of seconds from this datetime to the
other
datetime.
setDate
(date)Sets the date part of this datetime to
date
.
setMSecsSinceEpoch
(msecs)Sets the date and time given the number of milliseconds
msecs
that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (NTUTC
).
setOffsetFromUtc
(offsetSeconds)Sets the
timeSpec()
toNTOffsetFromUTC
and the offset tooffsetSeconds
.
setTime
(time)Sets the time part of this datetime to
time
.
setTimeSpec
(spec)Sets the time specification used in this datetime to
spec
.
setTime_t
(seconds)Sets the date and time given the number of seconds that have passed since 1970-01-01T00:00:00, Coordinated Universal Time (
NTUTC
).
swap
(other)Swaps this datetime with
other
.
time
()Returns the time part of the datetime.
timeSpec
()Returns the time specification of the datetime.
Returns the Time Zone Abbreviation for the datetime.
Returns a datetime containing the date and time information in this datetime, but specified using the
NTLocalTime
definition.Returns the datetime as the number of milliseconds that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (
NTUTC
).
toOffsetFromUtc
(offsetSeconds)Returns a copy of this datetime converted to a specification of
NTOffsetFromUTC
with the givenoffsetSeconds
.
toString
([format])Returns the datetime as a string in the given
format
.
toTimeSpec
(spec)Returns a copy of this datetime converted to the given time
spec
.
toTime_t
()Returns the datetime as the number of seconds that have passed since 1970-01-01T00:00:00, Coordinated Universal Time (
NTUTC
).
toUTC
()Returns a datetime containing the date and time information in this datetime, but specified using the
NTUTC
definition.
- addDays(ndays: int) → Pro.Core.NTDateTime¶
Returns an
NTDateTime
object containing a datetimendays
days later than the datetime of this object (or earlier ifndays
is negative).Note
If the
timeSpec()
isNTLocalTime
and the resulting date and time fall in the Standard Time to Daylight-Saving Time transition hour then the result will be adjusted accordingly, i.e. if the transition is at 2am and the clock goes forward to 3am and the result falls between 2am and 3am then the result will be adjusted to fall after 3am.
- Parameters
ndays (int) – The days to add.
- Returns
Returns a valid datetime if successful; otherwise returns a null datetime.
- Return type
See also
daysTo()
,addMonths()
,addYears()
andaddSecs()
.
- addMSecs(msecs: int) → Pro.Core.NTDateTime¶
Returns an
NTDateTime
object containing a datetimemsecs
milliseconds later than the datetime of this object (or earlier ifmsecs
is negative).
- Parameters
msecs (int) – The milliseconds to add.
- Returns
Returns a valid datetime if successful; otherwise returns a null datetime.
- Return type
See also
msecsTo()
,addSecs()
,addDays()
,addMonths()
andaddYears()
.
- addMonths(nmonths: int) → Pro.Core.NTDateTime¶
Returns an
NTDateTime
object containing a datetimenmonths
months later than the datetime of this object (or earlier ifnmonths
is negative).Note
If the
timeSpec()
isNTLocalTime
and the resulting date and time fall in the Standard Time to Daylight-Saving Time transition hour then the result will be adjusted accordingly, i.e. if the transition is at 2am and the clock goes forward to 3am and the result falls between 2am and 3am then the result will be adjusted to fall after 3am.
- Parameters
nmonths (int) – The months to add.
- Returns
Returns a valid datetime if successful; otherwise returns a null datetime.
- Return type
See also
daysTo()
,addDays()
,addYears()
andaddSecs()
.
- addSecs(s: int) → Pro.Core.NTDateTime¶
Returns an
NTDateTime
object containing a datetimes
seconds later than the datetime of this object (or earlier ifs
is negative).
- Parameters
s (int) – The seconds to add.
- Returns
Returns a valid datetime if successful; otherwise returns a null datetime.
- Return type
See also
addMSecs()
,secsTo()
,addDays()
,addMonths()
andaddYears()
.
- addYears(nyears: int) → Pro.Core.NTDateTime¶
Returns an
NTDateTime
object containing a datetimenyears
years later than the datetime of this object (or earlier ifnyears
is negative).
- Parameters
nyears (int) – The years to add.
- Returns
Returns a valid datetime if successful; otherwise returns a null datetime.
- Return type
See also
daysTo()
,addDays()
,addMonths()
andaddSecs()
.
- static currentDateTime() → Pro.Core.NTDateTime¶
- Returns
Returns the current datetime, as reported by the system clock, in the local time zone.
- Return type
See also
currentDateTimeUtc()
,NTTime.currentTime()
,NTDate.currentDate()
andtoTimeSpec()
.
- static currentDateTimeUtc() → Pro.Core.NTDateTime¶
- Returns
Returns the current datetime, as reported by the system clock, in UTC.
- Return type
See also
currentDateTime()
,NTTime.currentTime()
,NTDate.currentDate()
andtoTimeSpec()
.
- static currentMSecsSinceEpoch() → int¶
- Returns
Returns the number of milliseconds since 1970-01-01T00:00:00 Universal Coordinated Time. This number is like the POSIX time_t variable, but expressed in milliseconds instead.
- Return type
int
See also
currentDateTime()
,currentDateTimeUtc()
,toTime_t()
andtoTimeSpec()
.
- date() → Pro.Core.NTDate¶
- Returns
Returns the date part of the datetime.
- Return type
See also
setDate()
,time()
andtimeSpec()
.
- daysTo(other: Pro.Core.NTDateTime) → int¶
Returns the number of days from this datetime to the
other
datetime.The number of days is counted as the number of times midnight is reached between this datetime to the
other
datetime. This means that a 10 minute difference from 23:55 to 0:05 the next day counts as one day.If the
other
datetime is earlier than this datetime, the value returned is negative.
- Parameters
other (NTDateTime) – The datetime for which to compute the difference in days.
- Returns
Returns the computed difference in days or
0
if either datetime is invalid.- Return type
int
- static fromMSecsSinceEpoch(msecs: int, spec: Optional[NTTimeSpec] = None, offsetSeconds: int = 0) → NTDateTime¶
Returns a datetime whose date and time are the number of milliseconds,
msecs
, that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (NTUTC
), and converted toNTLocalTime
. On systems that do not support time zones, the time will be set as if local time wereNTUTC
.
- Parameters
msecs (int) – The milliseconds to convert.
spec (Optional[NTTimeSpec]) – The time specification.
offsetSeconds (int) – If this value is not
NTOffsetFromUTC
thenoffsetSeconds
will be ignored. If this value isNTOffsetFromUTC
andoffsetSeconds
is0
then this value will be set toNTUTC
, i.e. an offset of 0 seconds.- Returns
Returns the computed datetime if successful; otherwise returns an invalid datetime.
- Return type
See also
toMSecsSinceEpoch()
andsetMSecsSinceEpoch()
.
- static fromString(string: str, format: Union[NTDateFormat, str] = NTTextDate) → NTDateTime¶
Returns the datetime represented by
string
using theformat
format.
- Parameters
string (str) – The datetime string.
format (Union[NTDateFormat, str]) – The format.
- Returns
Returns the converted datetime if successful; otherwise returns an invalid datetime.
- Return type
See also
toString()
.
- static fromTime_t(seconds: int, spec: Optional[NTTimeSpec] = None, offsetSeconds: int = 0) → NTDateTime¶
Returns a datetime whose date and time are the number of
seconds
that have passed since 1970-01-01T00:00:00, Coordinated Universal Time (NTUTC
). On systems that do not support time zones, the time will be set as if local time wereNTUTC
.
- Parameters
seconds (int) – The seconds to convert.
spec (Optional[NTTimeSpec]) – The time specification.
offsetSeconds (int) – If this value is not
NTOffsetFromUTC
thenoffsetSeconds
will be ignored. If this value isNTOffsetFromUTC
andoffsetSeconds
is0
then this value will be set toNTUTC
, i.e. an offset of 0 seconds.- Returns
Returns the converted datetime if successful; otherwise returns an invalid datetime.
- Return type
See also
toTime_t()
andsetTime_t()
.
- isDaylightTime() → bool¶
- Returns
Returns
True
if this datetime falls in Daylight-Saving Time; otherwise returnsFalse
.- Return type
bool
See also
timeSpec()
.
- isNull() → bool¶
- Returns
Returns
True
if both the date and the time are null; otherwise returnsFalse
.- Return type
bool
See also
isValid()
,NTTime.isNull()
andNTDate.isNull()
.
- isValid() → bool¶
- Returns
Returns
True
if both the date and the time are valid and they are valid in the currentNTTimeSpec
; otherwise returnsFalse
.- Return type
bool
See also
isNull()
,NTTime.isValid()
andNTDate.isValid()
.
- msecsTo(other: Pro.Core.NTDateTime) → int¶
Returns the number of milliseconds from this datetime to the
other
datetime. If theother
datetime is earlier than this datetime, the value returned is negative.Before performing the comparison, the two datetimes are converted to NTUTC to ensure that the result is correct if daylight-saving (DST) applies to one of the two datetimes but not the other.
- Parameters
other (NTDateTime) – The datetime for which to compute the difference in milliseconds.
- Returns
Returns the computed difference in milliseconds or
0
if either datetime is invalid.- Return type
int
See also
addMSecs()
,daysTo()
andNTTime.msecsTo()
.
- offsetFromUtc() → int¶
Returns this datetime’s Offset From UTC in seconds.
The result depends on
timeSpec()
:
NTUTC
- The offset is 0.
NTOffsetFromUTC
- The offset is the value originally set.
NTLocalTime
- The local time’s offset from UTC is returned.
NTTimeZone
- The offset used by the time-zone is returned.For the last two, the offset at this date and time will be returned, taking account of Daylight-Saving Offset unless the date precedes the start of 1970. The offset is the difference between the local time or time in the given time-zone and UTC time; it is positive in time-zones ahead of UTC (East of The Prime Meridian), negative for those behind UTC (West of The Prime Meridian).
- Returns
Returns the offset from UTC in seconds.
- Return type
int
See also
setOffsetFromUtc()
.
- secsTo(other: Pro.Core.NTDateTime) → int¶
Returns the number of seconds from this datetime to the
other
datetime. If theother
datetime is earlier than this datetime, the value returned is negative.Before performing the comparison, the two datetimes are converted to
NTUTC
to ensure that the result is correct if daylight-saving (DST) applies to one of the two datetimes but not the other.
- Parameters
other (NTDateTime) – The datetime for which to compute the difference in seconds.
- Returns
Returns the computed difference in seconds or
0
if either datetime is invalid.- Return type
int
See also
addSecs()
,daysTo()
andNTTime.secsTo()
.
- setDate(date: Pro.Core.NTDate) → None¶
Sets the date part of this datetime to
date
. If no time is set yet, it is set to midnight. Ifdate
is invalid, this datetime becomes invalid.
- Parameters
date (NTDate) – The date to set.
See also
date()
,setTime()
andsetTimeSpec()
.
- setMSecsSinceEpoch(msecs: int) → None¶
Sets the date and time given the number of milliseconds
msecs
that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (NTUTC
). On systems that do not support time zones this function will behave as if local time wereNTUTC
.
- Parameters
msecs (int) – The milliseconds to set.
See also
toMSecsSinceEpoch()
andfromMSecsSinceEpoch()
.
- setOffsetFromUtc(offsetSeconds: int) → None¶
Sets the
timeSpec()
toNTOffsetFromUTC
and the offset tooffsetSeconds
. The datetime will refer to a different point in time.The maximum and minimum offset is 14 positive or negative hours. If
offsetSeconds
is larger or smaller than that, then the result is undefined.If
offsetSeconds
is0
then thetimeSpec()
will be set toNTUTC
.
- Parameters
offsetSeconds (int) – The offset in seconds from UTC.
See also
isValid()
andoffsetFromUtc()
.
- setTime(time: Pro.Core.NTTime) → None¶
Sets the time part of this datetime to
time
. Iftime
is not valid, this function sets it to midnight.
- Parameters
time (NTTime) – The time to set.
See also
time()
,setDate()
andsetTimeSpec()
.
- setTimeSpec(spec: NTTimeSpec) → None¶
Sets the time specification used in this datetime to
spec
. The datetime will refer to a different point in time.If
spec
isNTOffsetFromUTC
then thetimeSpec()
will be set toNTUTC
, i.e. an effective offset of0
.If
spec
isNTTimeZone
then thespec
will be set toNTLocalTime
, i.e. the current system time zone.
- Parameters
spec (NTTimeSpec) – The time specification to set.
See also
timeSpec()
,setDate()
andsetTime()
.
- setTime_t(seconds: int) → None¶
Sets the date and time given the number of seconds that have passed since 1970-01-01T00:00:00, Coordinated Universal Time (
NTUTC
). On systems that do not support time zones this function will behave as if local time wereNTUTC
.
- Parameters
seconds (int) – The seconds to convert.
See also
toTime_t()
.
- swap(other: Pro.Core.NTDateTime) → None¶
Swaps this datetime with
other
.
- Parameters
other (NTDateTime) – The datetime to swap with.
- time() → Pro.Core.NTTime¶
- Returns
Returns the time part of the datetime.
- Return type
See also
setTime()
,date()
andtimeSpec()
.
- timeSpec() → NTTimeSpec¶
- Returns
Returns the time specification of the datetime.
- Return type
NTTimeSpec
See also
setTimeSpec()
,date()
andtime()
.
- timeZoneAbbreviation() → str¶
- Returns
Returns the Time Zone Abbreviation for the datetime.
- Return type
str
See also
timeSpec()
.
- toLocalTime() → Pro.Core.NTDateTime¶
- Returns
Returns a datetime containing the date and time information in this datetime, but specified using the
NTLocalTime
definition.- Return type
See also
toTimeSpec()
.
- toMSecsSinceEpoch() → int¶
Returns the datetime as the number of milliseconds that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (
NTUTC
).On systems that do not support time zones, this function will behave as if local time were
NTUTC
.
- Returns
Returns the number of milliseconds.
- Return type
int
See also
fromMSecsSinceEpoch()
andsetMSecsSinceEpoch()
.
- toOffsetFromUtc(offsetSeconds: int) → Pro.Core.NTDateTime¶
Returns a copy of this datetime converted to a specification of
NTOffsetFromUTC
with the givenoffsetSeconds
.If the
offsetSeconds
equals 0 then a UTC datetime will be returned
- Parameters
offsetSeconds (int) – The offset from UTC in seconds.
- Returns
Returns the computed datetime.
- Return type
See also
setOffsetFromUtc()
,offsetFromUtc()
andtoTimeSpec()
.
- toString(format: Union[NTDateFormat, str] = NTTextDate) → str¶
Returns the datetime as a string in the given
format
.
- Parameters
format (Union[NTDateFormat, str]) – The format of the string.
- Returns
Returns the datetime as a string if it could be converted; otherwise returns an empty string.
- Return type
str
See also
fromString()
,NTTime.toString()
andNTDate.toString()
.
- toTimeSpec(spec: NTTimeSpec) → NTDateTime¶
Returns a copy of this datetime converted to the given time
spec
.If
spec
isNTOffsetFromUTC
then it is set toNTUTC
. To set to aspec
ofNTOffsetFromUTC
usetoOffsetFromUtc()
.If
spec
isNTTimeZone
then it is set toNTLocalTime
, i.e. the local Time Zone.
- Parameters
spec (NTTimeSpec) – The time specification.
- Returns
Returns the converted datetime.
- Return type
See also
timeSpec()
andtoOffsetFromUtc()
.
- toTime_t() → int¶
- Returns
Returns the datetime as the number of seconds that have passed since 1970-01-01T00:00:00, Coordinated Universal Time (
NTUTC
).- Return type
int
See also
fromTime_t()
andsetTime_t()
.
- toUTC() → Pro.Core.NTDateTime¶
- Returns
Returns a datetime containing the date and time information in this datetime, but specified using the
NTUTC
definition.- Return type
See also
toTimeSpec()
.
- NTDefaultLocaleLongDate: Final[int]¶
The long date format used by the application’s locale.
See also
NTTime
,NTDate
andNTDateTime
.
- NTDefaultLocaleShortDate: Final[int]¶
The short date format specified by the application’s locale.
See also
NTTime
,NTDate
andNTDateTime
.
- class NTDoubleList¶
List of
float
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: float) → None¶
Inserts
value
at the end of the list.
- Parameters
value (float) – The value to add to the list.
See also
insert()
.
- at(i: int) → float¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
float
- clear() → None¶
Removes all items from the list.
- contains(value: float) → bool¶
Checks the presence of an element in the list.
- Parameters
value (float) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: float) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (float) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: float, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (float) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: float) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (float) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTDoubleListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: float) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (float) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → float¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
float
See also
removeAt()
.
- class NTDoubleListIt(obj: Pro.Core.NTDoubleList)¶
Iterator class for
NTDoubleList
.
- Parameters
obj (NTDoubleList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → float¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
float
See also
hasNext()
andprevious()
.
- previous() → float¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
float
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class NTDoubleVector¶
Vector list of
float
elements. The difference with normal lists is that vector lists are contiguous in memory.Methods:
append
(value)Inserts
value
at the end of the vector.
at
(i)Returns the item at index position
i
in the vector.
clear
()Removes all the elements from the vector and releases the memory used by the vector.
contains
(value)Checks the presence of an element in the vector.
count
(value)Returns the number of occurrences of
value
in the vector.
indexOf
(value[, start])Searches for an element in the vector.
insert
(i, value)Inserts
value
at index positioni
in the vector.
isEmpty
()Checks whether the vector is empty.
iterator
()Creates an iterator for the vector.
reserve
(alloc)Reserve space for
alloc
elements.
resize
(size)Sets the size of the vector to
size
.
size
()Returns the number of items in the vector.
- append(value: float) → None¶
Inserts
value
at the end of the vector.
- Parameters
value (float) – The value to add to the list.
See also
insert()
.
- at(i: int) → float¶
Returns the item at index position
i
in the vector.i
must be a valid index position in the vector (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
float
- clear() → None¶
Removes all the elements from the vector and releases the memory used by the vector.
- contains(value: float) → bool¶
Checks the presence of an element in the vector.
- Parameters
value (float) – The value to check for.
- Returns
Returns
True
if the vector contains an occurrence of value; otherwise returnsFalse
.- Return type
bool
- count(value: float) → int¶
Returns the number of occurrences of
value
in the vector.
- Parameters
value (float) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: float, start: int = 0) → int¶
Searches for an element in the vector.
- Parameters
value (float) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the vector. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: float) → None¶
Inserts
value
at index positioni
in the vector. Ifi
is0
, the value is prepended to the vector. Ifi
issize()
, the value is appended to the vector.
- Parameters
i (int) – The position at which to add the value.
value (float) – The value to add.
See also
append()
.
- isEmpty() → bool¶
Checks whether the vector is empty.
- Returns
Returns
True
if the vector contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTDoubleVectorIt¶
Creates an iterator for the vector.
- Returns
Returns the iterator.
- Return type
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the vector.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- resize(size: int) → None¶
Sets the size of the vector to
size
. Ifsize
is greater than the current size, elements are added to the end; the new elements are initialized with a default-constructed value. Ifsize
is less than the current size, elements are removed from the end.
- Parameters
size (int) – The new size of the vector.
See also
size()
.
- class NTDoubleVectorIt(obj: Pro.Core.NTDoubleVector)¶
Iterator class for
NTDoubleVector
.
- Parameters
obj (NTDoubleVector) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → float¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
float
See also
hasNext()
andprevious()
.
- previous() → float¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
float
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class NTFileEnum(path: Optional[str] = None)¶
This class enumerates files from a specified path.
Example:
from Pro.Core import NTFileEnum fe = NTFileEnum(".") while True: res, name = fe.next() if not res: break print(name)
- Parameters
path (Optional[str]) – The input path.
Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.
Methods:
getPath
()Returns the input path.
init
(path)Sets a new input path.
next
()Retrieves the next file name.
Retrieves the next file name with its full path.
- getPath() → str¶
- Returns
Returns the input path.
- Return type
str
- init(path: str) → None¶
Sets a new input path.
- Parameters
path (str) – The input path.
See also
next()
andnextFullPath()
.
- next() → tuple¶
Retrieves the next file name.
- Returns
Returns a tuple containing a boolean and a string. If the boolean is
False
, the enumeration has finished. The string represents the returned file name.- Return type
tuple[bool, str]
See also
nextFullPath()
.
- NTFileOpt_CreateNew: Final[int]¶
Creates the file only if it doesn’t already exist.
Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.
See also
NT_CreateFile()
.
- NTFileOpt_ReadOnly: Final[int]¶
Read-only file access.
See also
NT_OpenFile()
andNT_CreateFile()
.
Shared write file access. This option may not be supported by all systems.
See also
NT_OpenFile()
andNT_CreateFile()
.
- NTFileOpt_Write: Final[int]¶
Read/write file access.
See also
NT_OpenFile()
andNT_CreateFile()
.
- NTFlagOutput_IgnoreUnknown: Final[int]¶
Ignores unknown flags and options.
See also
CFFFlags.Output()
.
- NTFriday: Final[int]¶
Fifth day of the week.
See also
NTDate.dayOfWeek()
.
- NTISODate: Final[int]¶
ISO 8601 extended date format: either yyyy-MM-dd for dates or yyyy-MM-ddTHH:mm:ss (e.g. 2017-07-24T15:46:29), or with a time-zone suffix (Z for UTC otherwise an offset as [+|-]HH:mm) where appropriate for combined dates and times.
See also
NTTime
,NTDate
andNTDateTime
.
- class NTIWait¶
Interface for wait objects.
Derived classes may only implement a limited number of methods.
This class is implemented by the UI module to provide a wait-dialog.
See also
NTSimpleWait
.Attributes:
Shows a secondary message of the wait-dialog.
Shows a secondary progress-bar of the wait-dialog.
Hides the abort button of the wait-dialog.
Hides the primary message of the wait-dialog.
Hides the primary progress-bar of the wait-dialog.
Methods:
abort
()Aborts the wait operation.
Checks whether a wait operation is in progress.
log
(t)Logs a message.
logMsg
(str)Logs a message.
message
(t)Sets the primary message of the wait-dialog.
message2
(t)Sets the secondary message of the wait-dialog.
Sets the secondary message of the wait-dialog if present; otherwise sets the primary message.
msg
(str)Sets the primary message of the wait-dialog.
msg2
(str)Sets the secondary message of the wait-dialog.
msgInferior
(str)Sets the secondary message of the wait-dialog if present; otherwise sets the primary message.
Processes pending thread events.
progress
(i)Sets the value of the primary progress-bar of the wait-dialog.
progress2
(i)Sets the value of the secondary progress-bar of the wait-dialog.
Sets the value of the secondary progress-bar of the wait-dialog if present; otherwise sets the value of the primary progress-bar.
Retrieves the return code for the wait operation.
setRange
(min, max)Sets the range for the primary progress-bar of the wait-dialog.
setRange2
(min, max)Sets the range for the secondary progress-bar of the wait-dialog.
setRangeInferior
(min, max)Sets the range for the secondary progress-bar of the wait-dialog if present; otherwise sets the range for the primary progress-bar.
setReturnCode
(code)Sets the return code for the wait object.
start
(str[, flags])Starts the wait operation.
stop
()Stops the wait operation gracefully.
Returns the wait flags set on the wait object.
Checks whether the wait operation was aborted.
- HasMessage2: Final[int]¶
Shows a secondary message of the wait-dialog.
- HasProgress2: Final[int]¶
Shows a secondary progress-bar of the wait-dialog.
- NoAbort: Final[int]¶
Hides the abort button of the wait-dialog.
- NoMessage: Final[int]¶
Hides the primary message of the wait-dialog.
- NoProgress: Final[int]¶
Hides the primary progress-bar of the wait-dialog.
- abort() → None¶
Aborts the wait operation.
Note
This method can be overwritten by derived classes.
See also
wasAborted()
,stop()
andisWaiting()
.
- isWaiting() → bool¶
Checks whether a wait operation is in progress.
Note
This method can be overwritten by derived classes.
- Returns
Returns
True
if waiting; otherwise returnsFalse
.- Return type
bool
See also
stop()
,abort()
andwasAborted()
.
- log(t: str) → None¶
Logs a message.
When implemented, it calls
proPrintnl()
internally.
- Parameters
t (str) – The message to log.
See also
message()
.
- logMsg(str: str) → None¶
Logs a message.
Note
This method can be overwritten by derived classes.
Does the same as
log()
.When implemented, it calls
proPrintnl()
internally.
- Parameters
str (str) – The message to log.
- message(t: str) → None¶
Sets the primary message of the wait-dialog.
- Parameters
t (str) – The message to set.
See also
message2()
andmessageInferior()
.
- message2(t: str) → None¶
Sets the secondary message of the wait-dialog.
- Parameters
t (str) – The message to set.
See also
message()
andmessageInferior()
.
- messageInferior(t: str) → None¶
Sets the secondary message of the wait-dialog if present; otherwise sets the primary message.
- Parameters
t (str) – The message to set.
See also
message()
andmessage2()
.
- msg(str: str) → None¶
Sets the primary message of the wait-dialog.
Note
This method can be overwritten by derived classes.
Does the same as
message()
.
- Parameters
str (str) – The message to set.
See also
message()
.
- msg2(str: str) → None¶
Sets the secondary message of the wait-dialog.
Note
This method can be overwritten by derived classes.
Does the same as
message2()
.
- Parameters
str (str) – The message to set.
See also
message2()
.
- msgInferior(str: str) → None¶
Sets the secondary message of the wait-dialog if present; otherwise sets the primary message.
Does the same as
messageInferior()
.
- Parameters
str (str) – The message to set.
See also
messageInferior()
.
- processEvents() → None¶
Processes pending thread events.
Note
This method can be overwritten by derived classes.
When implemented, it calls
proProcessEvents()
at safe intervals usingNTTimer
.See also
proProcessEvents()
.
- progress(i: int) → None¶
Sets the value of the primary progress-bar of the wait-dialog.
Note
This method can be overwritten by derived classes.
- Parameters
i (int) – The value to set.
See also
progress2()
andprogressInferior()
.
- progress2(i: int) → None¶
Sets the value of the secondary progress-bar of the wait-dialog.
Note
This method can be overwritten by derived classes.
- Parameters
i (int) – The value to set.
See also
progress()
andprogressInferior()
.
- progressInferior(i: int) → None¶
Sets the value of the secondary progress-bar of the wait-dialog if present; otherwise sets the value of the primary progress-bar.
- Parameters
i (int) – The value to set.
See also
progress()
andprogress2()
.
- returnCode() → int¶
Retrieves the return code for the wait operation.
Note
This method can be overwritten by derived classes.
- Returns
Returns the return code set by calling
setReturnCode()
.- Return type
int
See also
setReturnCode()
.
- setRange(min: int, max: int) → None¶
Sets the range for the primary progress-bar of the wait-dialog.
Note
This method can be overwritten by derived classes.
- Parameters
min (int) – The minimum value.
max (int) – The maximum value.
See also
setRange2()
andsetRangeInferior()
.
- setRange2(min: int, max: int) → None¶
Sets the range for the secondary progress-bar of the wait-dialog.
Note
This method can be overwritten by derived classes.
- Parameters
min (int) – The minimum value.
max (int) – The maximum value.
See also
setRange()
andsetRangeInferior()
.
- setRangeInferior(min: int, max: int) → None¶
Sets the range for the secondary progress-bar of the wait-dialog if present; otherwise sets the range for the primary progress-bar.
- Parameters
min (int) – The minimum value.
max (int) – The maximum value.
See also
setRange()
andsetRange2()
.
- setReturnCode(code: int) → None¶
Sets the return code for the wait object.
Note
This method can be overwritten by derived classes.
- Parameters
code (int) – The return code to set.
See also
returnCode()
.
- start(str: str, flags: int = 0) → None¶
Starts the wait operation.
- Parameters
str (str) – The primary message of the wait object.
flags (int) – The flags of the wait object (e.g.,
NoAbort
).Available since Cerbero Suite 6.0 and Cerbero Engine 3.0.
See also
stop()
,isWaiting()
,abort()
andwasAborted()
.
- stop() → None¶
Stops the wait operation gracefully.
Note
This method can be overwritten by derived classes.
See also
start()
,isWaiting()
,abort()
andwasAborted()
.
- waitFlags() → int¶
- Returns
Returns the wait flags set on the wait object.
- Return type
int
- wasAborted() → bool¶
Checks whether the wait operation was aborted.
Note
This method can be overwritten by derived classes.
- Returns
Returns
True
if the wait operation was aborted; otherwise returnsFalse
.- Return type
bool
See also
abort()
,isWaiting()
andstop()
.
- class NTIntList¶
List of
int
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: int) → None¶
Inserts
value
at the end of the list.
- Parameters
value (int) – The value to add to the list.
See also
insert()
.
- at(i: int) → int¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
int
- clear() → None¶
Removes all items from the list.
- contains(value: int) → bool¶
Checks the presence of an element in the list.
- Parameters
value (int) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: int) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (int) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: int, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (int) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: int) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (int) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTIntListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: int) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (int) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → int¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
int
See also
removeAt()
.
- class NTIntListIt(obj: Pro.Core.NTIntList)¶
Iterator class for
NTIntList
.
- Parameters
obj (NTIntList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → int¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
int
See also
hasNext()
andprevious()
.
- previous() → int¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
int
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class NTIntVariantHash¶
Dictionary of
int
->BasicType
elements.Methods:
clear
()Removes all items from the hash.
contains
(key)Checks whether
key
is present in the hash.
count
(key)Counts the numbers of values associated with
key
in the hash.
insert
(key, value)Inserts a new item with
key
and a value ofvalue
.
insertMulti
(key, value)Inserts a new item with
key
and a value ofvalue
.
isEmpty
()Checks whether the hash is empty.
iterator
()Creates an iterator for the hash.
remove
(key)Removes all the items that have
key
from the hash.
reserve
(alloc)Ensures that the internal hash table consists of at least
size
buckets.
size
()Returns the number of items in the hash.
take
(key)Removes the item with
key
from the hash and returns the value associated with it.
value
(key[, defaultValue])Returns the value associated with
key
.
- clear() → None¶
Removes all items from the hash.
- contains(key: int) → bool¶
Checks whether
key
is present in the hash.
- Parameters
key (int) – The key value to check for.
- Returns
Returns
True
if the hash contains an item with the key; otherwise returnsFalse
.- Return type
bool
See also
count()
.
- count(key: int) → int¶
Counts the numbers of values associated with
key
in the hash.
- Parameters
key (int) – The key value.
- Returns
Returns the number of items associated with the key.
- Return type
int
See also
contains()
.
- insert(key: int, value: Optional[Union[int, float, bool, bytes, str]]) → None¶
Inserts a new item with
key
and a value ofvalue
.
- Parameters
key (int) – The key.
value (BasicType) – The value.
See also
insertMulti()
.
- insertMulti(key: int, value: Optional[Union[int, float, bool, bytes, str]]) → None¶
Inserts a new item with
key
and a value ofvalue
.If there is already an item with the same key in the hash, this method will simply create a new one. (This behaviour is different from
insert()
, which overwrites the value of an existing item.)
- Parameters
key (int) – The key.
value (BasicType) – The value.
See also
insert()
.
- isEmpty() → bool¶
Checks whether the hash is empty.
- Returns
Returns
True
if the hash contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTIntVariantHashIt¶
Creates an iterator for the hash.
- Returns
Returns the iterator.
- Return type
- remove(key: int) → int¶
Removes all the items that have
key
from the hash.
- Parameters
key (int) – The key to remove.
- Returns
Returns the number of items removed which is usually
1
but will be0
if the key isn’t in the hash, or greater than1
ifinsertMulti()
has been used with the key.- Return type
int
- reserve(alloc: int) → None¶
Ensures that the internal hash table consists of at least
size
buckets.
- Parameters
alloc (int) – The allocation size.
- size() → int¶
- Returns
Returns the number of items in the hash.
- Return type
int
- take(key: int) → Optional[Union[int, float, bool, bytes, str]]¶
Removes the item with
key
from the hash and returns the value associated with it.If the item does not exist in the hash, the method simply returns a default-constructed value. If there are multiple items for key in the hash, only the most recently inserted one is removed.
If you don’t use the return value,
remove()
is more efficient.
- Parameters
key (int) – The key.
- Returns
Returns the removed value.
- Return type
BasicType
See also
remove()
.
- value(key: int, defaultValue: Optional[Union[int, float, bool, bytes, str]] = None) → Optional[Union[int, float, bool, bytes, str]]¶
Returns the value associated with
key
. If the hash contains no item withkey
, the method returns a default-constructed value ifdefaultValue
is not provided. If there are multiple items forkey
in the hash, the value of the most recently inserted one is returned.
- Parameters
key (int) – The key.
defaultValue (Optional[BasicType]) – The default value to return if
key
is not present in the hash.- Returns
Returns the value associated with
key
.- Return type
BasicType
See also
contains()
.
- class NTIntVariantHashIt(obj: Pro.Core.NTIntVariantHash)¶
Iterator class for
NTIntVariantHash
.
- Parameters
obj (NTIntVariantHash) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
key
()Returns the key of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
value
()Returns the value of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- key() → int¶
- Returns
Returns the key of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).- Return type
int
See also
value()
.
- next() → None¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
tuple[int, BasicType]
See also
hasNext()
andprevious()
.
- previous() → None¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
tuple[int, BasicType]
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- toFront() → None¶
Moves the iterator to the front of the container (before the first item).
- value() → Optional[Union[int, float, bool, bytes, str]]¶
- Returns
Returns the value of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).- Return type
BasicType
See also
key()
.
- class NTIntVector¶
Vector list of
int
elements. The difference with normal lists is that vector lists are contiguous in memory.Methods:
append
(value)Inserts
value
at the end of the vector.
at
(i)Returns the item at index position
i
in the vector.
clear
()Removes all the elements from the vector and releases the memory used by the vector.
contains
(value)Checks the presence of an element in the vector.
count
(value)Returns the number of occurrences of
value
in the vector.
indexOf
(value[, start])Searches for an element in the vector.
insert
(i, value)Inserts
value
at index positioni
in the vector.
isEmpty
()Checks whether the vector is empty.
iterator
()Creates an iterator for the vector.
reserve
(alloc)Reserve space for
alloc
elements.
resize
(size)Sets the size of the vector to
size
.
size
()Returns the number of items in the vector.
- append(value: int) → None¶
Inserts
value
at the end of the vector.
- Parameters
value (int) – The value to add to the list.
See also
insert()
.
- at(i: int) → int¶
Returns the item at index position
i
in the vector.i
must be a valid index position in the vector (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
int
- clear() → None¶
Removes all the elements from the vector and releases the memory used by the vector.
- contains(value: int) → bool¶
Checks the presence of an element in the vector.
- Parameters
value (int) – The value to check for.
- Returns
Returns
True
if the vector contains an occurrence of value; otherwise returnsFalse
.- Return type
bool
- count(value: int) → int¶
Returns the number of occurrences of
value
in the vector.
- Parameters
value (int) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: int, start: int = 0) → int¶
Searches for an element in the vector.
- Parameters
value (int) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the vector. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: int) → None¶
Inserts
value
at index positioni
in the vector. Ifi
is0
, the value is prepended to the vector. Ifi
issize()
, the value is appended to the vector.
- Parameters
i (int) – The position at which to add the value.
value (int) – The value to add.
See also
append()
.
- isEmpty() → bool¶
Checks whether the vector is empty.
- Returns
Returns
True
if the vector contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTIntVectorIt¶
Creates an iterator for the vector.
- Returns
Returns the iterator.
- Return type
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the vector.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- resize(size: int) → None¶
Sets the size of the vector to
size
. Ifsize
is greater than the current size, elements are added to the end; the new elements are initialized with a default-constructed value. Ifsize
is less than the current size, elements are removed from the end.
- Parameters
size (int) – The new size of the vector.
See also
size()
.
- class NTIntVectorIt(obj: Pro.Core.NTIntVector)¶
Iterator class for
NTIntVector
.
- Parameters
obj (NTIntVector) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → int¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
int
See also
hasNext()
andprevious()
.
- previous() → int¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
int
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- NTLocalTime: Final[int]¶
Local time, controlled by a system time-zone setting.
See also
NTDateTime
.
- class NTMaxUIntList¶
List of
int
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: int) → None¶
Inserts
value
at the end of the list.
- Parameters
value (int) – The value to add to the list.
See also
insert()
.
- at(i: int) → int¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
int
- clear() → None¶
Removes all items from the list.
- contains(value: int) → bool¶
Checks the presence of an element in the list.
- Parameters
value (int) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: int) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (int) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: int, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (int) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: int) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (int) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTMaxUIntListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: int) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (int) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → int¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
int
See also
removeAt()
.
- class NTMaxUIntListIt(obj: Pro.Core.NTMaxUIntList)¶
Iterator class for
NTMaxUIntList
.
- Parameters
obj (NTMaxUIntList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → int¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
int
See also
hasNext()
andprevious()
.
- previous() → int¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
int
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class NTMaxUIntTree¶
Tree of
NTMaxUIntTreeNode
nodes.Methods:
appendChild
(parent, value)Adds a node to the children of the specified parent node.
children
(parent)Returns the number of child nodes for the specified parent node.
childrenList
(parent)Returns the list of child nodes for the specified parent node.
clear
()Removes all nodes from the tree.
clearChildren
(parent)Removes all the child nodes of the specified parent node.
enableIDs
(b)Enables id-based look-up for nodes.
insertChild
(parent, pos, value)Inserts a new node into the list of child nodes of the specified parent node at a given position.
nextNode
(node)Retrieves the next node starting from
node
.
nextSibling
(node)Returns the next sibling of a node.
node
(nid_or_parent[, pos])Returns a node given a parent and a child index or, alternatively, given a node id.
nodeId
(node)Returns the node id for the specified node.
parentNode
(node)Retrieves the parent node for the specified node.
position
(node)Returns the position of the specified node related its siblings.
prependChild
(parent, value)Prepends a node to the children of the specified parent node.
previousNode
(node)Retrieves the previous node starting from
node
.
previousSibling
(node)Returns the previous sibling of a node.
remove
(node)Removes a node from the tree.
removeChild
(parent, pos)Removes a child node at a specified position.
siblings
(node)Returns the number of siblings of the specified node.
sortChildren
(parent[, pos, count])Sorts a level of the tree.
swap
(node, newPos)Swaps two sibling nodes.
- appendChild(parent: Pro.Core.NTMaxUIntTreeNode, value: int) → Pro.Core.NTMaxUIntTreeNode¶
Adds a node to the children of the specified parent node.
- Parameters
parent (NTMaxUIntTreeNode) – The parent node. This value can be
None
to add a root-level node.value (int) – The value of the new node.
- Returns
Returns the newly created node.
- Return type
See also
prependChild()
andinsertChild()
.
- children(parent: Pro.Core.NTMaxUIntTreeNode) → int¶
Returns the number of child nodes for the specified parent node.
- Parameters
parent (NTMaxUIntTreeNode) – The parent node. This value can be
None
to retrieve the number of root-level nodes.- Returns
Returns the number of child nodes.
- Return type
int
See also
childrenList()
,siblings()
andparentNode()
.
- childrenList(parent: Pro.Core.NTMaxUIntTreeNode) → Pro.Core.NTMaxUIntTreeNodeList¶
Returns the list of child nodes for the specified parent node.
- Parameters
parent (NTMaxUIntTreeNode) – The parent node. This value can be
None
to retrieve the list of root-level nodes.- Returns
Returns the list of child nodes.
- Return type
See also
children()
,siblings()
andparentNode()
.
- clear() → None¶
Removes all nodes from the tree.
See also
clearChildren()
.
- clearChildren(parent: Pro.Core.NTMaxUIntTreeNode) → None¶
Removes all the child nodes of the specified parent node.
- Parameters
parent (NTMaxUIntTreeNode) – The parent node.
See also
clear()
.
- enableIDs(b: bool) → None¶
Enables id-based look-up for nodes. This method must be called before adding nodes to the tree. By default id-based look-up is not enabled.
- Parameters
b (bool) – Must be
True
to enable id-based look-up.
- insertChild(parent: Pro.Core.NTMaxUIntTreeNode, pos: int, value: int) → Pro.Core.NTMaxUIntTreeNode¶
Inserts a new node into the list of child nodes of the specified parent node at a given position.
- Parameters
parent (NTMaxUIntTreeNode) – The parent node. This value can be
None
to insert a root-level node.pos (int) – The position where to insert the child node. An value of 0 is the same as calling
prependChild()
. A value ofchildren()
is the same as callingappendChild()
.value (int) – The value of the new node.
- Returns
Returns the newly created node.
- Return type
See also
appendChild()
andprependChild()
.
- nextNode(node: Pro.Core.NTMaxUIntTreeNode) → Pro.Core.NTMaxUIntTreeNode¶
Retrieves the next node starting from
node
.The difference with
nextSibling()
is that this method also enumerates child nodes.
- Parameters
node (NTMaxUIntTreeNode) – The current node. This parameter can be
None
to start from the first root node of the tree.- Returns
Returns the next node if available; otherwise returns
None
.- Return type
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
See also
previousNode()
.
- nextSibling(node: Pro.Core.NTMaxUIntTreeNode) → Pro.Core.NTMaxUIntTreeNode¶
Returns the next sibling of a node.
- Parameters
node (NTMaxUIntTreeNode) – The node for which to retrieve the sibling.
- Returns
Returns the sibling node if available; otherwise returns
None
.- Return type
Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.
See also
previousSibling()
.
- node(nid_or_parent: Union[Pro.Core.NTMaxUIntTreeNode, int], pos: Optional[int] = None) → Pro.Core.NTMaxUIntTreeNode¶
Returns a node given a parent and a child index or, alternatively, given a node id. To retrieve nodes by id,
enableIDs()
must have been called first.
- Parameters
nid_or_parent (Union[NTMaxUIntTreeNode, int]) – Can be either a parent node or a node id.
pos (Optional[int]) – The child index. This parameter can be used only when a parent node is specified.
- Returns
Returns the requested node. If the node couldn’t be found, the return value is
None
.- Return type
See also
enableIDs()
.
- nodeId(node: Pro.Core.NTMaxUIntTreeNode) → int¶
Returns the node id for the specified node.
enableIDs()
must have been called first in order for nodes to have valid ids.
- Parameters
node (NTMaxUIntTreeNode) – The node for which to retrieve the node id.
- Returns
Returns the node id.
- Return type
int
See also
enableIDs()
andnode()
.
- parentNode(node: Pro.Core.NTMaxUIntTreeNode) → Pro.Core.NTMaxUIntTreeNode¶
Retrieves the parent node for the specified node.
- Parameters
node (NTMaxUIntTreeNode) – The node for which to retrieve the parent node.
- Returns
Returns the parent node. If the specified node is a root-level node, then the method returns
None
.- Return type
See also
childrenList()
andnode()
.
- position(node: Pro.Core.NTMaxUIntTreeNode) → int¶
Returns the position of the specified node related its siblings.
- Parameters
node (NTMaxUIntTreeNode) – The node for which to retrieve the position. This value can be
None
to retrieve the position of a root-level node.- Returns
Returns the index position.
- Return type
int
See also
children()
andsiblings()
.
- prependChild(parent: Pro.Core.NTMaxUIntTreeNode, value: int) → Pro.Core.NTMaxUIntTreeNode¶
Prepends a node to the children of the specified parent node.
- Parameters
parent (NTMaxUIntTreeNode) – The parent node. This value can be
None
to prepend a root-level node.value (int) – The value of the new node.
- Returns
Returns the newly created node.
- Return type
See also
appendChild()
andinsertChild()
.
- previousNode(node: Pro.Core.NTMaxUIntTreeNode) → Pro.Core.NTMaxUIntTreeNode¶
Retrieves the previous node starting from
node
.The difference with
previousSibling()
is that this method also enumerates child nodes.
- Parameters
node (NTMaxUIntTreeNode) – The current node. This parameter can be
None
to start from the last child of the tree.- Returns
Returns the previous node if available; otherwise returns
None
.- Return type
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
See also
nextNode()
.
- previousSibling(node: Pro.Core.NTMaxUIntTreeNode) → Pro.Core.NTMaxUIntTreeNode¶
Returns the previous sibling of a node.
- Parameters
node (NTMaxUIntTreeNode) – The node for which to retrieve the sibling.
- Returns
Returns the sibling node if available; otherwise returns
None
.- Return type
Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.
See also
nextSibling()
.
- remove(node: Pro.Core.NTMaxUIntTreeNode) → None¶
Removes a node from the tree.
- Parameters
node (NTMaxUIntTreeNode) – The node to remove.
See also
removeChild()
.
- removeChild(parent: Pro.Core.NTMaxUIntTreeNode, pos: int) → None¶
Removes a child node at a specified position.
- Parameters
parent (NTMaxUIntTreeNode) – The parent node. This value can be
None
to remove a root-level node.pos (int) – The index of the child to remove.
See also
remove()
.
- siblings(node: Pro.Core.NTMaxUIntTreeNode) → int¶
Returns the number of siblings of the specified node.
- Parameters
node (NTMaxUIntTreeNode) – The node for which to get the number of siblings.
- Returns
Returns the number of siblings.
- Return type
int
See also
children()
andchildrenList()
.
- sortChildren(parent: Pro.Core.NTMaxUIntTreeNode, pos: Optional[int] = None, count: Optional[int] = None) → None¶
Sorts a level of the tree.
- Parameters
parent (NTMaxUIntTreeNode) – The parent node.
pos (Optional[int]) – The position of the child nodes to sort.
count (Optional[int]) – The number of child nodes to sort.
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
- swap(node: Pro.Core.NTMaxUIntTreeNode, newPos: int) → None¶
Swaps two sibling nodes.
- Parameters
node (NTMaxUIntTreeNode) – One of the nodes to swap.
newPos (int) – The new position at which to place the specified node.
See also
children()
andsiblings()
.
- class NTMaxUIntTreeNode¶
This class represents a node of
NTMaxUIntTree
.Attributes:
A
NTMaxUIntTreeNodeList
list of children nodes.”The node id.
The parent node.
The position of the node relative to its parent.
The
int
value of the node.Methods:
Returns
True
if the node has a parent; otherwise returnsFalse
.
- children¶
A
NTMaxUIntTreeNodeList
list of children nodes.”See also
NTMaxUIntTree.childrenList()
.
- hasParent() → bool¶
- Returns
Returns
True
if the node has a parent; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
See also
parent
andNTMaxUIntTree.parentNode()
.
- nid¶
The node id.
See also
NTMaxUIntTree.nodeId()
andNTMaxUIntTree.enableIDs()
.
- parent¶
The parent node.
See also
hasParent()
andNTMaxUIntTree.parentNode()
.
- pos¶
The position of the node relative to its parent.
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
See also
NTMaxUIntTree.position()
.
- value¶
The
int
value of the node.
- class NTMaxUIntTreeNodeList¶
List of
NTMaxUIntTreeNode
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: Pro.Core.NTMaxUIntTreeNode) → None¶
Inserts
value
at the end of the list.
- Parameters
value (NTMaxUIntTreeNode) – The value to add to the list.
See also
insert()
.
- at(i: int) → Pro.Core.NTMaxUIntTreeNode¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
- clear() → None¶
Removes all items from the list.
- contains(value: Pro.Core.NTMaxUIntTreeNode) → bool¶
Checks the presence of an element in the list.
- Parameters
value (NTMaxUIntTreeNode) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: Pro.Core.NTMaxUIntTreeNode) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (NTMaxUIntTreeNode) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: Pro.Core.NTMaxUIntTreeNode, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (NTMaxUIntTreeNode) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: Pro.Core.NTMaxUIntTreeNode) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (NTMaxUIntTreeNode) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTMaxUIntTreeNodeListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: Pro.Core.NTMaxUIntTreeNode) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (NTMaxUIntTreeNode) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → Pro.Core.NTMaxUIntTreeNode¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
See also
removeAt()
.
- class NTMaxUIntTreeNodeListIt(obj: Pro.Core.NTMaxUIntTreeNodeList)¶
Iterator class for
NTMaxUIntTreeNodeList
.
- Parameters
obj (NTMaxUIntTreeNodeList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → Pro.Core.NTMaxUIntTreeNode¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
See also
hasNext()
andprevious()
.
- previous() → Pro.Core.NTMaxUIntTreeNode¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class NTMaxUIntVector¶
Vector list of
int
elements. The difference with normal lists is that vector lists are contiguous in memory.Methods:
append
(value)Inserts
value
at the end of the vector.
at
(i)Returns the item at index position
i
in the vector.
clear
()Removes all the elements from the vector and releases the memory used by the vector.
contains
(value)Checks the presence of an element in the vector.
count
(value)Returns the number of occurrences of
value
in the vector.
indexOf
(value[, start])Searches for an element in the vector.
insert
(i, value)Inserts
value
at index positioni
in the vector.
isEmpty
()Checks whether the vector is empty.
iterator
()Creates an iterator for the vector.
reserve
(alloc)Reserve space for
alloc
elements.
resize
(size)Sets the size of the vector to
size
.
size
()Returns the number of items in the vector.
- append(value: int) → None¶
Inserts
value
at the end of the vector.
- Parameters
value (int) – The value to add to the list.
See also
insert()
.
- at(i: int) → int¶
Returns the item at index position
i
in the vector.i
must be a valid index position in the vector (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
int
- clear() → None¶
Removes all the elements from the vector and releases the memory used by the vector.
- contains(value: int) → bool¶
Checks the presence of an element in the vector.
- Parameters
value (int) – The value to check for.
- Returns
Returns
True
if the vector contains an occurrence of value; otherwise returnsFalse
.- Return type
bool
- count(value: int) → int¶
Returns the number of occurrences of
value
in the vector.
- Parameters
value (int) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: int, start: int = 0) → int¶
Searches for an element in the vector.
- Parameters
value (int) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the vector. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: int) → None¶
Inserts
value
at index positioni
in the vector. Ifi
is0
, the value is prepended to the vector. Ifi
issize()
, the value is appended to the vector.
- Parameters
i (int) – The position at which to add the value.
value (int) – The value to add.
See also
append()
.
- isEmpty() → bool¶
Checks whether the vector is empty.
- Returns
Returns
True
if the vector contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTMaxUIntVectorIt¶
Creates an iterator for the vector.
- Returns
Returns the iterator.
- Return type
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the vector.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- resize(size: int) → None¶
Sets the size of the vector to
size
. Ifsize
is greater than the current size, elements are added to the end; the new elements are initialized with a default-constructed value. Ifsize
is less than the current size, elements are removed from the end.
- Parameters
size (int) – The new size of the vector.
See also
size()
.
- class NTMaxUIntVectorIt(obj: Pro.Core.NTMaxUIntVector)¶
Iterator class for
NTMaxUIntVector
.
- Parameters
obj (NTMaxUIntVector) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → int¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
int
See also
hasNext()
andprevious()
.
- previous() → int¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
int
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class NTMemoryInfoList¶
List of
NTMemoryInfo
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: Pro.Core.NT_MEMORY_INFO) → None¶
Inserts
value
at the end of the list.
- Parameters
value (NTMemoryInfo) – The value to add to the list.
See also
insert()
.
- at(i: int) → Pro.Core.NT_MEMORY_INFO¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
NTMemoryInfo
- clear() → None¶
Removes all items from the list.
- contains(value: Pro.Core.NT_MEMORY_INFO) → bool¶
Checks the presence of an element in the list.
- Parameters
value (NTMemoryInfo) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: Pro.Core.NT_MEMORY_INFO) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (NTMemoryInfo) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: Pro.Core.NT_MEMORY_INFO, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (NTMemoryInfo) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: Pro.Core.NT_MEMORY_INFO) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (NTMemoryInfo) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTMemoryInfoListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: Pro.Core.NT_MEMORY_INFO) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (NTMemoryInfo) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → Pro.Core.NT_MEMORY_INFO¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
NTMemoryInfo
See also
removeAt()
.
- class NTMemoryInfoListIt(obj: Pro.Core.NTMemoryInfoList)¶
Iterator class for
NTMemoryInfoList
.
- Parameters
obj (NTMemoryInfoList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → Pro.Core.NT_MEMORY_INFO¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
See also
hasNext()
andprevious()
.
- previous() → Pro.Core.NT_MEMORY_INFO¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class NTModuleInfoList¶
List of
NTModuleInfo
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: Pro.Core.NT_MODULE_INFO) → None¶
Inserts
value
at the end of the list.
- Parameters
value (NTModuleInfo) – The value to add to the list.
See also
insert()
.
- at(i: int) → Pro.Core.NT_MODULE_INFO¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
NTModuleInfo
- clear() → None¶
Removes all items from the list.
- contains(value: Pro.Core.NT_MODULE_INFO) → bool¶
Checks the presence of an element in the list.
- Parameters
value (NTModuleInfo) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: Pro.Core.NT_MODULE_INFO) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (NTModuleInfo) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: Pro.Core.NT_MODULE_INFO, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (NTModuleInfo) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: Pro.Core.NT_MODULE_INFO) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (NTModuleInfo) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTModuleInfoListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: Pro.Core.NT_MODULE_INFO) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (NTModuleInfo) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → Pro.Core.NT_MODULE_INFO¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
NTModuleInfo
See also
removeAt()
.
- class NTModuleInfoListIt(obj: Pro.Core.NTModuleInfoList)¶
Iterator class for
NTModuleInfoList
.
- Parameters
obj (NTModuleInfoList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → Pro.Core.NT_MODULE_INFO¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
See also
hasNext()
andprevious()
.
- previous() → Pro.Core.NT_MODULE_INFO¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- NTMonday: Final[int]¶
First day of the week.
See also
NTDate.dayOfWeek()
.
- NTOffsetFromUTC: Final[int]¶
An offset in seconds from Coordinated Universal Time.
See also
NTDateTime
.
- class NTOffsetRange¶
This class defines a generic offset-size range.
Attributes:
The start offset of the range.
The size of the range.
- offset¶
The start offset of the range.
- size¶
The size of the range.
- class NTOffsetRangeList¶
List of
NTOffsetRange
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: Pro.Core.NTOffsetRange) → None¶
Inserts
value
at the end of the list.
- Parameters
value (NTOffsetRange) – The value to add to the list.
See also
insert()
.
- at(i: int) → Pro.Core.NTOffsetRange¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
- clear() → None¶
Removes all items from the list.
- contains(value: Pro.Core.NTOffsetRange) → bool¶
Checks the presence of an element in the list.
- Parameters
value (NTOffsetRange) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: Pro.Core.NTOffsetRange) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (NTOffsetRange) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: Pro.Core.NTOffsetRange, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (NTOffsetRange) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: Pro.Core.NTOffsetRange) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (NTOffsetRange) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTOffsetRangeListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: Pro.Core.NTOffsetRange) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (NTOffsetRange) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → Pro.Core.NTOffsetRange¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
See also
removeAt()
.
- class NTOffsetRangeListIt(obj: Pro.Core.NTOffsetRangeList)¶
Iterator class for
NTOffsetRangeList
.
- Parameters
obj (NTOffsetRangeList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → Pro.Core.NTOffsetRange¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
See also
hasNext()
andprevious()
.
- previous() → Pro.Core.NTOffsetRange¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class NTProcessInfoList¶
List of
NTProcessInfo
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: Pro.Core.NT_PROCESS_INFO) → None¶
Inserts
value
at the end of the list.
- Parameters
value (NTProcessInfo) – The value to add to the list.
See also
insert()
.
- at(i: int) → Pro.Core.NT_PROCESS_INFO¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
NTProcessInfo
- clear() → None¶
Removes all items from the list.
- contains(value: Pro.Core.NT_PROCESS_INFO) → bool¶
Checks the presence of an element in the list.
- Parameters
value (NTProcessInfo) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: Pro.Core.NT_PROCESS_INFO) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (NTProcessInfo) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: Pro.Core.NT_PROCESS_INFO, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (NTProcessInfo) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: Pro.Core.NT_PROCESS_INFO) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (NTProcessInfo) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTProcessInfoListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: Pro.Core.NT_PROCESS_INFO) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (NTProcessInfo) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → Pro.Core.NT_PROCESS_INFO¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
NTProcessInfo
See also
removeAt()
.
- class NTProcessInfoListIt(obj: Pro.Core.NTProcessInfoList)¶
Iterator class for
NTProcessInfoList
.
- Parameters
obj (NTProcessInfoList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → Pro.Core.NT_PROCESS_INFO¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
See also
hasNext()
andprevious()
.
- previous() → Pro.Core.NT_PROCESS_INFO¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- NTProcessMemoryAccess_Execute: Final[int]¶
Executable memory flag.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_MEMORY_INFO.flags
.
- NTProcessMemoryAccess_Guard: Final[int]¶
Guarded memory flag.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_MEMORY_INFO.flags
.
- NTProcessMemoryAccess_Read: Final[int]¶
Readable memory flag.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_MEMORY_INFO.flags
.
- NTProcessMemoryAccess_UserMode: Final[int]¶
User-mode memory flag.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_MEMORY_INFO.flags
.
- NTProcessMemoryAccess_Write: Final[int]¶
Writable memory flag.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_MEMORY_INFO.flags
.
- NTProcessMemoryState_Commit: Final[int]¶
Committed memory state.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_MEMORY_INFO.state
.
- NTProcessMemoryState_Free: Final[int]¶
Freed memory state.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_MEMORY_INFO.state
.
- NTProcessMemoryState_Reserve: Final[int]¶
Reserved memory state.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_MEMORY_INFO.state
.
- NTProcessMemoryType_Image: Final[int]¶
Image memory type.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_MEMORY_INFO.type
.
- NTProcessMemoryType_Mapped: Final[int]¶
Mapped memory type.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_MEMORY_INFO.type
.
- NTProcessMemoryType_Private: Final[int]¶
Private memory type.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_MEMORY_INFO.type
.
- class NTProcessRegionsEnumerator(pid: int)¶
This class implements an enumerator for memory regions.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_GetMemoryRegions()
.
- Parameters
pid (int) – The process id.
Methods:
next
(mi)Retrieves the next memory region.
- next(mi: Pro.Core.NT_MEMORY_INFO) → bool¶
Retrieves the next memory region.
- Parameters
mi (NT_MEMORY_INFO) – The memory region information.
- Returns
Returns
True
if a memory region could be retrieved; otherwise returnsFalse
.- Return type
bool
- NTRFC2822Date: Final[int]¶
RFC 2822, RFC 850 and RFC 1036 date format.
See also
NTTime
,NTDate
andNTDateTime
.
- NTSaturday: Final[int]¶
Sixth day of the week.
See also
NTDate.dayOfWeek()
.
- class NTSimpleWait¶
Bases:
Pro.Core.NTIWait
Basic implementation of
NTIWait
.This class implements only the basic functionality of a wait object. No graphical functionality is provided.
See also
NTIWait
.Methods:
reset
()Resets the state of the wait object.
- reset() → None¶
Resets the state of the wait object.
- class NTStringList¶
List of
str
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: str) → None¶
Inserts
value
at the end of the list.
- Parameters
value (str) – The value to add to the list.
See also
insert()
.
- at(i: int) → str¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
str
- clear() → None¶
Removes all items from the list.
- contains(value: str) → bool¶
Checks the presence of an element in the list.
- Parameters
value (str) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: str) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (str) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: str, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (str) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: str) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (str) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTStringListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: str) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (str) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → str¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
str
See also
removeAt()
.
- class NTStringListIt(obj: Pro.Core.NTStringList)¶
Iterator class for
NTStringList
.
- Parameters
obj (NTStringList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → str¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
str
See also
hasNext()
andprevious()
.
- previous() → str¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
str
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class NTStringPair(t1: Optional[str] = None, t2: Optional[str] = None)¶
Pair of (
str
,str
) elements.
- Parameters
t1 (Optional[str]) – The first element of the pair.
t2 (Optional[str]) – The second element of the pair.
Methods:
first
()Returns the first element in the pair.
second
()Returns the second element in the pair.
setFirst
(v)Sets the first element in the pair.
setSecond
(v)Sets the second element in the pair.
- first() → str¶
- Returns
Returns the first element in the pair.
- Return type
str
See also
second()
andsetFirst()
.
- second() → str¶
- Returns
Returns the second element in the pair.
- Return type
str
See also
first()
andsetSecond()
.
- setFirst(v: str) → None¶
Sets the first element in the pair.
- Parameters
v (str) – The value of the element.
See also
first()
andsetSecond()
.
- setSecond(v: str) → None¶
Sets the second element in the pair.
- Parameters
v (str) – The value of the element.
See also
second()
andsetFirst()
.
- class NTStringPairList¶
List of
NTStringPair
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: Pro.Core.NTStringPair) → None¶
Inserts
value
at the end of the list.
- Parameters
value (NTStringPair) – The value to add to the list.
See also
insert()
.
- at(i: int) → Pro.Core.NTStringPair¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
- clear() → None¶
Removes all items from the list.
- contains(value: Pro.Core.NTStringPair) → bool¶
Checks the presence of an element in the list.
- Parameters
value (NTStringPair) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: Pro.Core.NTStringPair) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (NTStringPair) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: Pro.Core.NTStringPair, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (NTStringPair) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: Pro.Core.NTStringPair) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (NTStringPair) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTStringPairListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: Pro.Core.NTStringPair) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (NTStringPair) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → Pro.Core.NTStringPair¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
See also
removeAt()
.
- class NTStringPairListIt(obj: Pro.Core.NTStringPairList)¶
Iterator class for
NTStringPairList
.
- Parameters
obj (NTStringPairList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → Pro.Core.NTStringPair¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
See also
hasNext()
andprevious()
.
- previous() → Pro.Core.NTStringPair¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class NTStringStringHash¶
Dictionary of
str
->str
elements.Methods:
clear
()Removes all items from the hash.
contains
(key)Checks whether
key
is present in the hash.
count
(key)Counts the numbers of values associated with
key
in the hash.
insert
(key, value)Inserts a new item with
key
and a value ofvalue
.
insertMulti
(key, value)Inserts a new item with
key
and a value ofvalue
.
isEmpty
()Checks whether the hash is empty.
iterator
()Creates an iterator for the hash.
remove
(key)Removes all the items that have
key
from the hash.
reserve
(alloc)Ensures that the internal hash table consists of at least
size
buckets.
size
()Returns the number of items in the hash.
take
(key)Removes the item with
key
from the hash and returns the value associated with it.
value
(key[, defaultValue])Returns the value associated with
key
.
- clear() → None¶
Removes all items from the hash.
- contains(key: str) → bool¶
Checks whether
key
is present in the hash.
- Parameters
key (str) – The key value to check for.
- Returns
Returns
True
if the hash contains an item with the key; otherwise returnsFalse
.- Return type
bool
See also
count()
.
- count(key: str) → int¶
Counts the numbers of values associated with
key
in the hash.
- Parameters
key (str) – The key value.
- Returns
Returns the number of items associated with the key.
- Return type
int
See also
contains()
.
- insert(key: str, value: str) → None¶
Inserts a new item with
key
and a value ofvalue
.
- Parameters
key (str) – The key.
value (str) – The value.
See also
insertMulti()
.
- insertMulti(key: str, value: str) → None¶
Inserts a new item with
key
and a value ofvalue
.If there is already an item with the same key in the hash, this method will simply create a new one. (This behaviour is different from
insert()
, which overwrites the value of an existing item.)
- Parameters
key (str) – The key.
value (str) – The value.
See also
insert()
.
- isEmpty() → bool¶
Checks whether the hash is empty.
- Returns
Returns
True
if the hash contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTStringStringHashIt¶
Creates an iterator for the hash.
- Returns
Returns the iterator.
- Return type
- remove(key: str) → int¶
Removes all the items that have
key
from the hash.
- Parameters
key (str) – The key to remove.
- Returns
Returns the number of items removed which is usually
1
but will be0
if the key isn’t in the hash, or greater than1
ifinsertMulti()
has been used with the key.- Return type
int
- reserve(alloc: int) → None¶
Ensures that the internal hash table consists of at least
size
buckets.
- Parameters
alloc (int) – The allocation size.
- size() → int¶
- Returns
Returns the number of items in the hash.
- Return type
int
- take(key: str) → str¶
Removes the item with
key
from the hash and returns the value associated with it.If the item does not exist in the hash, the method simply returns a default-constructed value. If there are multiple items for key in the hash, only the most recently inserted one is removed.
If you don’t use the return value,
remove()
is more efficient.
- Parameters
key (str) – The key.
- Returns
Returns the removed value.
- Return type
str
See also
remove()
.
- value(key: str, defaultValue: Optional[str] = None) → str¶
Returns the value associated with
key
. If the hash contains no item withkey
, the method returns a default-constructed value ifdefaultValue
is not provided. If there are multiple items forkey
in the hash, the value of the most recently inserted one is returned.
- Parameters
key (str) – The key.
defaultValue (Optional[str]) – The default value to return if
key
is not present in the hash.- Returns
Returns the value associated with
key
.- Return type
str
See also
contains()
.
- class NTStringStringHashIt(obj: Pro.Core.NTStringStringHash)¶
Iterator class for
NTStringStringHash
.
- Parameters
obj (NTStringStringHash) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
key
()Returns the key of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
value
()Returns the value of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- key() → str¶
- Returns
Returns the key of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).- Return type
str
See also
value()
.
- next() → None¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
tuple[str, str]
See also
hasNext()
andprevious()
.
- previous() → None¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
tuple[str, str]
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- toFront() → None¶
Moves the iterator to the front of the container (before the first item).
- value() → str¶
- Returns
Returns the value of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).- Return type
str
See also
key()
.
- class NTStringStringHashList¶
List of
NTStringStringHash
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: Pro.Core.NTStringStringHash) → None¶
Inserts
value
at the end of the list.
- Parameters
value (NTStringStringHash) – The value to add to the list.
See also
insert()
.
- at(i: int) → Pro.Core.NTStringStringHash¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
- clear() → None¶
Removes all items from the list.
- contains(value: Pro.Core.NTStringStringHash) → bool¶
Checks the presence of an element in the list.
- Parameters
value (NTStringStringHash) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: Pro.Core.NTStringStringHash) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (NTStringStringHash) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: Pro.Core.NTStringStringHash, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (NTStringStringHash) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: Pro.Core.NTStringStringHash) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (NTStringStringHash) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTStringStringHashListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: Pro.Core.NTStringStringHash) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (NTStringStringHash) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → Pro.Core.NTStringStringHash¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
See also
removeAt()
.
- class NTStringStringHashListIt(obj: Pro.Core.NTStringStringHashList)¶
Iterator class for
NTStringStringHashList
.
- Parameters
obj (NTStringStringHashList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → Pro.Core.NTStringStringHash¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
See also
hasNext()
andprevious()
.
- previous() → Pro.Core.NTStringStringHash¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class NTStringVariantHash¶
Dictionary of
str
->BasicType
elements.Methods:
clear
()Removes all items from the hash.
contains
(key)Checks whether
key
is present in the hash.
count
(key)Counts the numbers of values associated with
key
in the hash.
insert
(key, value)Inserts a new item with
key
and a value ofvalue
.
insertMulti
(key, value)Inserts a new item with
key
and a value ofvalue
.
isEmpty
()Checks whether the hash is empty.
iterator
()Creates an iterator for the hash.
remove
(key)Removes all the items that have
key
from the hash.
reserve
(alloc)Ensures that the internal hash table consists of at least
size
buckets.
size
()Returns the number of items in the hash.
take
(key)Removes the item with
key
from the hash and returns the value associated with it.
value
(key[, defaultValue])Returns the value associated with
key
.
- clear() → None¶
Removes all items from the hash.
- contains(key: str) → bool¶
Checks whether
key
is present in the hash.
- Parameters
key (str) – The key value to check for.
- Returns
Returns
True
if the hash contains an item with the key; otherwise returnsFalse
.- Return type
bool
See also
count()
.
- count(key: str) → int¶
Counts the numbers of values associated with
key
in the hash.
- Parameters
key (str) – The key value.
- Returns
Returns the number of items associated with the key.
- Return type
int
See also
contains()
.
- insert(key: str, value: Optional[Union[int, float, bool, bytes, str]]) → None¶
Inserts a new item with
key
and a value ofvalue
.
- Parameters
key (str) – The key.
value (BasicType) – The value.
See also
insertMulti()
.
- insertMulti(key: str, value: Optional[Union[int, float, bool, bytes, str]]) → None¶
Inserts a new item with
key
and a value ofvalue
.If there is already an item with the same key in the hash, this method will simply create a new one. (This behaviour is different from
insert()
, which overwrites the value of an existing item.)
- Parameters
key (str) – The key.
value (BasicType) – The value.
See also
insert()
.
- isEmpty() → bool¶
Checks whether the hash is empty.
- Returns
Returns
True
if the hash contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTStringVariantHashIt¶
Creates an iterator for the hash.
- Returns
Returns the iterator.
- Return type
- remove(key: str) → int¶
Removes all the items that have
key
from the hash.
- Parameters
key (str) – The key to remove.
- Returns
Returns the number of items removed which is usually
1
but will be0
if the key isn’t in the hash, or greater than1
ifinsertMulti()
has been used with the key.- Return type
int
- reserve(alloc: int) → None¶
Ensures that the internal hash table consists of at least
size
buckets.
- Parameters
alloc (int) – The allocation size.
- size() → int¶
- Returns
Returns the number of items in the hash.
- Return type
int
- take(key: str) → Optional[Union[int, float, bool, bytes, str]]¶
Removes the item with
key
from the hash and returns the value associated with it.If the item does not exist in the hash, the method simply returns a default-constructed value. If there are multiple items for key in the hash, only the most recently inserted one is removed.
If you don’t use the return value,
remove()
is more efficient.
- Parameters
key (str) – The key.
- Returns
Returns the removed value.
- Return type
BasicType
See also
remove()
.
- value(key: str, defaultValue: Optional[Union[int, float, bool, bytes, str]] = None) → Optional[Union[int, float, bool, bytes, str]]¶
Returns the value associated with
key
. If the hash contains no item withkey
, the method returns a default-constructed value ifdefaultValue
is not provided. If there are multiple items forkey
in the hash, the value of the most recently inserted one is returned.
- Parameters
key (str) – The key.
defaultValue (Optional[BasicType]) – The default value to return if
key
is not present in the hash.- Returns
Returns the value associated with
key
.- Return type
BasicType
See also
contains()
.
- class NTStringVariantHashIt(obj: Pro.Core.NTStringVariantHash)¶
Iterator class for
NTStringVariantHash
.
- Parameters
obj (NTStringVariantHash) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
key
()Returns the key of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
value
()Returns the value of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- key() → str¶
- Returns
Returns the key of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).- Return type
str
See also
value()
.
- next() → None¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
tuple[str, BasicType]
See also
hasNext()
andprevious()
.
- previous() → None¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
tuple[str, BasicType]
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- toFront() → None¶
Moves the iterator to the front of the container (before the first item).
- value() → Optional[Union[int, float, bool, bytes, str]]¶
- Returns
Returns the value of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).- Return type
BasicType
See also
key()
.
- NTSunday: Final[int]¶
Seventh day of the week.
See also
NTDate.dayOfWeek()
.
- NTSystemLocaleLongDate: Final[int]¶
The long date format used by the operating system.
See also
NTTime
,NTDate
andNTDateTime
.
- NTSystemLocaleShortDate: Final[int]¶
The short date format used by the operating system.
See also
NTTime
,NTDate
andNTDateTime
.
- class NTTextBuffer¶
Bases:
Pro.Core.NTTextStream
This is a class derived from
NTTextStream
.Internally this class uses a utf-8 string as buffer.
See also
NTTextStream
,NTTextStringBuffer
andNTVoidBuffer
.Attributes:
The string buffer.
- buffer¶
The string buffer.
- NTTextDate: Final[int]¶
Date format equivalent to using the date format string
"ddd MMM d yyyy"
.See also
NTTime
,NTDate
andNTDateTime
.
- class NTTextStream¶
An interface for outputting text and mnemonics.
Each derived class uses a different output destination.
See also
NTTextBuffer
,NTTextStringBuffer
andNTVoidBuffer
.Attributes:
Prints the ascii column when passed to
printHex()
.Prints the unicode column when passed to
printHex()
.Methods:
_print
(s)Prints a string.
Returns the total number of characters in the stream.
Clears the prefix set by
setPrefix()
.Clears the text tags.
Returns the disassembly options.
doIndent
()Outputs indentation if necessary.
Outputs new-lines if necessary.
doPrefix
()Outputs the prefix if necessary.
enableIndent
(b)Enables or disables indentation.
enablePrefix
(b)Enables or disables prefix output.
enableTags
([b])Sets whether text tags are enabled.
endTag
()Ends a previously started text tag.
flush
()Appends pending new-lines.
getTags
()Returns the text tags.
iadd
(i)Adds
i
indentation units.
iget
()Retrieves the current number of indentation units.
Returns the size of a single indentation unit. The default is 1 space.
ireset
()Resets the current amount of indentation units.
iset
(i)Sets the current amount of indentation units.
isub
(i)Subtracts
i
indentation units.Returns the byte length of the last outputted line including indentation and prefix if any.
Returns the line count.
Returns the length of the last outputted line including indentation and prefix if any.
Returns the maximum amount of opcodes to be outputted.
nl
([i])Outputs one or more new-lines.
printHex
(bytes[, flags, base_offset])Prints
bytes
as hex view data.
printOpcodes
(b, instr_size, max_opcodes)Prints
instr_size
ormax_opcodes
ormaxOpcodes()
, whichever is less, opcodes out of aNTBuffer
instance.
reset
()Resets the internal state of the text stream.
setDisasmOptions
(options)Sets the disassembly options.
Sets the size of a single indentation unit.
Sets the maximum number of opcodes to output.
setPrefix
(p)Sets the prefix for each outputted line.
startTag
(type, data)Starts a text tag.
stateId
()Returns the current state id.
- HexPrint_Ascii: Final[int]¶
Prints the ascii column when passed to
printHex()
.See also
printHex()
.
- HexPrint_Unicode: Final[int]¶
Prints the unicode column when passed to
printHex()
.See also
printHex()
.
- _print(s: str) → None¶
Prints a string.
This method automatically handles new-lines when indentation or a prefix are set.
- Parameters
s (str) – The string to print.
See also
printHex()
andiadd()
.
- charCount() → int¶
- Returns
Returns the total number of characters in the stream.
- Return type
int
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
See also
lineLength()
.
- clearPrefix() → None¶
Clears the prefix set by
setPrefix()
.See also
setPrefix()
.
- clearTags() → None¶
Clears the text tags.
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
See also
enableTags()
andgetTags()
.
- disasmOptions() → int¶
- Returns
Returns the disassembly options.
- Return type
int
See also
setDisasmOptions()
.
- doIndent() → None¶
Outputs indentation if necessary.
This method is called internally and should not be called from the outside.
- doNewLines() → None¶
Outputs new-lines if necessary.
This method is called internally and should not be called from the outside.
- doPrefix() → None¶
Outputs the prefix if necessary.
This method is called internally and should not be called from the outside.
- enableIndent(b: bool) → None¶
Enables or disables indentation.
Indentation is enabled by default.
- Parameters
b (bool) – If
False
, disables indentation.See also
enablePrefix()
.
- enablePrefix(b: bool) → None¶
Enables or disables prefix output.
Output prefix is enabled by default.
- Parameters
b (bool) – If
False
, disables output prefix.See also
enableIndent()
.
- enableTags(b: bool = True) → None¶
Sets whether text tags are enabled.
- Parameters
b (bool) – If
True
, enables text tags; otherwise disables them.Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
See also
getTags()
,clearTags()
,startTag()
andendTag()
.
- endTag() → None¶
Ends a previously started text tag.
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
See also
startTag()
andenableTags()
.
- flush() → None¶
Appends pending new-lines.
- getTags() → Pro.Core.NTTextTags¶
- Returns
Returns the text tags.
- Return type
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
See also
enableTags()
andclearTags()
.
- iadd(i: int) → None¶
Adds
i
indentation units.This must not be confused with the size of a single indentation unit (see
setIndentSize()
).
- Parameters
i (int) – The number of indentation units to add.
See also
isub()
,iget()
,iset()
,ireset()
andsetIndentSize()
.
- iget() → int¶
Retrieves the current number of indentation units.
This must not be confused with the size of a single indentation unit (see
indentSize()
).
- Returns
Returns the current number of indentation units.
- Return type
int
See also
iset()
,iadd()
,isub()
,ireset()
andindentSize()
.
- indentSize() → int¶
- Returns
Returns the size of a single indentation unit. The default is 1 space.
- Return type
int
See also
setIndentSize()
.
- ireset() → None¶
Resets the current amount of indentation units.
See also
iset()
,iget()
,iadd()
,isub()
andsetIndentSize()
.
- iset(i: int) → None¶
Sets the current amount of indentation units.
This must not be confused with the size of a single indentation unit (see
setIndentSize()
).
- Parameters
i (int) – The amount of indentation units to set.
See also
iget()
,iadd()
,isub()
,ireset()
andsetIndentSize()
.
- isub(i: int) → None¶
Subtracts
i
indentation units.This must not be confused with the size of a single indentation unit (see
setIndentSize()
).
- Parameters
i (int) – The number of indentation units to subtract.
See also
iadd()
,iget()
,iset()
,ireset()
andsetIndentSize()
.
- lineByteLength() → int¶
- Returns
Returns the byte length of the last outputted line including indentation and prefix if any.
- Return type
int
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
See also
lineLength()
.
- lineCount() → int¶
- Returns
Returns the line count.
- Return type
int
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
See also
lineLength()
andcharCount()
.
- lineLength() → int¶
- Returns
Returns the length of the last outputted line including indentation and prefix if any.
- Return type
int
See also
lineCount()
,lineByteLength()
andcharCount()
.
- maxOpcodes() → int¶
- Returns
Returns the maximum amount of opcodes to be outputted.
- Return type
int
See also
setMaxOpcodes()
.
- nl(i: Optional[int] = None) → None¶
Outputs one or more new-lines.
- Parameters
i (Optional[int]) – The number of new-lines to output.
See also
_print()
.
- printHex(bytes: bytes, flags: int = HexPrint_Ascii, base_offset: int = 0) → None¶
Prints
bytes
as hex view data.
- Parameters
bytes (bytes) – The data to output.
flags (int) – The flags (see
HexPrint_Ascii
andHexPrint_Unicode
).base_offset (int) – The base offset.
See also
_print()
,HexPrint_Ascii
andHexPrint_Unicode
.
- printOpcodes(b: Pro.Core.NTBuffer, instr_size: int, max_opcodes: int) → bool¶
Prints
instr_size
ormax_opcodes
ormaxOpcodes()
, whichever is less, opcodes out of aNTBuffer
instance.
- Parameters
b (NTBuffer) – The data buffer.
instr_size (int) – The instruction size.
max_opcodes (int) – The maximum number of opcodes to print.
- Returns
Returns
True
if all the opcodes of the instruction could be printed; otherwise returnsFalse
.- Return type
bool
See also
setMaxOpcodes()
.
- reset() → None¶
Resets the internal state of the text stream.
- setDisasmOptions(options: int) → None¶
Sets the disassembly options.
These options are to be honoured by methods which output mnemonics to a text stream.
- Parameters
options (int) – The options to set.
See also
disasmOptions()
,DisasmOpt_Opcodes
andDisasmOpt_FileOffsets
.
- setIndentSize(g: int) → None¶
Sets the size of a single indentation unit.
The default is 1 space.
- Parameters
g (int) – The size of a single indentation unit.
See also
indentSize()
.
- setMaxOpcodes(n: int) → None¶
Sets the maximum number of opcodes to output.
This setting is to be honoured by methods which output opcodes to a text stream.
- Parameters
n (int) – The maximum number of opcodes.
See also
maxOpcodes()
.
- setPrefix(p: str) → None¶
Sets the prefix for each outputted line.
- Parameters
p (str) – The prefix.
See also
clearPrefix()
.
- startTag(type: int, data: int) → None¶
Starts a text tag.
- Parameters
type (int) – An unsigned 8-bit integer representing the type of the text tag.
data (int) – An unsigned 64-bit integer representing the data of the text tag.
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
See also
endTag()
andenableTags()
.
- class NTTextStringBuffer¶
Bases:
Pro.Core.NTTextStream
This is a class derived from
NTTextStream
.Internally this class uses a utf-16 string as buffer.
See also
NTTextStream
,NTTextBuffer
andNTVoidBuffer
.Attributes:
The string buffer.
- buffer¶
The string buffer.
- class NTTextTag¶
This class represents a single text tag.
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
Methods:
clear
()Clears the text tag data.
getIndex
()Returns the index of the tag in the list.
isHidden
()Returns
True
if the tag is hidden; otherwise returnsFalse
.
isNull
()Returns
True
if the tag is invalid; otherwise returnsFalse
.
isValid
()Returns
True
if the tag is valid; otherwise returnsFalse
.Attributes:
An unsigned 64-bit integer representing the data of the text tag.
The end column of the tag.
The end line of the tag.
The start column of the tag.
The start line of the tag.
An unsigned 8-bit integer representing the type of the text tag.
- clear() → None¶
Clears the text tag data.
- end_line¶
The end line of the tag.
See also
end_column
.
- getIndex() → int¶
- Returns
Returns the index of the tag in the list.
- Return type
int
- isHidden() → bool¶
- Returns
Returns
True
if the tag is hidden; otherwise returnsFalse
.- Return type
bool
- isNull() → bool¶
- Returns
Returns
True
if the tag is invalid; otherwise returnsFalse
.- Return type
bool
See also
isValid()
.
- isValid() → bool¶
- Returns
Returns
True
if the tag is valid; otherwise returnsFalse
.- Return type
bool
See also
isNull()
.
- start_column¶
The start column of the tag.
See also
start_line
.
- start_line¶
The start line of the tag.
See also
start_column
.
- class NTTextTags¶
This class represents a sorted list of text tags.
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
Methods:
addTag
(tag)Adds a new text tag.
clear
()Clears the tag list.
fromBytes
(buf)Converts a byte array previously created with See also
toBytes()
back to a tag list.
getClosestTag
(line, column)Retrieves the closest tag by specifying a line and column.
getTag
(line, column)Retrieves a tag by specifying a line and column.
getTagByTypeAndData
(type, data)Retrieves a tag by its type and data.
isNull
()Returns
True
if the tag list is invalid; otherwise returnsFalse
.
isValid
()Returns
True
if the tag list is valid; otherwise returnsFalse
.
sort
()Sorts the tags.
tagAt
(i)Retrieves a tag from the list by its index.
tagCount
()Returns the number of tags in the list.
toBytes
()Converts the tag list into a byte array.
- addTag(tag: Pro.Core.NTTextTag) → None¶
Adds a new text tag.
- Parameters
tag (NTTextTag) – The tag to add.
- clear() → None¶
Clears the tag list.
- static fromBytes(buf: bytes) → Pro.Core.NTTextTags¶
Converts a byte array previously created with See also
toBytes()
back to a tag list.
- Parameters
buf (bytes) – The input byte array.
- Returns
Returns the converted tag list.
- Return type
See also
toBytes()
.
- getClosestTag(line: int, column: int) → Pro.Core.NTTextTag¶
Retrieves the closest tag by specifying a line and column.
- Parameters
line (int) – The line.
column (int) – The column.
- Returns
Returns a valid tag if successful; otherwise returns an invalid
NTTextTag
instance.- Return type
See also
addTag()
,getTag()
andgetTagByTypeAndData()
.
- getTag(line: int, column: int) → Pro.Core.NTTextTag¶
Retrieves a tag by specifying a line and column.
- Parameters
line (int) – The line.
column (int) – The column.
- Returns
Returns a valid tag if successful; otherwise returns an invalid
NTTextTag
instance.- Return type
See also
addTag()
,getClosestTag()
andgetTagByTypeAndData()
.
- getTagByTypeAndData(type: int, data: int) → Pro.Core.NTTextTag¶
Retrieves a tag by its type and data.
- Parameters
type (int) – The 8-bit unsigned integer tag type.
data (int) – The 64-bit unsigned integer tag data.
- Returns
Returns a valid tag if successful; otherwise returns an invalid
NTTextTag
instance.- Return type
See also
getTag()
,getClosestTag()
andaddTag()
.
- isNull() → bool¶
- Returns
Returns
True
if the tag list is invalid; otherwise returnsFalse
.- Return type
bool
See also
isValid()
.
- isValid() → bool¶
- Returns
Returns
True
if the tag list is valid; otherwise returnsFalse
.- Return type
bool
See also
isNull()
.
- sort() → None¶
Sorts the tags.
- tagAt(i: int) → Pro.Core.NTTextTag¶
Retrieves a tag from the list by its index.
- Parameters
i (int) – The index of the tag to retrieve.
- Returns
Returns a valid tag if successful; otherwise returns an invalid
NTTextTag
instance.- Return type
See also
tagCount()
.
- toBytes() → bytes¶
Converts the tag list into a byte array.
- Returns
Returns the byte array.
- Return type
bytes
See also
fromBytes()
.
- NTThursday: Final[int]¶
Fourth day of the week.
See also
NTDate.dayOfWeek()
.
- class NTTime(h: Optional[int] = None, m: Optional[int] = None, s: int = 0, ms: int = 0)¶
This class provides clock time functionality.
Optionally initializes a time object from the input parameters.
- Parameters
h (Optional[int]) – The hour.
m (Optional[int]) – The minute.
s (int) – The second.
ms (int) – The milliseconds.
See also
NTDate
andNTDateTime
.Methods:
addMSecs
(ms)Adds
ms
milliseconds to the time of this class.
addSecs
(s)Adds
s
seconds to the time of this class.Returns the current time as reported by the system clock.
elapsed
()
fromMSecsSinceStartOfDay
(msecs)Returns a new
NTTime
instance with the time set to the number of milliseconds since the start of the day, i.e. since 00:00:00.
fromString
(string[, format])Returns the time represented in the string as an
NTTime
using the format given, or an invalid time if this is not possible.
hour
()Returns the hour part (0 to 23) of the time. Returns -1 if the time is invalid.
isNull
()Returns
True
if the time is invalid; otherwise returnsFalse
.
isValid
()Checks the validity of the current time object.
minute
()Returns the minute part (0 to 59) of the time. Returns -1 if the time is invalid.
msec
()Returns the millisecond part (0 to 999) of the time. Returns -1 if the time is invalid.
Returns the number of msecs since the start of the day, i.e. since 00:00:00.
msecsTo
(t)Returns the number of milliseconds from this time to
t
.
restart
()
second
()Returns the second part (0 to 59) of the time. Returns -1 if the time is invalid.
secsTo
(t)Returns the number of seconds from this time to
t
.
setHMS
(h, m, s[, ms])Sets the time given hour, minute, second and millisecond parameters.
start
()
toString
([format])Converts the time to a string.
- addMSecs(ms: int) → Pro.Core.NTTime¶
Adds
ms
milliseconds to the time of this class.
- Parameters
ms (int) – The number of milliseconds to add. This value can be negative.
- Returns
Returns a new
NTTime
instance.- Return type
See also
addSecs()
,msecsTo()
andNTDateTime.addMSecs()
.
- addSecs(s: int) → Pro.Core.NTTime¶
Adds
s
seconds to the time of this class.
- Parameters
s (int) – The number of seconds to add. This value can be negative.
- Returns
Returns a new
NTTime
instance.- Return type
See also
addMSecs()
,secsTo()
andNTDateTime.addSecs()
.
- static currentTime() → Pro.Core.NTTime¶
- Returns
Returns the current time as reported by the system clock.
- Return type
See also
NTDateTime.currentDateTime()
andNTDateTime.currentDateTimeUtc()
.
- elapsed() → int¶
Warning
This method is deprecated. Use the faster
NTTimer
class instead.Measures the number of milliseconds that have elapsed since the last time
start()
orrestart()
was called.
- Returns
Returns the number of milliseconds that have elapsed
- Return type
int
- static fromMSecsSinceStartOfDay(msecs: int) → Pro.Core.NTTime¶
Returns a new
NTTime
instance with the time set to the number of milliseconds since the start of the day, i.e. since 00:00:00.
- Parameters
msecs (int) – The number of milliseconds.
- Returns
Returns a new
NTTime
instance.- Return type
See also
msecsSinceStartOfDay()
.
- static fromString(string: str, format: Union[NTDateFormat, str] = NTTextDate) → NTTime¶
Returns the time represented in the string as an
NTTime
using the format given, or an invalid time if this is not possible.
- Parameters
string (str) – The time string.
format (Union[NTDateFormat, str]) – The format of the time string.
- Returns
Returns a new
NTTime
instance.- Return type
See also
toString()
.
- hour() → int¶
- Returns
Returns the hour part (0 to 23) of the time. Returns -1 if the time is invalid.
- Return type
int
- isNull() → bool¶
- Returns
Returns
True
if the time is invalid; otherwise returnsFalse
.- Return type
bool
See also
isValid()
.
- isValid() → bool¶
Checks the validity of the current time object.
- Returns
Returns
True
if the time is valid; otherwise returnsFalse
.- Return type
bool
See also
isNull()
.
- minute() → int¶
- Returns
Returns the minute part (0 to 59) of the time. Returns -1 if the time is invalid.
- Return type
int
- msec() → int¶
- Returns
Returns the millisecond part (0 to 999) of the time. Returns -1 if the time is invalid.
- Return type
int
- msecsSinceStartOfDay() → int¶
- Returns
Returns the number of msecs since the start of the day, i.e. since 00:00:00.
- Return type
int
See also
fromMSecsSinceStartOfDay()
.
- msecsTo(t: Pro.Core.NTTime) → int¶
Returns the number of milliseconds from this time to
t
. Ift
is earlier than this time, the number of milliseconds returned is negative.Because
NTTime
measures time within a day and there are 86400 seconds in a day, the result is always between -86400000 and 86400000 ms.Returns 0 if either time is invalid.
- Parameters
t (NTTime) – The time to measure the difference in milliseconds from.
- Returns
Returns the difference of time in milliseconds.
- Return type
int
See also
secsTo()
,addMSecs()
andNTDateTime.msecsTo()
.
- restart() → int¶
Warning
This method is deprecated. Use the faster
NTTimer
class instead.Sets this time to the current time and returns the number of milliseconds that have elapsed since the last time
start()
orrestart()
was called.This function is guaranteed to be atomic and is thus very handy for repeated measurements. Call
start()
to start the first measurement, andrestart()
for each later measurement.Note that the counter wraps to zero 24 hours after the last call to
start()
orrestart()
.
- Returns
Returns the elapsed time in milliseconds from when
start()
was called.- Return type
int
See also
start()
,elapsed()
andcurrentTime()
.
- second() → int¶
- Returns
Returns the second part (0 to 59) of the time. Returns -1 if the time is invalid.
- Return type
int
- secsTo(t: Pro.Core.NTTime) → int¶
Returns the number of seconds from this time to
t
. Ift
is earlier than this time, the number of seconds returned is negative.Because
NTTime
measures time within a day and there are 86400 seconds in a day, the result is always between -86400 and 86400.This method does not take into account any milliseconds.
Returns 0 if either time is invalid.
- Parameters
t (NTTime) – The time to measure the difference in seconds from.
- Returns
Returns the difference of time in seconds.
- Return type
int
See also
addSecs()
, andNTDateTime.secsTo()
.
- setHMS(h: int, m: int, s: int, ms: int = 0) → bool¶
Sets the time given hour, minute, second and millisecond parameters.
- Parameters
h (int) – The hour. Must be in the range 0 to 23.
m (int) – The minute. Must be in the range 0 to 59.
s (int) – The second. Must be in the range 0 to 59.
ms (int) – The millisecond. Must be in the range 0 to 999.
- Returns
Returns
True
if the set time is valid; otherwise returnsFalse
.- Return type
bool
See also
isValid()
.
- start() → None¶
Warning
This method is deprecated for timing purposes. Use the faster
NTTimer
class instead.Sets this time to the current time.
- toString(format: Union[NTDateFormat, str] = NTTextDate) → str¶
Converts the time to a string. The
format
parameter determines the format of the string.
- Parameters
format (Union[NTDateFormat, str]) – The format of the time.
- Returns
Returns the time as a string.
- Return type
str
See also
fromString()
,NTDate.toString()
andNTDateTime.toString()
.
- NTTimeZone: Final[int]¶
A named time zone.
See also
NTDateTime
.
- class NTTimer¶
This class implements a fast milliseconds timer based on
NT_GetTickCount()
.Available since Cerbero Suite 6.1 and Cerbero Engine 3.1.
Methods:
elapsed
()Returns the time passed up until now in milliseconds.
restart
()Restarts the timer.
start
()Starts the timer.
- elapsed() → int¶
- Returns
Returns the time passed up until now in milliseconds.
- Return type
int
- restart() → int¶
Restarts the timer.
- Returns
Returns the time passed up until now in milliseconds.
- Return type
int
- NTTuesday: Final[int]¶
Second day of the week.
See also
NTDate.dayOfWeek()
.
- class NTUInt64List¶
List of
int
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: int) → None¶
Inserts
value
at the end of the list.
- Parameters
value (int) – The value to add to the list.
See also
insert()
.
- at(i: int) → int¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
int
- clear() → None¶
Removes all items from the list.
- contains(value: int) → bool¶
Checks the presence of an element in the list.
- Parameters
value (int) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: int) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (int) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: int, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (int) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: int) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (int) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTUInt64ListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: int) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (int) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → int¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
int
See also
removeAt()
.
- class NTUInt64ListIt(obj: Pro.Core.NTUInt64List)¶
Iterator class for
NTUInt64List
.
- Parameters
obj (NTUInt64List) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → int¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
int
See also
hasNext()
andprevious()
.
- previous() → int¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
int
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class NTUInt64UIntHash¶
Dictionary of
int
->int
elements.Methods:
clear
()Removes all items from the hash.
contains
(key)Checks whether
key
is present in the hash.
count
(key)Counts the numbers of values associated with
key
in the hash.
insert
(key, value)Inserts a new item with
key
and a value ofvalue
.
insertMulti
(key, value)Inserts a new item with
key
and a value ofvalue
.
isEmpty
()Checks whether the hash is empty.
iterator
()Creates an iterator for the hash.
remove
(key)Removes all the items that have
key
from the hash.
reserve
(alloc)Ensures that the internal hash table consists of at least
size
buckets.
size
()Returns the number of items in the hash.
take
(key)Removes the item with
key
from the hash and returns the value associated with it.
value
(key[, defaultValue])Returns the value associated with
key
.
- clear() → None¶
Removes all items from the hash.
- contains(key: int) → bool¶
Checks whether
key
is present in the hash.
- Parameters
key (int) – The key value to check for.
- Returns
Returns
True
if the hash contains an item with the key; otherwise returnsFalse
.- Return type
bool
See also
count()
.
- count(key: int) → int¶
Counts the numbers of values associated with
key
in the hash.
- Parameters
key (int) – The key value.
- Returns
Returns the number of items associated with the key.
- Return type
int
See also
contains()
.
- insert(key: int, value: int) → None¶
Inserts a new item with
key
and a value ofvalue
.
- Parameters
key (int) – The key.
value (int) – The value.
See also
insertMulti()
.
- insertMulti(key: int, value: int) → None¶
Inserts a new item with
key
and a value ofvalue
.If there is already an item with the same key in the hash, this method will simply create a new one. (This behaviour is different from
insert()
, which overwrites the value of an existing item.)
- Parameters
key (int) – The key.
value (int) – The value.
See also
insert()
.
- isEmpty() → bool¶
Checks whether the hash is empty.
- Returns
Returns
True
if the hash contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTUInt64UIntHashIt¶
Creates an iterator for the hash.
- Returns
Returns the iterator.
- Return type
- remove(key: int) → int¶
Removes all the items that have
key
from the hash.
- Parameters
key (int) – The key to remove.
- Returns
Returns the number of items removed which is usually
1
but will be0
if the key isn’t in the hash, or greater than1
ifinsertMulti()
has been used with the key.- Return type
int
- reserve(alloc: int) → None¶
Ensures that the internal hash table consists of at least
size
buckets.
- Parameters
alloc (int) – The allocation size.
- size() → int¶
- Returns
Returns the number of items in the hash.
- Return type
int
- take(key: int) → int¶
Removes the item with
key
from the hash and returns the value associated with it.If the item does not exist in the hash, the method simply returns a default-constructed value. If there are multiple items for key in the hash, only the most recently inserted one is removed.
If you don’t use the return value,
remove()
is more efficient.
- Parameters
key (int) – The key.
- Returns
Returns the removed value.
- Return type
int
See also
remove()
.
- value(key: int, defaultValue: Optional[int] = None) → int¶
Returns the value associated with
key
. If the hash contains no item withkey
, the method returns a default-constructed value ifdefaultValue
is not provided. If there are multiple items forkey
in the hash, the value of the most recently inserted one is returned.
- Parameters
key (int) – The key.
defaultValue (Optional[int]) – The default value to return if
key
is not present in the hash.- Returns
Returns the value associated with
key
.- Return type
int
See also
contains()
.
- class NTUInt64UIntHashIt(obj: Pro.Core.NTUInt64UIntHash)¶
Iterator class for
NTUInt64UIntHash
.
- Parameters
obj (NTUInt64UIntHash) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
key
()Returns the key of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
value
()Returns the value of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- key() → int¶
- Returns
Returns the key of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).- Return type
int
See also
value()
.
- next() → None¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
tuple[int, int]
See also
hasNext()
andprevious()
.
- previous() → None¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
tuple[int, int]
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- toFront() → None¶
Moves the iterator to the front of the container (before the first item).
- value() → int¶
- Returns
Returns the value of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).- Return type
int
See also
key()
.
- class NTUIntList¶
List of
int
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: int) → None¶
Inserts
value
at the end of the list.
- Parameters
value (int) – The value to add to the list.
See also
insert()
.
- at(i: int) → int¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
int
- clear() → None¶
Removes all items from the list.
- contains(value: int) → bool¶
Checks the presence of an element in the list.
- Parameters
value (int) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: int) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (int) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: int, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (int) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: int) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (int) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTUIntListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: int) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (int) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → int¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
int
See also
removeAt()
.
- class NTUIntListIt(obj: Pro.Core.NTUIntList)¶
Iterator class for
NTUIntList
.
- Parameters
obj (NTUIntList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → int¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
int
See also
hasNext()
andprevious()
.
- previous() → int¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
int
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class NTUIntTree¶
Tree of
NTUIntTreeNode
nodes.Methods:
appendChild
(parent, value)Adds a node to the children of the specified parent node.
children
(parent)Returns the number of child nodes for the specified parent node.
childrenList
(parent)Returns the list of child nodes for the specified parent node.
clear
()Removes all nodes from the tree.
clearChildren
(parent)Removes all the child nodes of the specified parent node.
enableIDs
(b)Enables id-based look-up for nodes.
insertChild
(parent, pos, value)Inserts a new node into the list of child nodes of the specified parent node at a given position.
nextNode
(node)Retrieves the next node starting from
node
.
nextSibling
(node)Returns the next sibling of a node.
node
(nid_or_parent[, pos])Returns a node given a parent and a child index or, alternatively, given a node id.
nodeId
(node)Returns the node id for the specified node.
parentNode
(node)Retrieves the parent node for the specified node.
position
(node)Returns the position of the specified node related its siblings.
prependChild
(parent, value)Prepends a node to the children of the specified parent node.
previousNode
(node)Retrieves the previous node starting from
node
.
previousSibling
(node)Returns the previous sibling of a node.
remove
(node)Removes a node from the tree.
removeChild
(parent, pos)Removes a child node at a specified position.
siblings
(node)Returns the number of siblings of the specified node.
sortChildren
(parent[, pos, count])Sorts a level of the tree.
swap
(node, newPos)Swaps two sibling nodes.
- appendChild(parent: Pro.Core.NTUIntTreeNode, value: int) → Pro.Core.NTUIntTreeNode¶
Adds a node to the children of the specified parent node.
- Parameters
parent (NTUIntTreeNode) – The parent node. This value can be
None
to add a root-level node.value (int) – The value of the new node.
- Returns
Returns the newly created node.
- Return type
See also
prependChild()
andinsertChild()
.
- children(parent: Pro.Core.NTUIntTreeNode) → int¶
Returns the number of child nodes for the specified parent node.
- Parameters
parent (NTUIntTreeNode) – The parent node. This value can be
None
to retrieve the number of root-level nodes.- Returns
Returns the number of child nodes.
- Return type
int
See also
childrenList()
,siblings()
andparentNode()
.
- childrenList(parent: Pro.Core.NTUIntTreeNode) → Pro.Core.NTUIntTreeNodeList¶
Returns the list of child nodes for the specified parent node.
- Parameters
parent (NTUIntTreeNode) – The parent node. This value can be
None
to retrieve the list of root-level nodes.- Returns
Returns the list of child nodes.
- Return type
See also
children()
,siblings()
andparentNode()
.
- clear() → None¶
Removes all nodes from the tree.
See also
clearChildren()
.
- clearChildren(parent: Pro.Core.NTUIntTreeNode) → None¶
Removes all the child nodes of the specified parent node.
- Parameters
parent (NTUIntTreeNode) – The parent node.
See also
clear()
.
- enableIDs(b: bool) → None¶
Enables id-based look-up for nodes. This method must be called before adding nodes to the tree. By default id-based look-up is not enabled.
- Parameters
b (bool) – Must be
True
to enable id-based look-up.
- insertChild(parent: Pro.Core.NTUIntTreeNode, pos: int, value: int) → Pro.Core.NTUIntTreeNode¶
Inserts a new node into the list of child nodes of the specified parent node at a given position.
- Parameters
parent (NTUIntTreeNode) – The parent node. This value can be
None
to insert a root-level node.pos (int) – The position where to insert the child node. An value of 0 is the same as calling
prependChild()
. A value ofchildren()
is the same as callingappendChild()
.value (int) – The value of the new node.
- Returns
Returns the newly created node.
- Return type
See also
appendChild()
andprependChild()
.
- nextNode(node: Pro.Core.NTUIntTreeNode) → Pro.Core.NTUIntTreeNode¶
Retrieves the next node starting from
node
.The difference with
nextSibling()
is that this method also enumerates child nodes.
- Parameters
node (NTUIntTreeNode) – The current node. This parameter can be
None
to start from the first root node of the tree.- Returns
Returns the next node if available; otherwise returns
None
.- Return type
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
See also
previousNode()
.
- nextSibling(node: Pro.Core.NTUIntTreeNode) → Pro.Core.NTUIntTreeNode¶
Returns the next sibling of a node.
- Parameters
node (NTUIntTreeNode) – The node for which to retrieve the sibling.
- Returns
Returns the sibling node if available; otherwise returns
None
.- Return type
Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.
See also
previousSibling()
.
- node(nid_or_parent: Union[Pro.Core.NTUIntTreeNode, int], pos: Optional[int] = None) → Pro.Core.NTUIntTreeNode¶
Returns a node given a parent and a child index or, alternatively, given a node id. To retrieve nodes by id,
enableIDs()
must have been called first.
- Parameters
nid_or_parent (Union[NTUIntTreeNode, int]) – Can be either a parent node or a node id.
pos (Optional[int]) – The child index. This parameter can be used only when a parent node is specified.
- Returns
Returns the requested node. If the node couldn’t be found, the return value is
None
.- Return type
See also
enableIDs()
.
- nodeId(node: Pro.Core.NTUIntTreeNode) → int¶
Returns the node id for the specified node.
enableIDs()
must have been called first in order for nodes to have valid ids.
- Parameters
node (NTUIntTreeNode) – The node for which to retrieve the node id.
- Returns
Returns the node id.
- Return type
int
See also
enableIDs()
andnode()
.
- parentNode(node: Pro.Core.NTUIntTreeNode) → Pro.Core.NTUIntTreeNode¶
Retrieves the parent node for the specified node.
- Parameters
node (NTUIntTreeNode) – The node for which to retrieve the parent node.
- Returns
Returns the parent node. If the specified node is a root-level node, then the method returns
None
.- Return type
See also
childrenList()
andnode()
.
- position(node: Pro.Core.NTUIntTreeNode) → int¶
Returns the position of the specified node related its siblings.
- Parameters
node (NTUIntTreeNode) – The node for which to retrieve the position. This value can be
None
to retrieve the position of a root-level node.- Returns
Returns the index position.
- Return type
int
See also
children()
andsiblings()
.
- prependChild(parent: Pro.Core.NTUIntTreeNode, value: int) → Pro.Core.NTUIntTreeNode¶
Prepends a node to the children of the specified parent node.
- Parameters
parent (NTUIntTreeNode) – The parent node. This value can be
None
to prepend a root-level node.value (int) – The value of the new node.
- Returns
Returns the newly created node.
- Return type
See also
appendChild()
andinsertChild()
.
- previousNode(node: Pro.Core.NTUIntTreeNode) → Pro.Core.NTUIntTreeNode¶
Retrieves the previous node starting from
node
.The difference with
previousSibling()
is that this method also enumerates child nodes.
- Parameters
node (NTUIntTreeNode) – The current node. This parameter can be
None
to start from the last child of the tree.- Returns
Returns the previous node if available; otherwise returns
None
.- Return type
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
See also
nextNode()
.
- previousSibling(node: Pro.Core.NTUIntTreeNode) → Pro.Core.NTUIntTreeNode¶
Returns the previous sibling of a node.
- Parameters
node (NTUIntTreeNode) – The node for which to retrieve the sibling.
- Returns
Returns the sibling node if available; otherwise returns
None
.- Return type
Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.
See also
nextSibling()
.
- remove(node: Pro.Core.NTUIntTreeNode) → None¶
Removes a node from the tree.
- Parameters
node (NTUIntTreeNode) – The node to remove.
See also
removeChild()
.
- removeChild(parent: Pro.Core.NTUIntTreeNode, pos: int) → None¶
Removes a child node at a specified position.
- Parameters
parent (NTUIntTreeNode) – The parent node. This value can be
None
to remove a root-level node.pos (int) – The index of the child to remove.
See also
remove()
.
- siblings(node: Pro.Core.NTUIntTreeNode) → int¶
Returns the number of siblings of the specified node.
- Parameters
node (NTUIntTreeNode) – The node for which to get the number of siblings.
- Returns
Returns the number of siblings.
- Return type
int
See also
children()
andchildrenList()
.
- sortChildren(parent: Pro.Core.NTUIntTreeNode, pos: Optional[int] = None, count: Optional[int] = None) → None¶
Sorts a level of the tree.
- Parameters
parent (NTUIntTreeNode) – The parent node.
pos (Optional[int]) – The position of the child nodes to sort.
count (Optional[int]) – The number of child nodes to sort.
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
- swap(node: Pro.Core.NTUIntTreeNode, newPos: int) → None¶
Swaps two sibling nodes.
- Parameters
node (NTUIntTreeNode) – One of the nodes to swap.
newPos (int) – The new position at which to place the specified node.
See also
children()
andsiblings()
.
- class NTUIntTreeNode¶
This class represents a node of
NTUIntTree
.Attributes:
A
NTUIntTreeNodeList
list of children nodes.”The node id.
The parent node.
The position of the node relative to its parent.
The
int
value of the node.Methods:
Returns
True
if the node has a parent; otherwise returnsFalse
.
- children¶
A
NTUIntTreeNodeList
list of children nodes.”See also
NTUIntTree.childrenList()
.
- hasParent() → bool¶
- Returns
Returns
True
if the node has a parent; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
See also
parent
andNTUIntTree.parentNode()
.
- nid¶
The node id.
See also
NTUIntTree.nodeId()
andNTUIntTree.enableIDs()
.
- parent¶
The parent node.
See also
hasParent()
andNTUIntTree.parentNode()
.
- pos¶
The position of the node relative to its parent.
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
See also
NTUIntTree.position()
.
- value¶
The
int
value of the node.
- class NTUIntTreeNodeList¶
List of
NTUIntTreeNode
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: Pro.Core.NTUIntTreeNode) → None¶
Inserts
value
at the end of the list.
- Parameters
value (NTUIntTreeNode) – The value to add to the list.
See also
insert()
.
- at(i: int) → Pro.Core.NTUIntTreeNode¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
- clear() → None¶
Removes all items from the list.
- contains(value: Pro.Core.NTUIntTreeNode) → bool¶
Checks the presence of an element in the list.
- Parameters
value (NTUIntTreeNode) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: Pro.Core.NTUIntTreeNode) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (NTUIntTreeNode) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: Pro.Core.NTUIntTreeNode, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (NTUIntTreeNode) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: Pro.Core.NTUIntTreeNode) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (NTUIntTreeNode) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTUIntTreeNodeListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: Pro.Core.NTUIntTreeNode) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (NTUIntTreeNode) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → Pro.Core.NTUIntTreeNode¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
See also
removeAt()
.
- class NTUIntTreeNodeListIt(obj: Pro.Core.NTUIntTreeNodeList)¶
Iterator class for
NTUIntTreeNodeList
.
- Parameters
obj (NTUIntTreeNodeList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → Pro.Core.NTUIntTreeNode¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
See also
hasNext()
andprevious()
.
- previous() → Pro.Core.NTUIntTreeNode¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class NTUIntVector¶
Vector list of
int
elements. The difference with normal lists is that vector lists are contiguous in memory.Methods:
append
(value)Inserts
value
at the end of the vector.
at
(i)Returns the item at index position
i
in the vector.
clear
()Removes all the elements from the vector and releases the memory used by the vector.
contains
(value)Checks the presence of an element in the vector.
count
(value)Returns the number of occurrences of
value
in the vector.
indexOf
(value[, start])Searches for an element in the vector.
insert
(i, value)Inserts
value
at index positioni
in the vector.
isEmpty
()Checks whether the vector is empty.
iterator
()Creates an iterator for the vector.
reserve
(alloc)Reserve space for
alloc
elements.
resize
(size)Sets the size of the vector to
size
.
size
()Returns the number of items in the vector.
- append(value: int) → None¶
Inserts
value
at the end of the vector.
- Parameters
value (int) – The value to add to the list.
See also
insert()
.
- at(i: int) → int¶
Returns the item at index position
i
in the vector.i
must be a valid index position in the vector (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
int
- clear() → None¶
Removes all the elements from the vector and releases the memory used by the vector.
- contains(value: int) → bool¶
Checks the presence of an element in the vector.
- Parameters
value (int) – The value to check for.
- Returns
Returns
True
if the vector contains an occurrence of value; otherwise returnsFalse
.- Return type
bool
- count(value: int) → int¶
Returns the number of occurrences of
value
in the vector.
- Parameters
value (int) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: int, start: int = 0) → int¶
Searches for an element in the vector.
- Parameters
value (int) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the vector. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: int) → None¶
Inserts
value
at index positioni
in the vector. Ifi
is0
, the value is prepended to the vector. Ifi
issize()
, the value is appended to the vector.
- Parameters
i (int) – The position at which to add the value.
value (int) – The value to add.
See also
append()
.
- isEmpty() → bool¶
Checks whether the vector is empty.
- Returns
Returns
True
if the vector contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTUIntVectorIt¶
Creates an iterator for the vector.
- Returns
Returns the iterator.
- Return type
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the vector.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- resize(size: int) → None¶
Sets the size of the vector to
size
. Ifsize
is greater than the current size, elements are added to the end; the new elements are initialized with a default-constructed value. Ifsize
is less than the current size, elements are removed from the end.
- Parameters
size (int) – The new size of the vector.
See also
size()
.
- class NTUIntVectorIt(obj: Pro.Core.NTUIntVector)¶
Iterator class for
NTUIntVector
.
- Parameters
obj (NTUIntVector) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → int¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
int
See also
hasNext()
andprevious()
.
- previous() → int¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
int
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class NTUShortUShortHash¶
Dictionary of
int
->int
elements.Methods:
clear
()Removes all items from the hash.
contains
(key)Checks whether
key
is present in the hash.
count
(key)Counts the numbers of values associated with
key
in the hash.
insert
(key, value)Inserts a new item with
key
and a value ofvalue
.
insertMulti
(key, value)Inserts a new item with
key
and a value ofvalue
.
isEmpty
()Checks whether the hash is empty.
iterator
()Creates an iterator for the hash.
remove
(key)Removes all the items that have
key
from the hash.
reserve
(alloc)Ensures that the internal hash table consists of at least
size
buckets.
size
()Returns the number of items in the hash.
take
(key)Removes the item with
key
from the hash and returns the value associated with it.
value
(key[, defaultValue])Returns the value associated with
key
.
- clear() → None¶
Removes all items from the hash.
- contains(key: int) → bool¶
Checks whether
key
is present in the hash.
- Parameters
key (int) – The key value to check for.
- Returns
Returns
True
if the hash contains an item with the key; otherwise returnsFalse
.- Return type
bool
See also
count()
.
- count(key: int) → int¶
Counts the numbers of values associated with
key
in the hash.
- Parameters
key (int) – The key value.
- Returns
Returns the number of items associated with the key.
- Return type
int
See also
contains()
.
- insert(key: int, value: int) → None¶
Inserts a new item with
key
and a value ofvalue
.
- Parameters
key (int) – The key.
value (int) – The value.
See also
insertMulti()
.
- insertMulti(key: int, value: int) → None¶
Inserts a new item with
key
and a value ofvalue
.If there is already an item with the same key in the hash, this method will simply create a new one. (This behaviour is different from
insert()
, which overwrites the value of an existing item.)
- Parameters
key (int) – The key.
value (int) – The value.
See also
insert()
.
- isEmpty() → bool¶
Checks whether the hash is empty.
- Returns
Returns
True
if the hash contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTUShortUShortHashIt¶
Creates an iterator for the hash.
- Returns
Returns the iterator.
- Return type
- remove(key: int) → int¶
Removes all the items that have
key
from the hash.
- Parameters
key (int) – The key to remove.
- Returns
Returns the number of items removed which is usually
1
but will be0
if the key isn’t in the hash, or greater than1
ifinsertMulti()
has been used with the key.- Return type
int
- reserve(alloc: int) → None¶
Ensures that the internal hash table consists of at least
size
buckets.
- Parameters
alloc (int) – The allocation size.
- size() → int¶
- Returns
Returns the number of items in the hash.
- Return type
int
- take(key: int) → int¶
Removes the item with
key
from the hash and returns the value associated with it.If the item does not exist in the hash, the method simply returns a default-constructed value. If there are multiple items for key in the hash, only the most recently inserted one is removed.
If you don’t use the return value,
remove()
is more efficient.
- Parameters
key (int) – The key.
- Returns
Returns the removed value.
- Return type
int
See also
remove()
.
- value(key: int, defaultValue: Optional[int] = None) → int¶
Returns the value associated with
key
. If the hash contains no item withkey
, the method returns a default-constructed value ifdefaultValue
is not provided. If there are multiple items forkey
in the hash, the value of the most recently inserted one is returned.
- Parameters
key (int) – The key.
defaultValue (Optional[int]) – The default value to return if
key
is not present in the hash.- Returns
Returns the value associated with
key
.- Return type
int
See also
contains()
.
- class NTUShortUShortHashIt(obj: Pro.Core.NTUShortUShortHash)¶
Iterator class for
NTUShortUShortHash
.
- Parameters
obj (NTUShortUShortHash) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
key
()Returns the key of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
value
()Returns the value of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- key() → int¶
- Returns
Returns the key of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).- Return type
int
See also
value()
.
- next() → None¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
tuple[int, int]
See also
hasNext()
andprevious()
.
- previous() → None¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
tuple[int, int]
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- toFront() → None¶
Moves the iterator to the front of the container (before the first item).
- value() → int¶
- Returns
Returns the value of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).- Return type
int
See also
key()
.
- class NTUShortVector¶
Vector list of
int
elements. The difference with normal lists is that vector lists are contiguous in memory.Methods:
append
(value)Inserts
value
at the end of the vector.
at
(i)Returns the item at index position
i
in the vector.
clear
()Removes all the elements from the vector and releases the memory used by the vector.
contains
(value)Checks the presence of an element in the vector.
count
(value)Returns the number of occurrences of
value
in the vector.
indexOf
(value[, start])Searches for an element in the vector.
insert
(i, value)Inserts
value
at index positioni
in the vector.
isEmpty
()Checks whether the vector is empty.
iterator
()Creates an iterator for the vector.
reserve
(alloc)Reserve space for
alloc
elements.
resize
(size)Sets the size of the vector to
size
.
size
()Returns the number of items in the vector.
- append(value: int) → None¶
Inserts
value
at the end of the vector.
- Parameters
value (int) – The value to add to the list.
See also
insert()
.
- at(i: int) → int¶
Returns the item at index position
i
in the vector.i
must be a valid index position in the vector (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
int
- clear() → None¶
Removes all the elements from the vector and releases the memory used by the vector.
- contains(value: int) → bool¶
Checks the presence of an element in the vector.
- Parameters
value (int) – The value to check for.
- Returns
Returns
True
if the vector contains an occurrence of value; otherwise returnsFalse
.- Return type
bool
- count(value: int) → int¶
Returns the number of occurrences of
value
in the vector.
- Parameters
value (int) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: int, start: int = 0) → int¶
Searches for an element in the vector.
- Parameters
value (int) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the vector. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: int) → None¶
Inserts
value
at index positioni
in the vector. Ifi
is0
, the value is prepended to the vector. Ifi
issize()
, the value is appended to the vector.
- Parameters
i (int) – The position at which to add the value.
value (int) – The value to add.
See also
append()
.
- isEmpty() → bool¶
Checks whether the vector is empty.
- Returns
Returns
True
if the vector contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTUShortVectorIt¶
Creates an iterator for the vector.
- Returns
Returns the iterator.
- Return type
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the vector.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- resize(size: int) → None¶
Sets the size of the vector to
size
. Ifsize
is greater than the current size, elements are added to the end; the new elements are initialized with a default-constructed value. Ifsize
is less than the current size, elements are removed from the end.
- Parameters
size (int) – The new size of the vector.
See also
size()
.
- class NTUShortVectorIt(obj: Pro.Core.NTUShortVector)¶
Iterator class for
NTUShortVector
.
- Parameters
obj (NTUShortVector) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → int¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
int
See also
hasNext()
andprevious()
.
- previous() → int¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
int
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- NTUTC: Final[int]¶
Coordinated Universal Time.
See also
NTDateTime
.
- class NTUTF8StringHash¶
Dictionary of
str
->str
elements.Methods:
clear
()Removes all items from the hash.
contains
(key)Checks whether
key
is present in the hash.
count
(key)Counts the numbers of values associated with
key
in the hash.
insert
(key, value)Inserts a new item with
key
and a value ofvalue
.
insertMulti
(key, value)Inserts a new item with
key
and a value ofvalue
.
isEmpty
()Checks whether the hash is empty.
iterator
()Creates an iterator for the hash.
remove
(key)Removes all the items that have
key
from the hash.
reserve
(alloc)Ensures that the internal hash table consists of at least
size
buckets.
size
()Returns the number of items in the hash.
take
(key)Removes the item with
key
from the hash and returns the value associated with it.
value
(key[, defaultValue])Returns the value associated with
key
.
- clear() → None¶
Removes all items from the hash.
- contains(key: str) → bool¶
Checks whether
key
is present in the hash.
- Parameters
key (str) – The key value to check for.
- Returns
Returns
True
if the hash contains an item with the key; otherwise returnsFalse
.- Return type
bool
See also
count()
.
- count(key: str) → int¶
Counts the numbers of values associated with
key
in the hash.
- Parameters
key (str) – The key value.
- Returns
Returns the number of items associated with the key.
- Return type
int
See also
contains()
.
- insert(key: str, value: str) → None¶
Inserts a new item with
key
and a value ofvalue
.
- Parameters
key (str) – The key.
value (str) – The value.
See also
insertMulti()
.
- insertMulti(key: str, value: str) → None¶
Inserts a new item with
key
and a value ofvalue
.If there is already an item with the same key in the hash, this method will simply create a new one. (This behaviour is different from
insert()
, which overwrites the value of an existing item.)
- Parameters
key (str) – The key.
value (str) – The value.
See also
insert()
.
- isEmpty() → bool¶
Checks whether the hash is empty.
- Returns
Returns
True
if the hash contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTUTF8StringHashIt¶
Creates an iterator for the hash.
- Returns
Returns the iterator.
- Return type
- remove(key: str) → int¶
Removes all the items that have
key
from the hash.
- Parameters
key (str) – The key to remove.
- Returns
Returns the number of items removed which is usually
1
but will be0
if the key isn’t in the hash, or greater than1
ifinsertMulti()
has been used with the key.- Return type
int
- reserve(alloc: int) → None¶
Ensures that the internal hash table consists of at least
size
buckets.
- Parameters
alloc (int) – The allocation size.
- size() → int¶
- Returns
Returns the number of items in the hash.
- Return type
int
- take(key: str) → str¶
Removes the item with
key
from the hash and returns the value associated with it.If the item does not exist in the hash, the method simply returns a default-constructed value. If there are multiple items for key in the hash, only the most recently inserted one is removed.
If you don’t use the return value,
remove()
is more efficient.
- Parameters
key (str) – The key.
- Returns
Returns the removed value.
- Return type
str
See also
remove()
.
- value(key: str, defaultValue: Optional[str] = None) → str¶
Returns the value associated with
key
. If the hash contains no item withkey
, the method returns a default-constructed value ifdefaultValue
is not provided. If there are multiple items forkey
in the hash, the value of the most recently inserted one is returned.
- Parameters
key (str) – The key.
defaultValue (Optional[str]) – The default value to return if
key
is not present in the hash.- Returns
Returns the value associated with
key
.- Return type
str
See also
contains()
.
- class NTUTF8StringHashIt(obj: Pro.Core.NTUTF8StringHash)¶
Iterator class for
NTUTF8StringHash
.
- Parameters
obj (NTUTF8StringHash) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
key
()Returns the key of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
value
()Returns the value of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- key() → str¶
- Returns
Returns the key of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).- Return type
str
See also
value()
.
- next() → None¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
tuple[str, str]
See also
hasNext()
andprevious()
.
- previous() → None¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
tuple[str, str]
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- toFront() → None¶
Moves the iterator to the front of the container (before the first item).
- value() → str¶
- Returns
Returns the value of the last item that was jumped over using one of the traversal functions (
previous()
,next()
).- Return type
str
See also
key()
.
- class NTUTF8StringList¶
List of
str
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: str) → None¶
Inserts
value
at the end of the list.
- Parameters
value (str) – The value to add to the list.
See also
insert()
.
- at(i: int) → str¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
str
- clear() → None¶
Removes all items from the list.
- contains(value: str) → bool¶
Checks the presence of an element in the list.
- Parameters
value (str) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: str) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (str) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: str, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (str) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: str) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (str) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTUTF8StringListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: str) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (str) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → str¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
str
See also
removeAt()
.
- class NTUTF8StringListIt(obj: Pro.Core.NTUTF8StringList)¶
Iterator class for
NTUTF8StringList
.
- Parameters
obj (NTUTF8StringList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → str¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
str
See also
hasNext()
andprevious()
.
- previous() → str¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
str
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class NTVariantList¶
List of
BasicType
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: Optional[Union[int, float, bool, bytes, str]]) → None¶
Inserts
value
at the end of the list.
- Parameters
value (BasicType) – The value to add to the list.
See also
insert()
.
- at(i: int) → Optional[Union[int, float, bool, bytes, str]]¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
BasicType
- clear() → None¶
Removes all items from the list.
- contains(value: Optional[Union[int, float, bool, bytes, str]]) → bool¶
Checks the presence of an element in the list.
- Parameters
value (BasicType) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: Optional[Union[int, float, bool, bytes, str]]) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (BasicType) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: Optional[Union[int, float, bool, bytes, str]], start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (BasicType) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: Optional[Union[int, float, bool, bytes, str]]) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (BasicType) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.NTVariantListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: Optional[Union[int, float, bool, bytes, str]]) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (BasicType) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → Optional[Union[int, float, bool, bytes, str]]¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
BasicType
See also
removeAt()
.
- class NTVariantListIt(obj: Pro.Core.NTVariantList)¶
Iterator class for
NTVariantList
.
- Parameters
obj (NTVariantList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → Optional[Union[int, float, bool, bytes, str]]¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
BasicType
See also
hasNext()
andprevious()
.
- previous() → Optional[Union[int, float, bool, bytes, str]]¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
BasicType
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class NTVoidBuffer¶
Bases:
Pro.Core.NTTextStream
This is a class derived from
NTTextStream
.Any data printed to this class is discarded. This class should be passed to methods which require an
NTTextStream
as argument, in the case that the caller is not interested in the output.See also
NTTextStream
,NTTextBuffer
andNTTextStringBuffer
.
- NTWednesday: Final[int]¶
Third day of the week.
See also
NTDate.dayOfWeek()
.
- class NTXml¶
XML parser class.
Code example:
from Pro.Core import * x = NTXml() ret = x.parse("<r><e t='test'></e></r>") if ret == NTXml_ErrNone: n = x.findChild(None, "r") if n != None: n = x.findChild(n, "e") if n != None: a = x.findAttribute(n, "t") if a != None: print(x.value(a))Methods:
_print
([node_or_out, indent_or_node, indent])Prints a node to an
NTTextStream
buffer or to a string.
appendAttribute
(parent, child)Appends an attribute to a node.
appendChild
(parent, child)Appends a child node to a parent node.
attributesToHash
(node)Converts all attributes and their values to string dictionary.
childPosition
(node)Computes the position of a node in relation to its siblings.
clear
()Clears the
NTXml
object and releases all allocated data.
clone
(x[, to])Clones an entire XML document to a new node.
cloneNode
(node[, to])Clones an input node and all its children to a new node.
countChildren
([parent])Counts the children of a node.
createAttribute
([name, value])Creates a new attribute.
createNode
([name, value])Creates a new node.
deleteAllAttributes
(node)Deletes all the attributes of a node.
deleteAllNodes
(node)Deletes all the child nodes of parent node.
deleteAttribute
(node, attr)Delete the specified attribute from a node.
deleteFirstAttribute
(node)Deletes the first attribute of a node.
deleteFirstChild
([parent])Deletes the first child node of a node.
deleteLastAttribute
(node)Deletes the last attribute of a node.
deleteLastChild
([parent])Deletes the last child node of a node.
deleteNode
(node)Deletes a node.
depth
(node)Calculates the depth of a node.
Enables thread safety for the current instance.
findAttribute
(attr_or_node, name)Finds an attribute by its name.
findChild
(parent, name[, options])Finds a child node by its name.
findSibling
(node, name[, options])Finds a sibling node by its name.
firstAttribute
(node)Retrieves the first attribute of a node.
firstChild
([parent])Retrieves the first child node of a node.
getChild
(parent, i)Retrieves the child node of a node by its position.
insertAttribute
(parent, sibling, attr)Inserts an attribute before
sibling
.
insertChild
(parent, sibling, node)Inserts a a child node before
sibling
.Returns
True
if the current instance is case-sensitive; otherwise returnsFalse
.
isEmpty
()Returns
True
ifparse()
wasn’t yet successfully invoked; otherwise returnsFalse
.Returns
True
if the current document was modified; otherwise returnsFalse
.
lastAttribute
(node)Retrieves the last attribute of a node.
lastChild
([parent])Retrieves the last child node of a node.
matchName
(attr_or_node, name[, options])Matches the name of a node or an attribute against a string.
name
(attr_or_node[, options])Returns the name of a node or an attribute.
nextAttribute
(attr)Returns the next sibling attribute of the specified attribute.
nextNode
(current)Retrieves the next node starting from
current
.
nextSibling
(node)Retrieves the next sibling of the specified node.
nodeToPath
(node)Converts the specified node into a path string.
overwriteValue
(attr, value)Overwrites the value of an attribute.
parentNode
(node)Retrieves the parent node of the specified node.
parse
(utf8[, flags])Parses an XML document from a string or a utf-8 byte-array.
pathToNode
(path)Converts a path string returned by
nodeToPath()
back to a node.
prependAttribute
(parent, child)Prepends an attribute to a node.
prependChild
(parent, child)Prepends a child node to a specified parent node.
previousAttribute
(attr)Returns the previous sibling attribute of the specified attribute.
previousSibling
(node)Returns the previous sibling node of the specified node.
printAndFlush
([indent])Uses
_print()
to convert the current document to a string and parses the string by callingparse()
.Sets whether the matching of names is case-sensitive.
setModified
(b)Sets or resets the modified status.
setName
(attr_or_node, name)Sets the name of a node or an attribute.
setValue
(attr_or_node, value)Sets the value of a node or an attribute.
value
(attr_or_node)Returns the value of a node or an attribute.
xmlText
()Returns the original XML data passed to
parse()
.
- _print(node_or_out: Union[NTTextStream, NTXmlNode] = None, indent_or_node: Union[NTXmlNode, bool] = None, indent: bool = False) → Union[None, str]¶
Prints a node to an
NTTextStream
buffer or to a string.The node parameter can be
None
to output the entire XML document.
- Parameters
node_or_out (Union[NTTextStream, NTXmlNode]) – Either an
NTTextStream
buffer or an XML node.indent_or_node (Union[NTXmlNode, bool]) – Either an XML node or a boolean indicating whether to indent the output.
indent (bool) – A boolean indicating whether to indent the output.
- Returns
Returns the string if no
NTTextStream
buffer was provided; otherwise returnsNone
.- Return type
Union[None, str]
See also
NTTextStream
.
- appendAttribute(parent: NTXmlNode, child: NTXmlAttribute) → None¶
Appends an attribute to a node.
- Parameters
parent (NTXmlNode) – The parent node.
child (NTXmlAttribute) – The attribute to append.
See also
appendChild()
.
- appendChild(parent: NTXmlNode, child: NTXmlNode) → None¶
Appends a child node to a parent node.
- Parameters
parent (NTXmlNode) – The parent node.
child (NTXmlNode) – The child node.
See also
appendAttribute()
.
- attributesToHash(node: NTXmlNode) → NTUTF8StringHash¶
Converts all attributes and their values to string dictionary.
- Parameters
node (NTXmlNode) – The parent node.
- Returns
Returns the string dictionary.
- Return type
See also
name()
,value()
,firstAttribute()
andnextAttribute()
.
- childPosition(node: NTXmlNode) → int¶
Computes the position of a node in relation to its siblings.
- Parameters
node (NTXmlNode) – The input node.
- Returns
Returns the relative position of the node if successful; otherwise returns
-1
.- Return type
int
See also
countChildren()
.
- clone(x: NTXml, to: NTXmlNode = None) → NTXmlNode¶
Clones an entire XML document to a new node.
- Parameters
x (NTXml) – The XML document to clone.
to (NTXmlNode) – The optional destination node.
- Returns
Returns the destination root node if successful; otherwise returns
None
.- Return type
NTXmlNode
See also
cloneNode()
.
- cloneNode(node: NTXmlNode, to: NTXmlNode = None) → NTXmlNode¶
Clones an input node and all its children to a new node.
- Parameters
node (NTXmlNode) – The node to clone.
to (NTXmlNode) – The optional destination node.
- Returns
Returns the destination root node if successful; otherwise returns
None
.- Return type
NTXmlNode
See also
clone()
.
- countChildren(parent: NTXmlNode = None) → int¶
Counts the children of a node.
- Parameters
parent (NTXmlNode) – The parent node.
- Returns
Returns the number of children.
- Return type
int
See also
childPosition()
.
- createAttribute(name: str = None, value: str = None) → NTXmlAttribute¶
Creates a new attribute.
- Parameters
name (str) – The optional name of the attribute.
value (str) – The optional value of the attribute.
- Returns
Returns the created attribute.
- Return type
NTXmlAttribute
See also
deleteAttribute()
andcreateNode()
.
- createNode(name: str = None, value: str = None) → NTXmlNode¶
Creates a new node.
- Parameters
name (str) – The optional name of the node.
value (str) – The optional value of the node.
- Returns
Returns the created node.
- Return type
NTXmlNode
See also
deleteNode()
andcreateAttribute()
.
- deleteAllAttributes(node: NTXmlNode) → None¶
Deletes all the attributes of a node.
- Parameters
node (NTXmlNode) – The input node.
See also
deleteAttribute()
anddeleteAllNodes()
.
- deleteAllNodes(node: NTXmlNode) → None¶
Deletes all the child nodes of parent node.
- Parameters
node (NTXmlNode) – The parent node.
See also
deleteNode()
anddeleteAllAttributes()
.
- deleteAttribute(node: NTXmlNode, attr: NTXmlAttribute) → None¶
Delete the specified attribute from a node.
- Parameters
node (NTXmlNode) – The parent node.
attr (NTXmlAttribute) – The attribute to delete.
See also
deleteNode()
anddeleteAllAttributes()
.
- deleteFirstAttribute(node: NTXmlNode) → None¶
Deletes the first attribute of a node.
- Parameters
node (NTXmlNode) – The parent node.
See also
deleteLastAttribute()
,deleteAttribute()
anddeleteAllAttributes()
.
- deleteFirstChild(parent: NTXmlNode = None) → None¶
Deletes the first child node of a node.
- Parameters
parent (NTXmlNode) – The parent node.
See also
deleteLastChild()
,deleteNode()
anddeleteAllNodes()
.
- deleteLastAttribute(node: NTXmlNode) → None¶
Deletes the last attribute of a node.
- Parameters
node (NTXmlNode) – The parent node.
See also
deleteFirstAttribute()
,deleteAttribute()
anddeleteAllAttributes()
.
- deleteLastChild(parent: NTXmlNode = None) → None¶
Deletes the last child node of a node.
- Parameters
parent (NTXmlNode) – The parent node.
See also
deleteFirstChild()
,deleteNode()
anddeleteAllNodes()
.
- deleteNode(node: NTXmlNode) → None¶
Deletes a node.
- Parameters
node (NTXmlNode) – The node to delete.
See also
createNode()
anddeleteAllNodes()
.
- depth(node: NTXmlNode) → int¶
Calculates the depth of a node.
- Parameters
node (NTXmlNode) – The input node.
- Returns
Returns the depth of the input node.
- Return type
int
- enableThreadSafety(b: bool) → None¶
Enables thread safety for the current instance.
This method must be called before calling other methods.
- Parameters
b (bool) – If
True
, makes the object safe for use by parallel threads.
- findAttribute(attr_or_node: Union[NTXmlAttribute, NTXmlNode], name: str) → NTXmlAttribute¶
Finds an attribute by its name.
- Parameters
attr_or_node (Union[NTXmlAttribute, NTXmlNode]) – Either the parent node or a sibling attribute.
name (str) – The name of the attribute to find.
- Returns
Returns the attribute if present; otherwise returns
None
.- Return type
NTXmlAttribute
See also
findChild()
andfindSibling()
.
- findChild(parent: NTXmlNode, name: str, options: int = 0) → NTXmlNode¶
Finds a child node by its name.
- Parameters
parent (NTXmlNode) – The parent node.
name (str) – The name of the node to find.
options (int) –
NTXml_IgnoreNS()
can be specified to ignore namespaces.- Returns
Returns the child node if present; otherwise returns
None
.- Return type
NTXmlNode
See also
findAttribute()
andfindSibling()
.
- findSibling(node: NTXmlNode, name: str, options: int = 0) → NTXmlNode¶
Finds a sibling node by its name.
- Parameters
node (NTXmlNode) – The sibling from which to start the search.
name (str) – The name of the node to find.
options (int) –
NTXml_IgnoreNS()
can be specified to ignore namespaces.- Returns
Returns the sibling node if present; otherwise returns
None
.- Return type
NTXmlNode
See also
findChild()
andfindAttribute()
.
- firstAttribute(node: NTXmlNode) → NTXmlAttribute¶
Retrieves the first attribute of a node.
- Parameters
node (NTXmlNode) – The parent node.
- Returns
Returns the first attribute if present; otherwise returns
None
.- Return type
NTXmlAttribute
See also
nextAttribute()
andfirstChild()
.
- firstChild(parent: NTXmlNode = None) → NTXmlNode¶
Retrieves the first child node of a node.
- Parameters
parent (NTXmlNode) – The parent node.
- Returns
Returns the first child node if present; otherwise returns
None
.- Return type
NTXmlNode
See also
nextSibling()
,nextNode()
andfirstAttribute()
.
- getChild(parent: NTXmlNode, i: int) → NTXmlNode¶
Retrieves the child node of a node by its position.
- Parameters
parent (NTXmlNode) – The parent node.
i (int) – The position of the child node to retrieve.
- Returns
Returns the requested child node if available; otherwise returns
None
.- Return type
NTXmlNode
See also
firstChild()
andnextSibling()
.
- insertAttribute(parent: NTXmlNode, sibling: NTXmlAttribute, attr: NTXmlAttribute) → None¶
Inserts an attribute before
sibling
.
- Parameters
parent (NTXmlNode) – The parent node.
sibling (NTXmlAttribute) – The sibling of the attribute to insert. This value can be
None
to insert the new attribute at the back.attr (NTXmlAttribute) – The attribute to insert.
See also
createAttribute()
,deleteAttribute()
andinsertChild()
.
- insertChild(parent: NTXmlNode, sibling: NTXmlNode, node: NTXmlNode) → None¶
Inserts a a child node before
sibling
.
- Parameters
parent (NTXmlNode) – The parent node.
sibling (NTXmlNode) – The sibling of the node to insert. This value can be
None
to insert the new node at the back.node (NTXmlNode) – The node to insert.
See also
createNode()
,deleteNode()
andinsertAttribute()
.
- isCaseSensitive() → bool¶
- Returns
Returns
True
if the current instance is case-sensitive; otherwise returnsFalse
.- Return type
bool
See also
setCaseSensitivity()
.
- isEmpty() → bool¶
- Returns
Returns
True
ifparse()
wasn’t yet successfully invoked; otherwise returnsFalse
.- Return type
bool
See also
parse()
.
- isModified() → bool¶
- Returns
Returns
True
if the current document was modified; otherwise returnsFalse
.- Return type
bool
See also
setModified()
.
- lastAttribute(node: NTXmlNode) → NTXmlAttribute¶
Retrieves the last attribute of a node.
- Parameters
node (NTXmlNode) – The parent node.
- Returns
Returns the last attribute if present; otherwise returns
None
.- Return type
NTXmlAttribute
See also
previousAttribute()
andlastChild()
.
- lastChild(parent: NTXmlNode = None) → NTXmlNode¶
Retrieves the last child node of a node.
- Parameters
parent (NTXmlNode) – The parent node.
- Returns
Returns the last child node if present; otherwise returns
None
.- Return type
NTXmlNode
See also
previousSibling()
andlastAttribute()
.
- matchName(attr_or_node: Union[NTXmlAttribute, NTXmlNode], name: str, options: int = 0) → bool¶
Matches the name of a node or an attribute against a string.
- Parameters
attr_or_node (Union[NTXmlAttribute, NTXmlNode]) – The node or attribute whose name to match.
name (str) – The name to match.
options (int) –
NTXml_IgnoreNS()
can be specified to ignore namespaces.- Returns
Returns
True
if the name matches; otherwise returnsFalse
.- Return type
bool
See also
name()
.
- name(attr_or_node: Union[NTXmlAttribute, NTXmlNode], options: int = 0) → str¶
Returns the name of a node or an attribute.
- Parameters
attr_or_node (Union[NTXmlAttribute, NTXmlNode]) – The node or attribute for which to retrieve the name.
options (int) –
NTXml_IgnoreNS()
can be specified to discard the namespace.- Returns
Returns the name of the specified node or attribute.
- Return type
str
See also
value()
,matchName()
andsetName()
.
- nextAttribute(attr: NTXmlAttribute) → NTXmlAttribute¶
Returns the next sibling attribute of the specified attribute.
- Parameters
attr (NTXmlAttribute) – The attribute for which to retrieve the sibling.
- Returns
Returns the next sibling attribute if present; otherwise returns
None
.- Return type
NTXmlAttribute
See also
previousAttribute()
,firstAttribute()
andnextSibling()
.
- nextNode(current: NTXmlNode) → NTXmlNode¶
Retrieves the next node starting from
current
.The difference with
nextSibling()
is that this method also enumerates child nodes.
- Parameters
current (NTXmlNode) – The current node. This parameter can be
None
to start from the first root node of the document.- Returns
Returns the next node if present; otherwise returns
None
.- Return type
NTXmlNode
See also
nextSibling()
,firstChild()
andparentNode()
.
- nextSibling(node: NTXmlNode) → NTXmlNode¶
Retrieves the next sibling of the specified node.
- Parameters
node (NTXmlNode) – The node for which to retrieve the sibling.
- Returns
Returns the next sibling node if present; otherwise returns
None
.- Return type
NTXmlNode
See also
previousSibling()
,firstChild()
andparentNode()
.
- nodeToPath(node: NTXmlNode) → str¶
Converts the specified node into a path string.
Take this code snippet:
from Pro.Core import * x = NTXml() ret = x.parse("<r><unk0/><e><unk1/><unk2/><c/></e></r>") if ret == NTXml_ErrNone: n = x.findChild(None, "r") if n != None: n = x.findChild(n, "e") if n != None: c = x.findChild(n, "c") if c != None: print(x.nodeToPath(c))It will output the following path string: 0<r>1<e>2<c>
Each node in the path is preceded by its position as a child relative to its siblings. Since the r node is the root node, it is at position 0. The e node is the second child node of r and hence it is at position 1. The c node is the third child node of e and hence it is at position 2.
A path string can be converted back to a node by using
pathToNode()
.
- Parameters
node (NTXmlNode) – The node for which to create a path string.
- Returns
Returns the path string.
- Return type
str
See also
pathToNode()
.
- overwriteValue(attr: NTXmlAttribute, value: str) → bool¶
Overwrites the value of an attribute.
The difference with
setValue()
is that this method overwrites the value in place without allocating additional memory. Therefore, the size of the new value must match the size of the old one in order for the method to succeed.
- Parameters
attr (NTXmlAttribute) – The attribute whose value should be overwritten.
value (str) – The new value of the attribute.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
setValue()
.
- parentNode(node: NTXmlNode) → NTXmlNode¶
Retrieves the parent node of the specified node.
- Parameters
node (NTXmlNode) – The node for which to retrieve the parent.
- Returns
Returns the parent node if present; otherwise returns
None
.- Return type
NTXmlNode
See also
firstChild()
,lastChild()
andgetChild()
.
- parse(utf8: Union[bytes, str], flags: int = 0) → int¶
Parses an XML document from a string or a utf-8 byte-array.
- Parameters
utf8 (Union[bytes, str]) – The XML string or utf-8 byte-array.
flags (int) – Can be
NTXml_FaultTolerant
to parse malformed XML data.- Returns
Returns
NTXml_ErrNone
if successful; otherwise returns an error code.- Return type
int
See also
nextNode()
,firstChild()
andnextSibling()
.
- pathToNode(path: str) → NTXmlNode¶
Converts a path string returned by
nodeToPath()
back to a node.
- Parameters
path (str) – The path string.
- Returns
Returns the converted node if successful; otherwise returns
None
.- Return type
NTXmlNode
See also
nodeToPath()
.
- prependAttribute(parent: NTXmlNode, child: NTXmlAttribute) → None¶
Prepends an attribute to a node.
- Parameters
parent (NTXmlNode) – The parent node.
child (NTXmlAttribute) – The attribute to prepend.
See also
appendAttribute()
,insertAttribute()
,deleteAttribute()
andprependChild()
.
- prependChild(parent: NTXmlNode, child: NTXmlNode) → None¶
Prepends a child node to a specified parent node.
- Parameters
parent (NTXmlNode) – The parent node.
child (NTXmlNode) – The child node to prepend.
See also
appendChild()
,insertChild()
,deleteNode()
andprependAttribute()
.
- previousAttribute(attr: NTXmlAttribute) → NTXmlAttribute¶
Returns the previous sibling attribute of the specified attribute.
- Parameters
attr (NTXmlAttribute) – The attribute for which to retrieve the sibling.
- Returns
Returns the previous sibling attribute if present; otherwise returns
None
.- Return type
NTXmlAttribute
See also
nextAttribute()
,lastAttribute()
andpreviousSibling()
.
- previousSibling(node: NTXmlNode) → NTXmlNode¶
Returns the previous sibling node of the specified node.
- Parameters
node (NTXmlNode) – The node for which to retrieve the sibling.
- Returns
Returns the previous sibling node if present; otherwise returns
None
.- Return type
NTXmlNode
See also
nextSibling()
,lastChild()
andpreviousAttribute()
.
- printAndFlush(indent: bool = False) → str¶
Uses
_print()
to convert the current document to a string and parses the string by callingparse()
.
- Parameters
indent (bool) – If
True
, converts the document to string with indentation.- Returns
Returns the string returned by
_print()
.- Return type
str
- setCaseSensitivity(b: bool) → None¶
Sets whether the matching of names is case-sensitive.
The default is
True
.
- Parameters
b (bool) – If
False
, the matching of names becomes case-insensitive.See also
isCaseSensitive()
.
- setModified(b: bool) → None¶
Sets or resets the modified status.
- Parameters
b (bool) – If
True
, sets the modified status; otherwise resets it.See also
isModified()
.
- setName(attr_or_node: Union[NTXmlAttribute, NTXmlNode], name: str) → None¶
Sets the name of a node or an attribute.
- Parameters
attr_or_node (Union[NTXmlAttribute, NTXmlNode]) – The node or attribute for which to set the name.
name (str) – The name to set.
See also
name()
,value()
andsetValue()
.
- setValue(attr_or_node: Union[NTXmlAttribute, NTXmlNode], value: str) → None¶
Sets the value of a node or an attribute.
- Parameters
attr_or_node (Union[NTXmlAttribute, NTXmlNode]) – The node or attribute for which to set the value.
value (str) – The value to set.
- value(attr_or_node: Union[NTXmlAttribute, NTXmlNode]) → str¶
Returns the value of a node or an attribute.
- Parameters
attr_or_node (Union[NTXmlAttribute, NTXmlNode]) – The node or attribute for which to retrieve the value.
- Returns
Returns the value of the node or attribute.
- Return type
str
See also
setValue()
,name()
andsetName()
.
- xmlText() → str¶
- Returns
Returns the original XML data passed to
parse()
.- Return type
str
See also
parse()
andprintAndFlush()
.
- NTXml_ErrAlloc: Final[int]¶
Returned if an allocation error occurred.
See also
NTXml.parse()
.
- NTXml_ErrNone: Final[int]¶
Returned if no error occurred.
See also
NTXml.parse()
.
- NTXml_ErrParse: Final[int]¶
Returned if a parse error occurred.
See also
NTXml.parse()
.
- NTXml_ErrUnknown: Final[int]¶
Returned if an unknown error occurred.
See also
NTXml.parse()
.
- NTXml_FaultTolerant: Final[int]¶
Parses malformed XML data.
See also
NTXml.parse()
.
- NTXml_IgnoreNS: Final[int]¶
Ignores XML node namespaces.
See also
NTXml.name()
,NTXml.matchName()
,NTXml.findChild()
andNTXml.findSibling()
.
- NTXml_InvalidFlags: Final[int]¶
Returned if invalid flags were specified.
See also
NTXml.parse()
.
- NTXml_InvalidNode: Final[int]¶
Returned if an invalid node was specified.
See also
NTXml.parse()
.
- NTXml_InvalidType: Final[int]¶
Returned if an invalid type was specified.
See also
NTXml.parse()
.
- NT_ASF_BlockIO: Final[int]¶
Address space flag for block I/O.
See also
NTAddressSpace.setFlags()
.
- NT_ASF_IgnoreInvalidPages: Final[int]¶
Address space flag to ignore invalid pages.
See also
NTAddressSpace.setFlags()
.
- NT_ASF_IsSparse: Final[int]¶
Address space flag for sparse address spaces.
See also
NTAddressSpace.setFlags()
.
- NT_ASF_Memory: Final[int]¶
Address space flag for process memory.
See also
NTAddressSpace.setFlags()
.
- NT_ASPSF_ALL: Final[int]¶
Address space standard flag which combines all supported flags.
See also
NTAddressSpace
.
- NT_ASPSF_DIRTY: Final[int]¶
Address space standard flag for dirty pages.
See also
NTAddressSpace
.
- NT_ASPSF_EXECUTE: Final[int]¶
Address space standard flag for executable pages.
See also
NTAddressSpace
.
- NT_ASPSF_GUARD: Final[int]¶
Address space standard flag for guarded pages.
See also
NTAddressSpace
.
- NT_ASPSF_PRESENCE: Final[int]¶
Address space standard flag for readable/present pages.
See also
NTAddressSpace
.
- NT_ASPSF_TRANSITION: Final[int]¶
Address space standard flag for transitional pages.
See also
NTAddressSpace
.
- NT_ASPSF_USER_MODE: Final[int]¶
Address space standard flag for user mode pages.
See also
NTAddressSpace
.
- NT_ASPSF_WRITE: Final[int]¶
Address space standard flag for writable pages.
See also
NTAddressSpace
.
- NT_ASR_INVALID: Final[int]¶
Address space result for unsuccessful operations.
See also
NTAddressSpace
.
- NT_ASR_OK: Final[int]¶
Address space result for successful operations.
See also
NTAddressSpace
.
- NT_ASR_UNSUPPORTED: Final[int]¶
Address space result for unsupported operations.
See also
NTAddressSpace
.
- NT_AppendFile(src: NT_FILE, copySize: int, dst: NT_FILE) → bool¶
Appends
copySize
bytes ofsrc
file todst
file.
- Parameters
src (NT_FILE) – The source file.
copySize (int) – The amount of bytes to copy.
dst (NT_FILE) – The destination file.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
NT_OpenFile()
andNT_CreateFile()
.
- NT_ApplyFileExt(fileName: str, filetype: NTFileExtensions) → str¶
Appends the default extension type for the current system specified by
filetype
tofileName
.
- Parameters
fileName (str) – The input file name without extension.
filetype (NTFileExtensions) – The extension type to apply (i.e.: NT_FileExt_Exe, NT_FileExt_Dll, NT_FileExt_Link).
- Returns
Returns the file name combined with specified extension type.
- Return type
str
See also
NT_FileExtFromName()
andNT_StripFileExt()
.
- NT_AutoDecodeBytes(raw: bytes) → str¶
This function tries to decode raw bytes into a string using simple heuristics.
- Parameters
raw (bytes) – The raw bytes to decode.
- Returns
Returns a decoded string if possible; otherwise returns an empty string.
- Return type
str
See also
NT_DecodeAsciiBytes()
andNT_DecodeAsciiBytes16()
.
- NT_CloseFile(ntfile: NT_FILE) → None¶
Closes an open file handle.
- Parameters
ntfile (NT_FILE) – The file handle to close.
See also
NT_OpenFile()
andNT_CreateFile()
.
- NT_CloseModuleHandle(ntmod: NT_MODULE) → None¶
Closes the handle of a module without unloading the module.
- Parameters
ntmod (NT_MODULE) – The handle to close.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_FreeModule()
andNT_LoadModule()
.
- NT_CloseProcess(proc: NT_PROCESS) → None¶
Closes a process handle.
- Parameters
proc (NT_PROCESS) – The process handle to close.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_OpenProcess()
.
- NT_ColorFromString(str: str) → int¶
Compute a color from an input string.
Hint
The computed color can be used in UI controls such as the hex view.
- Parameters
str (str) – The input string.
- Returns
Returns the computed color.
- Return type
int
Available since Cerbero Suite 7.3 and Cerbero Engine 4.3.
- NT_CopyFile(fileNameA: str, fileNameB: str) → bool¶
Copies a file.
- Parameters
fileNameA (str) – The name of the file to copy.
fileNameB (str) – The destination file name for the copy operation.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
NT_CopyFileOpen()
andNT_OpenFile()
.
- NT_CopyFileOpen(fileNameA: str, fileNameB: str) → NT_FILE¶
Copies a file. The difference with
NT_CopyFile()
is that this function returns a handle to the created file.
- Parameters
fileNameA (str) – The name of the file to copy.
fileNameB (str) – The destination file name for the copy operation.
- Returns
Returns the handle of the created file if successful; otherwise returns
None
.- Return type
NT_FILE
See also
NT_CopyFile()
andNT_OpenFile()
.
- NT_CreateDirectory(dirName: str) → bool¶
Creates a directory.
- Parameters
dirName (str) – The name of the directory to create.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
NT_CreateDirectoryTree()
andNT_DeleteDirectory()
.
- NT_CreateDirectoryTree(dirName: str) → bool¶
Creates a directory and all the intermediate directories leading up to that directory if not yet present.
- Parameters
dirName (str) – The name of the directory to create.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
NT_CreateDirectory()
andNT_DeleteDirectory()
.
- NT_CreateFile(FileName: str, opt: int = NTFileOpt_Write) → NT_FILE¶
Creates a file. If the file already exists, it will be overwritten unless
NTFileOpt_CreateNew
is specified.
- Parameters
FileName (str) – The name of the file to create.
opt (int) – Access options. By default the file will have read/write access (
NTFileOpt_Write
) access.- Returns
Returns the handle of the created file if successful; otherwise returns
None
.- Return type
NT_FILE
See also
NT_OpenFile()
,NT_CloseFile()
,NT_ReadFile()
andNT_WriteFile()
.
- NT_CreateFileLink(fileName: str, linkName: str, descr: str = str()) → bool¶
Creates a link (e.g.: .lnk on Windows) file.
Currently this operation is supported only on Windows.
- Parameters
fileName (str) – The file name for which to create a link file.
linkName (str) – The name of the link to create.
descr (str) – An optional description for the link.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
NT_DeleteLink()
andNT_ApplyFileExt()
.
- NT_CreateTempFile(ext: str = str(), auto_delete: bool = True) → NT_FILE¶
Creates a temporary file.
The file will be automatically deleted when closed using
NT_CloseFile()
unlessauto_delete
is set toFalse
.
- Parameters
ext (str) – Optional extension for the temporary file.
auto_delete (bool) – If
True
, the file is automatically deleted when closed. Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.- Returns
Returns the handle of the created file if successful; otherwise returns
None
.- Return type
NT_FILE
See also
NT_CloseFile()
andNT_GetTempFileName()
.
- NT_DecodeAsciiBytes(raw: bytes) → str¶
This function tries to decode an ascii string using simple heuristics.
- Parameters
raw (bytes) – The raw bytes to decode.
- Returns
Returns a decoded string if possible; otherwise returns an empty string.
- Return type
str
See also
NT_AutoDecodeBytes()
andNT_DecodeAsciiBytes16()
.
- NT_DecodeAsciiBytes16(raw: bytes, endianness: int) → str¶
This function tries to decode an ascii wide-char string using simple heuristics.
- Parameters
raw (bytes) – The raw bytes to decode.
endianness (int) – The endianness of the string.
- Returns
Returns a decoded string if possible; otherwise returns an empty string.
- Return type
str
See also
NT_AutoDecodeBytes()
andNT_DecodeAsciiBytes()
.
- NT_DeleteDirectory(dirName: str) → bool¶
Deletes a directory.
- Parameters
dirName (str) – The name of the directory to delete.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
NT_CreateDirectory()
andNT_DeleteFile()
.
- NT_DeleteFile(FileName: str) → bool¶
Deletes a file.
- Parameters
FileName (str) – The name of the file to delete.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
NT_TrashFile()
,NT_CreateFile()
andNT_DeleteDirectory()
.
- NT_DeleteLink(linkName: str) → bool¶
Deletes a link (e.g.: .lnk on Windows) file.
Currently this operation is supported only on Windows.
- Parameters
linkName (str) – The name of the link file to delete. The correct extension is automatically appended if missing.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
NT_CreateFileLink()
andNT_ApplyFileExt()
.
- NT_DirectoryExists(dirName: str) → bool¶
Checks the existence of a directory.
- Parameters
dirName (str) – The name of the directory.
- Returns
Returns
True
if the directory exists; otherwise returnsFalse
.- Return type
bool
See also
NT_FileExists()
.
- NT_FileAttr_Compressed: Final[int]¶
File attribute flag.
See also
NT_GetFileAttributes()
.
- NT_FileAttr_Encrypted: Final[int]¶
File attribute flag.
See also
NT_GetFileAttributes()
.
- NT_FileAttr_Hidden: Final[int]¶
File attribute flag.
See also
NT_GetFileAttributes()
.
- NT_FileAttr_ReadOnly: Final[int]¶
File attribute flag.
See also
NT_GetFileAttributes()
.
- NT_FileAttr_System: Final[int]¶
File attribute flag.
See also
NT_GetFileAttributes()
.
- NT_FileAttr_Temporary: Final[int]¶
File attribute flag.
See also
NT_GetFileAttributes()
.
- NT_FileExists(FileName: str) → bool¶
Checks the existence of a file.
Important
This function doesn’t distinguish between files and directories. To know whether the file is a file or a directory, you must use
NT_DirectoryExists()
.
- Parameters
FileName (str) – The name of the file or directory.
- Returns
Returns
True
if the file or directory exists; otherwise returnsFalse
.- Return type
bool
See also
NT_DirectoryExists()
.
- NT_FileExtFromName(fileName: str, include_dot: bool = True) → str¶
Retrieves the extension of a file name (e.g.:
".exe"
).
- Parameters
fileName (str) – The name of the file.
include_dot (bool) – If
True
, includes the dot separator in the returned extension (available since Cerbero Suite 5.7 and Cerbero Engine 2.7.).- Returns
Returns the file extension if present; otherwise returns an empty string.
- Return type
str
See also
NT_StripFileExt()
,NT_ApplyFileExt()
,NT_FileNameFromPath()
andNT_PathFromFileName()
.
- NT_FileExt_Dll: Final[int]¶
Applies a shared library extension to the file name (e.g.:
".dll"
on Windows and".dylib"
on macOS).See also
NT_ApplyFileExt()
.
- NT_FileExt_Exe: Final[int]¶
Applies a binary extension to the file name (i.e.,
".exe"
on Windows).See also
NT_ApplyFileExt()
.
- NT_FileExt_Link: Final[int]¶
Applies a link extension to the file name (i.e.,
".lnk"
on Windows).See also
NT_ApplyFileExt()
.
- NT_FileNameFromPath(path: str) → str¶
Retrieves the file name from a path.
- Parameters
path (str) – The full path.
- Returns
Returns the file name if present; otherwise returns an empty string.
- Return type
str
See also
NT_PathFromFileName()
andNT_FileExtFromName()
.
- NT_FileToBuffer(fileName: str, maxSize: int, readPartial: bool = False) → bytes¶
Reads a file to a memory buffer.
- Parameters
fileName (str) – The name of the file to read from.
maxSize (int) – The maximum amount of data to read.
readPartial (bool) – Specifies whether to accept a partial read. When
False
, the function will fail if the size of the file is bigger than the maximum amount of data to read.- Returns
Returns the buffer if successful; otherwise returns an empty buffer.
- Return type
bytes
See also
NT_OpenFile()
,NT_ReadFile()
andNT_GetFileSize()
.
- NT_FloatToString(v: float) → str¶
Converts a float value to string.
This function offers a coherent representation of float values across the application.
- Parameters
v (float) – The float value to convert.
- Returns
Returns the converted float value.
- Return type
str
- NT_Folder_App: Final[int]¶
Retrieves the application directory. On macOS it retrieves the path to Contents/Resources.
See also
NT_GetSpecialFolder()
andNT_Folder_AppExe
.
- NT_Folder_AppData: Final[int]¶
Retrieves the AppData directory on Windows.
See also
NT_GetSpecialFolder()
.
- NT_Folder_AppExe: Final[int]¶
Retrieves the application directory. On macOS it retrieves the path to Contents/MacOS.
See also
NT_GetSpecialFolder()
andNT_Folder_App
.
- NT_Folder_AppMenu: Final[int]¶
Retrieves the AppMenu directory on Windows.
See also
NT_GetSpecialFolder()
.
- NT_Folder_Applications: Final[int]¶
Retrieves the applications directory on Windows.
See also
NT_GetSpecialFolder()
.
- NT_Folder_Applications_x86: Final[int]¶
Retrieves the x86 applications directory on Windows.
See also
NT_GetSpecialFolder()
.
- NT_Folder_Common_AppMenu: Final[int]¶
Retrieves the shared AppMenu directory on Windows.
See also
NT_GetSpecialFolder()
.
- NT_Folder_Common_Desktop: Final[int]¶
Retrieves the shared desktop directory on Windows.
See also
NT_GetSpecialFolder()
.
- NT_Folder_Current: Final[int]¶
Retrieves the current working directory.
See also
NT_GetSpecialFolder()
.
- NT_Folder_Desktop: Final[int]¶
Retrieves the desktop directory.
See also
NT_GetSpecialFolder()
.
- NT_Folder_Documents: Final[int]¶
Retrieves the documents directory.
See also
NT_GetSpecialFolder()
.
- NT_Folder_Home: Final[int]¶
Retrieves the home directory.
See also
NT_GetSpecialFolder()
.
- NT_Folder_Root: Final[int]¶
Retrieves the root directory (i.e.,
"/"
on Linux/macOS and"C:/"
on Windows).See also
NT_GetSpecialFolder()
.
- NT_Folder_SystemTemp: Final[int]¶
Retrieves the default system temporary directory.
Available since Cerbero Suite 7.5 and Cerbero Engine 4.5.
See also
NT_GetSpecialFolder()
.
- NT_Folder_Temp: Final[int]¶
Retrieves the temporary directory.
Note
This retrieves the temporary directory for the application, which may differ from the system one. To retrieve the default system temporary directory, use
NT_Folder_SystemTemp()
instead.See also
NT_GetSpecialFolder()
.
- NT_FreeModule(ntmod: NT_MODULE) → None¶
Unloads a module and closes its handle.
- Parameters
ntmod (NT_MODULE) – The module to unload.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_CloseModuleHandle()
andNT_LoadModule()
.
- NT_GetCurrentDirectory() → str¶
- Returns
Returns the current working directory.
- Return type
str
Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.
See also
NT_SetCurrentDirectory()
.
- NT_GetCurrentModuleFileName() → str¶
- Returns
Returns the name of the current module including its path.
- Return type
str
See also
NT_GetCurrentModulePath()
.
- NT_GetCurrentModulePath() → str¶
- Returns
Returns the full path of the current module.
- Return type
str
See also
NT_GetCurrentModuleFileName()
.
- NT_GetCurrentProcessId() → int¶
- Returns
Returns the current process id.
- Return type
int
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_GetCurrentProcessPath()
.
- NT_GetCurrentProcessPath() → str¶
- Returns
Returns the path of the executable of the current process.
- Return type
str
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_GetCurrentProcessId()
.
- NT_GetCustomTempFolder() → str¶
Gets the temporary directory set for the application.
- Returns
Returns the temporary directory for the application if available; otherwise returns an empty string.
- Return type
str
Available since Cerbero Suite 7.5 and Cerbero Engine 4.5.
See also
NT_SetCustomTempFolder()
.
- NT_GetFileAttributes(fileName: str) → int¶
Retrieves the attributes of a file.
- Parameters
fileName (str) – The file name.
- Returns
Returns the file attributes (e.g.,
NT_FileAttr_ReadOnly
) if successful; otherwise returns0
.- Return type
int
Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.
See also
NT_GetFileAttributesAsString()
.
- NT_GetFileAttributesAsString(fileName: str) → str¶
Retrieves the attributes of a file as a string.
- Parameters
fileName (str) – The file name.
- Returns
Returns the file attributes if successful; otherwise returns an empty string.
- Return type
str
Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.
See also
NT_GetFileAttributes()
.
- NT_GetFileName(ntfile: NT_FILE) → str¶
Retrieves the name of a file from its handle.
- Parameters
ntfile (NT_FILE) – The handle of the open file.
- Returns
Returns the name of the file.
- Return type
str
See also
NT_OpenFile()
andNT_CreateFile()
.
- NT_GetFileOwner(fileName: str) → str¶
Retrieves the file owner of a file.
Hint
Multiple owners are separated by new-lines.
- Parameters
fileName (str) – The file name.
- Returns
Returns the file owner if successful; otherwise returns an empty string.
- Return type
str
Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.
- NT_GetFilePermissionsAsString(fileName: str) → str¶
Retrieves the file permissions as a string.
- Parameters
fileName (str) – The file name.
- Returns
Returns the file permissions as a string if successful; otherwise returns an empty string.
- Return type
str
Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.
- NT_GetFilePos(ntfile: NT_FILE) → tuple[bool, int]¶
Gets the current file position.
- Parameters
ntfile (NT_FILE) – The handle of the open file.
- Returns
Returns a tuple consisting of a boolean that indicates the function succeeded and the current file position.
- Return type
tuple[bool, int]
See also
NT_SetFilePos()
.
- NT_GetFileSize(ntfile: NT_FILE) → int¶
Gets the size of a file.
- Parameters
ntfile (NT_FILE) – The handle of the open file.
- Returns
Returns the size of the file.
- Return type
int
See also
NT_SetFileSize()
.
- NT_GetMemoryRegions(pid: int, allocated_only: bool = True, limit: int = NT_MEMORY_REGIONS_MAX_ADDR) → Pro.Core.NTMemoryInfoList¶
Retrieves the list of memory regions allocated by the specified process.
Hint
Internally this function uses
NTProcessRegionsEnumerator
.
- Parameters
pid (int) – The process id.
allocated_only (bool) – If
True
, only returns allocated regions.limit (int) – The maximum address of enumerated regions.
- Returns
Returns the list of memory regions.
- Return type
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NTProcessRegionsEnumerator
andNT_MEMORY_INFO
.
- NT_GetModule(name: str) → NT_MODULE¶
Retrieves a module from its name.
Hint
The module must already be loaded for it to be retrieved by name.
- Parameters
name (str) – The name of the module to retrieve.
- Returns
Returns the handle of the module if successful; otherwise returns
None
.- Return type
NT_MODULE
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_LoadModule()
.
- NT_GetModuleList(pid: int) → Pro.Core.NTModuleInfoList¶
Retrieves the list of modules loaded in the address space of a process.
Note
This function is not available on macOS.
- Parameters
pid (int) – The process id.
- Returns
Returns the list of loaded modules.
- Return type
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_MODULE_INFO
.
- NT_GetProcessFileName(pid_or_proc: Union[NT_PROCESS, int]) → str¶
Retrieves the path of the executable of a specified process.
- Parameters
pid_or_proc (Union[NT_PROCESS, int]) – The process id or handle.
- Returns
Returns the path if successful; otherwise returns an empty string.
- Return type
str
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_GetCurrentProcessPath()
.
- NT_GetProcessId(proc: NT_PROCESS) → int¶
Retrieves the process id for a process handle.
- Parameters
proc (NT_PROCESS) – The process handle.
- Returns
Returns the process id.
- Return type
int
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
- NT_GetProcessList(only_accessible: bool = False) → Pro.Core.NTProcessInfoList¶
Retrieves the current list of processes.
- Parameters
only_accessible (bool) – If
True
, only processes that can be opened for read-access are included in the list.- Returns
Returns the current list of processes.
- Return type
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_PROCESS_INFO
.
- NT_GetSpecialFolder(f: NTSpecialFolders) → str¶
Retrieves a special system directory.
- Parameters
f (NTSpecialFolders) – The directory to retrieve (e.g.:
NT_Folder_App
).- Returns
Returns the requested directory if available; otherwise returns an empty string.
- Return type
str
See also
NT_GetCurrentModulePath()
.
- NT_GetSystemFileHandle(ntfile: NT_FILE) → SystemHandle¶
Returns the internal system handle of a file.
- Parameters
ntfile (NT_FILE) – The handle of the open file.
- Returns
Returns the system handle of the file.
- Return type
SystemHandle
- NT_GetTempFileName(ext: str = str()) → str¶
Generates a temporary file name.
Warning
The use of
NT_CreateTempFile()
is recommended instead, sinceNT_GetTempFileName()
can lead to concurrency issues.
- Parameters
ext (str) – Optional extension for the temporary file name.
- Returns
Returns the generated name if successful; otherwise returns an empty string.
- Return type
str
See also
NT_CreateTempFile()
.
- NT_GetTickCount() → int¶
- Returns
Returns the time passed since system boot in milliseconds.
- Return type
int
Available since Cerbero Suite 6.1 and Cerbero Engine 3.1.
See also
NTTimer
.
- NT_HasProcessAPI() → bool¶
- Returns
Returns
True
if the process API is available on the current system; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
- NT_HexCharToByte(ch: int) → int¶
Converts a hex character into its corresponding integer value (e.g.:
ord('F')
->15
).
- Parameters
ch (int) – The hex character to convert.
- Returns
Returns the converted hex character if successful; otherwise returns
-1
.- Return type
int
- NT_IsCurrentModuleDLL() → bool¶
- Returns
Returns
True
if the current module is a shared library; otherwise returnsFalse
.- Return type
bool
Note
This function will return
True
only when called from the SDK of Cerbero Engine.
- NT_IsRelativePath(path: str) → bool¶
Checks whether a path is relative.
- Parameters
path (str) – The path to check.
- Returns
Returns
True
if the path is relative; otherwise returnsFalse
.- Return type
bool
- NT_IsSymbolicLink(FileName: str) → bool¶
Checks whether the specified file is a symbolic link.
- Parameters
FileName (str) – The file name.
- Returns
Returns
True
if the file is a symbolic link; otherwise returnsFalse
.- Return type
bool
- NT_KillProcess(pid_or_proc: Union[NT_PROCESS, int], timeout: int = 0) → bool¶
Terminates a process.
- Parameters
pid_or_proc (Union[NT_PROCESS, int]) – The process id or handle.
timeout (int) – The time-out for the operation in milliseconds.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
- NT_LoadModule(name: str) → NT_MODULE¶
Loads a module from disk.
- Parameters
name (str) – The name of the module to load.
- Returns
Returns the handle of the loaded module if successful; otherwise returns
None
.- Return type
NT_MODULE
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_GetModule()
,NT_ResolveSymbol()
,NT_CloseModuleHandle()
andNT_FreeModule()
.
- class NT_MEMORY_INFO¶
This class represents a memory region.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_GetMemoryRegions()
andNTProcessRegionsEnumerator
.Attributes:
The flags of the memory region (e.g.,
NTProcessMemoryAccess_Read
).The size of the memory region.
The start address of the memory region.
The state of the memory region (e.g.,
NTProcessMemoryState_Commit
).The type of the memory region (e.g.,
NTProcessMemoryType_Image
).Methods:
isValid
()Returns
True
if the memory region is valid; otherwise returnsFalse
.
- flags¶
The flags of the memory region (e.g.,
NTProcessMemoryAccess_Read
).
- isValid() → bool¶
- Returns
Returns
True
if the memory region is valid; otherwise returnsFalse
.- Return type
bool
- state¶
The state of the memory region (e.g.,
NTProcessMemoryState_Commit
).
- type¶
The type of the memory region (e.g.,
NTProcessMemoryType_Image
).
- NT_MEMORY_REGIONS_MAX_ADDR: Final[int]¶
Maximum memory address for memory regions.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_GetMemoryRegions()
.
- class NT_MODULE_INFO¶
This class contains information about a loaded module.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_GetModuleList()
.Attributes:
The start address of the module.
The name of the module.
The full path of the module.
The size of the module.
- NT_MakeCString(str: str) → str¶
Escapes a string for C (e.g.:
"Hello,\nWorld!"
becomes"Hello,\\nWorld!"
).
- Parameters
str (str) – The string to escape.
- Returns
Returns the escaped string.
- Return type
str
See also
NT_UnescapeCString()
.
- NT_MakeFileExecutable(fileName: str) → bool¶
Adds executable attributes to the specified file if they’re missing.
Note
On Windows this function merely checks the presence of the file.
- Parameters
fileName (str) – The name of the file.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.
- NT_MatchFileName(fileNameA: str, fileNameB: str) → bool¶
Compares two paths taking also into account the case sensitivity of the current file system.
- Parameters
fileNameA (str) – The first file name.
fileNameB (str) – The second file name.
- Returns
Returns
True
if the two file names match; otherwise returnsFalse
.- Return type
bool
See also
NT_NormalizeFileName()
.
- NT_MemorySizeToString(size: int, prec: int = 4) → str¶
Converts a size in bytes to a string representation using byte, KB, MB or GB units.
- Parameters
size (int) – The size to convert.
prec (int) – The precision of the resulting string.
- Returns
Returns the string size representation.
- Return type
str
Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.
- NT_NormalizeFileName(fileName: str) → str¶
Replaces any backslash in a file name with a forward slash.
- Parameters
fileName (str) – The file name to normalize.
- Returns
Returns the normalized file name.
- Return type
str
See also
NT_NormalizeFileName()
andNT_NormalizeToNative()
.
- NT_NormalizePath(path: str) → str¶
Replaces any backslash in a path with a forward slash and makes sure that the path ends with a trailing forward slash.
- Parameters
path (str) – The path to normalize.
- Returns
Returns the normalized path.
- Return type
str
See also
NT_NormalizeFileName()
andNT_NormalizeToNative()
.
- NT_NormalizeToNative(fileOrPath: str) → str¶
Replaces the slashes of a file name or path with the slashes expected by the current system (i.e., backslashes on Windows and slashes on Linux/macOS).
- Parameters
fileOrPath (str) – The file name or path to normalize.
- Returns
Returns the normalized file name or path.
- Return type
str
See also
NT_NormalizeFileName()
,NT_NormalizePath()
andNT_NormalizeToOrigin()
.
- NT_NormalizeToOrigin(fileOrPath: str) → str¶
Replaces the slashes of a file name or path with the slashes expected by the originating system (i.e., backslashes on Windows and slashes on Linux/macOS).
- Parameters
fileOrPath (str) – The file name or path to normalize.
- Returns
Returns the normalized file name or path.
- Return type
str
Available since Cerbero Suite 7.5 and Cerbero Engine 4.5.
See also
NT_NormalizeFileName()
,NT_NormalizePath()
andNT_NormalizeToNative()
.
- NT_OpenFile(FileName: str, opt: int = NTFileOpt_ReadOnly) → NT_FILE¶
Opens an existing file.
- Parameters
FileName (str) – The name of the file to open.
opt (int) – Optional file access. By the default files are opened as read-only (
NTFileOpt_ReadOnly
). To open them for writing,NTFileOpt_Write
must be specified.- Returns
Returns the handle of the opened file if successful; otherwise returns
None
.- Return type
NT_FILE
See also
NT_CreateFile()
,NT_CloseFile()
,NT_ReadFile()
andNT_WriteFile()
.
- NT_OpenProcess(pid: int, access: int = NT_ProcessAccess_Read) → NT_PROCESS¶
Retrieves a handle to a process.
Warning
The process API might not be available on all systems. Use
NT_HasProcessAPI()
to check the availability of the process API.
- Parameters
pid (int) – The process id.
access (int) – The access level required (e.g.,
NT_ProcessAccess_Read
).- Returns
Returns the handle of the process if successful; otherwise returns
None
.- Return type
NT_PROCESS
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_ReadProcessMemory()
,NT_WriteProcessMemory()
andNT_CloseProcess()
.
- class NT_PROCESS_INFO¶
This class contains information about a process.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_GetProcessList()
.Attributes:
The name of the process.
The full path of the process executable.
The process id.
The parent process id.
- NT_PathFromFileName(fileName: str) → str¶
Separates a path or file name from its trailing part. When passing a file name as argument, it will return its path.
- Parameters
fileName (str) – The file name or path.
- Returns
Returns the partial path as a normalized path.
- Return type
str
See also
NT_RawPathFromFileName()
,NT_FileNameFromPath()
andNT_FileExtFromName()
.
- NT_ProcessAccess_All: Final[int]¶
All process access privileges.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_OpenProcess()
.
- NT_ProcessAccess_Read: Final[int]¶
Process read access privileges.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_OpenProcess()
.
- NT_ProcessAccess_Terminate: Final[int]¶
Process termination access privileges.
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_OpenProcess()
.
- NT_RawPathFromFileName(fileName: str) → str¶
Behaves exactly like
NT_PathFromFileName()
, except that it retains the slashes of the input.
- Parameters
fileName (str) – The file name or path.
- Returns
Returns the partial path with its original slashes and with a trailing backslash or slash.
- Return type
str
See also
NT_RawPathFromFileName()
.
- NT_ReadFile(ntfile: NT_FILE, nBytesToRead: int) → bytes¶
Reads a specified amount of bytes from a file and updates the file position.
- Parameters
ntfile (NT_FILE) – The handle of the open file.
nBytesToRead (int) – The number of bytes to read.
- Returns
Returns the bytes read from the file if successful; otherwise returns an empty
bytes
object.- Return type
bytes
See also
NT_FileToBuffer()
,NT_WriteFile()
,NT_OpenFile()
,NT_CreateFile()
andNT_CloseFile()
.
- NT_ReadProcessMemory(proc: NT_PROCESS, MemoryAddr: int, nBytesToRead: int) → bytes¶
Reads the memory of a process.
- Parameters
proc (NT_PROCESS) – The process handle.
MemoryAddr (int) – The memory address to read from.
nBytesToRead (int) – The number of bytes to read.
- Returns
Returns the bytes read if successful; otherwise returns an empty
bytes
object.- Return type
bytes
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_OpenProcess()
andNT_WriteProcessMemory()
.
- NT_ResetFixedFileSize(ntfile: NT_FILE) → None¶
Resets the fixed file size set by calling
NT_SetFixedFileSize()
.
- Parameters
ntfile (NT_FILE) – The handle of the open file.
See also
NT_SetFixedFileSize()
.
- NT_ResolveShortcut(shortcut: str) → str¶
Resolves the target of a link (.lnk) file.
This operation is only supported on Windows.
- Parameters
shortcut (str) – The file name of the link to resolve.
- Returns
Returns the resolved target if successful; otherwise returns an empty string.
- Return type
str
See also
NT_CreateFileLink()
.
- NT_ResolveSymbol(ntmod: NT_MODULE, symname: str) → native_pointer¶
Resolves the symbol of a module.
- Parameters
ntmod (NT_MODULE) – The module handle.
symname (str) – The name of the symbol to resolve.
- Returns
Returns the address of the resolved symbol if successful; otherwise returns
None
.- Return type
native_pointer
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_LoadModule()
andNT_GetModule()
.
- NT_SetCurrentDirectory(dirName: str) → bool¶
Sets the current working directory.
- Parameters
dirName (str) – The directory to set as current working directory.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.
See also
NT_GetCurrentDirectory()
.
- NT_SetCustomTempFolder(path: str) → None¶
Sets a custom temporary folder to be used by the application.
- Parameters
path (str) – The path of the temporary directory.
Available since Cerbero Suite 7.5 and Cerbero Engine 4.5.
See also
NT_GetCustomTempFolder()
.
- NT_SetFileAutoDelete(ntfile: NT_FILE, auto_delete: bool) → None¶
Sets the auto-deletion flag for the file.
- Parameters
ntfile (NT_FILE) – The handle of the open file.
auto_delete (bool) – If
True
, the file is automatically deleted when closed.Available since Cerbero Suite 5.7 and Cerbero Engine 2.7.
See also
NT_CreateTempFile()
.
- NT_SetFilePos(ntfile: NT_FILE, FileOffset: int) → bool¶
Sets the current file position.
- Parameters
ntfile (NT_FILE) – The handle of the open file.
FileOffset (int) – The new file position.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
NT_GetFilePos()
.
- NT_SetFileSize(ntfile: NT_FILE, NewFileSize: int) → bool¶
Changes the size of a file.
A file may be increased in size as well as truncated.
- Parameters
ntfile (NT_FILE) – The handle of the open file.
NewFileSize (int) – The new file size.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
NT_GetFileSize()
.
- NT_SetFixedFileSize(ntfile: NT_FILE, FixedFileSize: int) → None¶
Sets the fixed size of a file.
This function doesn’t alter the real size of the file on disk. It only makes functions relying on
NT_GetFileSize()
believe that the size of the file is the one specified.Cancelling the effects of this operation can be achieved by calling
NT_ResetFixedFileSize()
.
- Parameters
ntfile (NT_FILE) – The handle of the open file.
FixedFileSize (int) – The file size to fake.
See also
NT_ResetFixedFileSize()
.
- NT_StripFileExt(fileName: str) → str¶
Strips the extension from a file name.
- Parameters
fileName (str) – The file name.
- Returns
Returns the file name without the extension.
- Return type
str
Available since Cerbero Suite 5.1 and Cerbero Engine 2.1.
See also
FileExtFromName()
andNT_FileNameFromPath()
.
- NT_TrashFile(fileName: str, showProgress: bool = False) → bool¶
Moves a file to the trash.
This operation may not be supported on every system.
- Parameters
fileName (str) – The name of the file to move to the trash.
showProgress (bool) – When
True
, shows the progress of the operation if supported.- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
NT_DeleteFile()
.
- NT_UnescapeCString(str: Union[bytes, str]) → Union[bytes, str]¶
Unescapes a C string (e.g.:
"Hello,\\nWorld!"
becomes"Hello,\nWorld!"
).
- Parameters
str (Union[bytes, str]) – The C string to unescape.
- Returns
Returns the unescaped string.
- Return type
Union[bytes, str]
See also
NT_MakeCString()
.
- NT_Win32FileTimeToDateTime(Time: int) → Pro.Core.NTDateTime¶
Converts a Windows
FILETIME
toNTDateTime
.
- Parameters
Time (int) – The
FILETIME
value.- Returns
Returns the converted
FILETIME
.- Return type
See also
NTDateTime
.
- NT_WriteFile(ntfile: NT_FILE, bytes: bytes) → bool¶
Writes the specified bytes to a file.
Important
The file must have been opened with
NTFileOpt_Write
for this function to succeeded.
- Parameters
ntfile (NT_FILE) – The handle of the open file.
bytes (bytes) – The bytes to write.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
NT_ReadFile()
,NT_OpenFile()
,NT_CreateFile()
andNT_CloseFile()
.
- NT_WriteProcessMemory(proc: NT_PROCESS, MemoryAddr: int, bytes: bytes) → bool¶
Writes the memory of a process.
- Parameters
proc (NT_PROCESS) – The process handle.
MemoryAddr (int) – The memory address to write to.
bytes (bytes) – The bytes to write.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NT_OpenProcess()
andNT_ReadProcessMemory()
.
- OFLAG_MORE_CHILDREN: Final[int]¶
Object flag.
This flag is set when the object reached the maximum number of allowed embedded objects.
See also
ScanProvider
.
- OFLAG_MORE_ENTRIES: Final[int]¶
Object flag.
This flag is set when the object reached the maximum number of allowed scan entries.
See also
ScanProvider
.
- OFLAG_MORE_SHELLCODE: Final[int]¶
Object flag.
This flag is set when the object reached the maximum number of allowed shellcode entries.
See also
ScanProvider
.
- OFLAG_NO_DECRYPT: Final[int]¶
Object flag.
This flag is set when the object couldn’t be decrypted.
See also
ScanProvider
andCFFN_NoDecrypt
.
- OFLAG_NO_UNPACK: Final[int]¶
Object flag.
This flag is set when the object couldn’t be decompressed.
See also
ScanProvider
andCFFN_NoUnpack
.
- OFLAG_PARSING_LIMIT: Final[int]¶
Object flag.
This flag is set when the parser for the object hit a parsing limit.
See also
ScanProvider
andCFFN_ParsingLimit
.
- OFLAG_UNPACK_LIMIT: Final[int]¶
Object flag.
This flag is set when the parser for the object hit a decompression limit.
See also
ScanProvider
andCFFN_UnpackLimit
.
- OFLAG_UNPACK_NESTING: Final[int]¶
Object flag.
This flag is set when the parser for the object hit a decompression nesting limit.
See also
ScanProvider
andCFFN_UnpackNestLimit
.
- class PDBAssociationInfo¶
This class contains association information for Windows PDB files.
The reason why it is declared in the core module is that it is shared across various other modules.
Methods:
UIDFromSignatureAndAge
(signature, age)Computes the unique identifier of the PDB from its signature and age.
Returns a
PDBAssociationInfo
instance from an XML string.Returns
True
if the PDB file is local; otherwise returnsFalse
.
isNull
()Returns
True
if the information is invalid; otherwise returnsFalse
.
makeURL
()Returns the last part of a web URL which can be used to download the PDB file.
matches
(other)Compares two
PDBAssociationInfo
instances.Converts the association information to an XML string.
Attributes:
The name of the PDB.
The unique identifier of the PDB.
- static UIDFromSignatureAndAge(signature: bytes, age: bytes) → str¶
Computes the unique identifier of the PDB from its signature and age.
- Parameters
signature (bytes) – The signature.
age (bytes) – The age.
- Returns
Returns the unique identifier.
- Return type
str
- static fromXMLString(s: str) → Pro.Core.PDBAssociationInfo¶
Returns a
PDBAssociationInfo
instance from an XML string.
- Parameters
s (str) – The XML string.
- Returns
Returns the association info.
- Return type
See also
toXMLString()
.
- isLocalFile() → bool¶
- Returns
Returns
True
if the PDB file is local; otherwise returnsFalse
.- Return type
bool
See also
name
.
- isNull() → bool¶
- Returns
Returns
True
if the information is invalid; otherwise returnsFalse
.- Return type
bool
- makeURL() → str¶
- Returns
Returns the last part of a web URL which can be used to download the PDB file.
- Return type
str
- matches(other: Pro.Core.PDBAssociationInfo) → bool¶
Compares two
PDBAssociationInfo
instances.
- Parameters
other (PDBAssociationInfo) – The other
PDBAssociationInfo
instance.- Returns
Returns
True
if the instances contain the same unique identifier; otherwise returnsFalse
.- Return type
bool
See also
uid
.
- name¶
The name of the PDB.
See also
isLocalFile()
.
- toXMLString() → str¶
Converts the association information to an XML string.
- Returns
Returns the XML string if successful; otherwise returns an empty string.
- Return type
str
See also
fromXMLString()
.
- uid¶
The unique identifier of the PDB.
See also
matches()
andUIDFromSignatureAndAge()
.
- class ProCoreContext¶
This class provides functionality for the current context.
The global instance of this class can be retrieved by calling
proCoreContext()
.See also
proCoreContext()
.Methods:
addObjectToReport
(target, filename[, …])Adds a root entry to the report after the main scanning operation.
Returns the arguments passed to the applications.
Closes the current project.
Returns the current scan provider if available; otherwise returns
None
.
downloadFile
(url, c_or_fname[, …])Downloads a file to either a
NTContainer
instance or to location on disk.
getLayout
(name)Retrieves a layout from the current layout pool.
Returns an instance of the current project if available; otherwise returns
None
.Returns the current scanning system if available; otherwise returns
None
.
hasLayout
(name)Checks for the presence of a layout in the current layout pool.
Checks whether the specified scan provider is the one currently being inspected in the analysis workspace.
Checks whether the specified scan provider is the hierarchy currently being inspected in the analysis workspace.
Returns
True
if a scanning operation is currently being performed; otherwise returnsFalse
.
isValid
()Returns
True
if the current context is valid; otherwise returnsFalse
.Retrieves the list of arguments for a logic provider invoked from the command line.
quit
()Gracefully quits the application.
registerLogicProvider
(name[, init, end, …])Registers a logic provider.
setSystem
(s)Sets the current scanning system.
startScan
(logic_prov_name)Starts a scan (or different) operation using the specified logic provider.
unregisterLogicProvider
(name)Unregisters a logic provider.
Returns
True
if the scan operation was aborted; otherwise returnsFalse
.
- addObjectToReport(target: str, filename: str, format: str = str(), risk: int = 0, flags: int = 0, report: bytes = bytes()) → bool¶
Adds a root entry to the report after the main scanning operation.
Example:
from Pro.Core import proCoreContext proCoreContext().addObjectToReport("kernel32.dll", r"c:\windows\system32\kernel32.dll")Hint
Internal files can also be referenced (see
Report.newInternalFileUID()
).
- Parameters
target (str) – The target name.
filename (str) – The file name as on disk.
format (str) – The format of the object.
risk (int) – The combined risk factor for the object and its embedded objects.
flags (int) – The combined flags for the object and its embedded objects (e.g.: OFLAG_NO_DECRYPT).
report (bytes) – The XML scan report for the object.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.
- applicationArguments() → Pro.Core.NTStringList¶
- Returns
Returns the arguments passed to the applications.
- Return type
See also
logicProviderArguments()
.
- closeReport() → None¶
Closes the current project.
See also
getReport()
.
- currentScanProvider() → Pro.Core.ScanProvider¶
- Returns
Returns the current scan provider if available; otherwise returns
None
.- Return type
See also
ScanProvider
.
- downloadFile(url: str, c_or_fname: Union[Pro.Core.NTContainer, str], post_dict_or_w: Union[Pro.Core.NTIWait, Pro.Core.NTStringStringHash] = NTStringStringHash(), post_dict: Pro.Core.NTStringStringHash = NTStringStringHash()) → bool¶
Downloads a file to either a
NTContainer
instance or to location on disk.Optionally a dictionary for POST requests can be specified (available since Cerbero Suite 5.6 and Cerbero Engine 2.6.).
Hint
For more complex web requests, use
ProWebRequest
.
- Parameters
url (str) – The URL of the file to download.
c_or_fname (Union[NTContainer, str]) – Either the
NTContainer
instance or the destination file name.post_dict_or_w (Union[NTIWait, NTStringStringHash]) – Either the wait object or the POST dictionary.
post_dict (NTStringStringHash) – The POST dictionary.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
ProWebRequest
andNTIWait
.
- getLayout(name: str) → Pro.Core.Layout¶
Retrieves a layout from the current layout pool.
- Parameters
name (str) – The name of the layout.
- Returns
Returns the layout if successful; otherwise returns an invalid layout.
- Return type
See also
hasLayout()
andLayout
.
- getReport() → Pro.Core.Report¶
- Returns
Returns an instance of the current project if available; otherwise returns
None
.- Return type
See also
Report
andcloseReport()
.
- getSystem() → Pro.Core.CommonSystem¶
- Returns
Returns the current scanning system if available; otherwise returns
None
.- Return type
See also
CommonSystem
andLocalSystem
.
- hasLayout(name: str) → bool¶
Checks for the presence of a layout in the current layout pool.
- Parameters
name (str) – The name of the layout.
- Returns
Returns
True
if the layout is present; otherwise returnsFalse
.- Return type
bool
See also
getLayout()
andLayout
.
- isCurrentScanProvider(sp: Pro.Core.ScanProvider) → bool¶
Checks whether the specified scan provider is the one currently being inspected in the analysis workspace.
- Parameters
sp (ScanProvider) – The scan provider.
- Returns
Returns
True
if the specified scan provider is the current one; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.
See also
isScanProviderInHierarchy()
.
- isScanProviderInHierarchy(sp: Pro.Core.ScanProvider) → bool¶
Checks whether the specified scan provider is the hierarchy currently being inspected in the analysis workspace.
- Parameters
sp (ScanProvider) – The scan provider.
- Returns
Returns
True
if the specified scan provider is in the analysis hierarchy; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.
See also
isCurrentScanProvider()
.
- isScanning() → bool¶
- Returns
Returns
True
if a scanning operation is currently being performed; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 5.1 and Cerbero Engine 2.1.
- isValid() → bool¶
- Returns
Returns
True
if the current context is valid; otherwise returnsFalse
.- Return type
bool
- logicProviderArguments() → Pro.Core.NTStringList¶
Retrieves the list of arguments for a logic provider invoked from the command line.
- Returns
Retrieves the list of arguments if the logic provider was invoked from the command line; otherwise returns an empty
NTStringList
instance.- Return type
Available since Cerbero Suite 5.7 and Cerbero Engine 2.7.
- quit() → None¶
Gracefully quits the application.
See also
proAbort()
.
- registerLogicProvider(name: str, init: Optional[object] = None, end: Optional[object] = None, scanning: Optional[object] = None, scanned: Optional[object] = None, rload: Optional[object] = None) → None¶
Registers a logic provider.
- Parameters
name (str) – The unique name of the logic provider.
init (object) – The init callback of the logic provider.
end (object) – The end callback of the logic provider.
scanning (object) – The scanning callback of the logic provider.
scanned (object) – The scanned callback of the logic provider.
rload (object) – The rload callback of the logic provider.
See also
unregisterLogicProvider()
andstartScan()
.
- setSystem(s: object) → None¶
Sets the current scanning system.
- Parameters
s (object) – The scanning system to set.
See also
getSystem()
andstartScan()
.
- startScan(logic_prov_name: str) → None¶
Starts a scan (or different) operation using the specified logic provider.
- Parameters
logic_prov_name (str) – The name of the logic provider.
See also
registerLogicProvider()
andunregisterLogicProvider()
.
- unregisterLogicProvider(name: str) → None¶
Unregisters a logic provider.
- Parameters
name (str) – The name of the logic provider.
See also
registerLogicProvider()
andstartScan()
.
- wasAborted() → bool¶
- Returns
Returns
True
if the scan operation was aborted; otherwise returnsFalse
.- Return type
bool
See also
startScan()
andsetSystem()
.
- class ProGlobalSettings¶
This class provides access to the main settings of the application.
In order to avoid conflicts, extensions should use either
ProSettings
or class:ProValueStorage to store settings.See also
ProSettings
andProValueStorage
.Methods:
getValue
(key[, defval])Retrieves a value.
setValue
(key, value)Sets a value.
- static getValue(key: str, defval: Optional[Union[int, float, bool, bytes, str]] = None) → Optional[Union[int, float, bool, bytes, str]]¶
Retrieves a value.
- Parameters
key (str) – The key of the value to retrieve. The key should be a path containing forward slashes.
defval (BasicType) – The default value to return in case the key is not present.
- Returns
Returns the requested value if present; otherwise returns either
None
or the default value if specified.- Return type
BasicType
See also
setValue()
.
- static setValue(key: str, value: Optional[Union[int, float, bool, bytes, str]]) → bool¶
Sets a value.
- Parameters
key (str) – The key of the value to set. The key should be a path containing forward slashes.
value (BasicType) – The value to set.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
getValue()
.
- class ProPlugin¶
This class represents a generic plugin.
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
See also
proGetAvailablePlugins()
andProPluginInterface
.Methods:
invoke
(name[, params])Invokes a method in the plugin.
- invoke(name: str, params: Pro.Core.CFFContainerList = CFFContainerList()) → Pro.Core.CFFContainerList¶
Invokes a method in the plugin.
- Parameters
name (str) – The name of the method to invoke.
params (CFFContainerList) – Optional parameters for the method.
- Returns
Returns a list of
CFFContainer
instances.- Return type
- class ProPluginInterface¶
This class represents a generic plugin interface.
Note
This class must be derived to create a generic plugin.
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
See also
proGetAvailablePlugins()
andProPlugin
.Methods:
onInvoke
(name[, params])Calls a mehod of the plugin.
- onInvoke(name: str, params: Pro.Core.CFFContainerList = CFFContainerList()) → Pro.Core.CFFContainerList¶
Calls a mehod of the plugin.
Note
This method is called when
ProPlugin.invoke()
is invoked and must be overridden by the actual implementation.
- Parameters
name (str) – The name of the method to be invoked.
params (CFFContainerList) – Optional parameters.
- Returns
Returns a list of
CFFContainer
instances.- Return type
- class ProPluginList¶
List of
ProPlugin
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: Pro.Core.ProPlugin) → None¶
Inserts
value
at the end of the list.
- Parameters
value (ProPlugin) – The value to add to the list.
See also
insert()
.
- at(i: int) → Pro.Core.ProPlugin¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
- clear() → None¶
Removes all items from the list.
- contains(value: Pro.Core.ProPlugin) → bool¶
Checks the presence of an element in the list.
- Parameters
value (ProPlugin) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: Pro.Core.ProPlugin) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (ProPlugin) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: Pro.Core.ProPlugin, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (ProPlugin) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: Pro.Core.ProPlugin) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (ProPlugin) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.ProPluginListIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: Pro.Core.ProPlugin) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (ProPlugin) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → Pro.Core.ProPlugin¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
See also
removeAt()
.
- class ProPluginListIt(obj: Pro.Core.ProPluginList)¶
Iterator class for
ProPluginList
.
- Parameters
obj (ProPluginList) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → Pro.Core.ProPlugin¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
See also
hasNext()
andprevious()
.
- previous() → Pro.Core.ProPlugin¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class ProSettings¶
This class provides access to settings.
The settings accessed from this class are specific for extensions. Use
ProGlobalSettings
to access the settings of the main application.See also
ProGlobalSettings
andProValueStorage
.Methods:
getValue
(key[, defval])Retrieves a value.
setValue
(key, value)Sets a value.
- static getValue(key: str, defval: Optional[Union[int, float, bool, bytes, str]] = None) → Optional[Union[int, float, bool, bytes, str]]¶
Retrieves a value.
- Parameters
key (str) – The key of the value to retrieve. The key should be a path containing forward slashes.
defval (BasicType) – The default value to return in case the key is not present.
- Returns
Returns the requested value if present; otherwise returns either
None
or the default value if specified.- Return type
BasicType
See also
setValue()
.
- static setValue(key: str, value: Optional[Union[int, float, bool, bytes, str]]) → bool¶
Sets a value.
- Parameters
key (str) – The key of the value to set. The key should be a path containing forward slashes.
value (BasicType) – The value to set.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
getValue()
.
- class ProTextPrintBuffer¶
Bases:
Pro.Core.NTTextStream
This is a class derived from
NTTextStream
.Any data printed to this class is directly passed to
proPrint()
.Available since Cerbero Suite 5.3 and Cerbero Engine 2.3.
See also
proPrint()
,NTTextStream
,NTTextBuffer
andNTTextStringBuffer
.
- class ProValueStorage¶
This class provides SQLite-backed key -> value storage facility.
See also
appDataDir()
,userConfigDir()
,ProSettings
andProGlobalSettings
.Methods:
close
()Closes the database.
Returns the database name.
getKeyCount
(tname)Returns the number of keys in a specified table.
getKeys
(tname)Retrieves the keys in a specified table.
getValue
(tname, key)Retrieves a value from a specified table given a specified key.
open
([create, fast])Opens the database.
Opens the database as read-only.
remove
(tname, key)Removes an entry from a specified table given a specified key.
setDatabaseName
(name)Sets the name of the database.
setValue
(tname, key, value)Sets an entry in a specified table given a key and value.
- close() → None¶
Closes the database.
Hint
The database is closed automatically when unreferenced.
See also
isNull()
,setDatabaseName()
andopen()
.
- databaseName() → str¶
- Returns
Returns the database name.
- Return type
str
See also
setDatabaseName()
andopen()
.
- getKeyCount(tname: str) → int¶
Returns the number of keys in a specified table.
- Parameters
tname (str) – The name of the table.
- Returns
Returns the number of keys.
- Return type
int
See also
getKeys()
andgetValue()
.
- getKeys(tname: str) → Pro.Core.NTStringList¶
Retrieves the keys in a specified table.
- Parameters
tname (str) – The name of the table.
- Returns
Returns the list of keys.
- Return type
See also
getValue()
.
- getValue(tname: str, key: str) → str¶
Retrieves a value from a specified table given a specified key.
- Parameters
tname (str) – The name of the table.
key (str) – The key.
- Returns
Returns the requested value if present; otherwise returns an empty string.
- Return type
str
See also
setValue()
andgetKeys()
.
- open(create: bool = True, fast: bool = False) → bool¶
Opens the database.
- Parameters
create (bool) – If
True
, creates the database if not yet present on disk. IfFalse
and the database is not yet present on disk, the method will fail.- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
setDatabaseName()
,openReadOnly()
andclose()
.
- openReadOnly() → bool¶
Opens the database as read-only.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.
See also
setDatabaseName()
,open()
andclose()
.
- remove(tname: str, key: str) → bool¶
Removes an entry from a specified table given a specified key.
- Parameters
tname (str) – The name of the table.
key (str) – The key of the entry to remove.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
setValue()
andgetValue()
.
- setDatabaseName(name: str) → None¶
Sets the name of the database.
- Parameters
name (str) – The name of the database.
See also
databaseName()
.
- setValue(tname: str, key: str, value: str) → bool¶
Sets an entry in a specified table given a key and value.
- Parameters
tname (str) – The name of the table.
key (str) – The key of the entry.
value (str) – The value of the entry.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
getValue()
andremove()
.
- class ProWebRequest(url: str = str())¶
This class can be used to make a web request.
Available since Cerbero Suite 6.0 and Cerbero Engine 3.0.
- Parameters
url (str) – The URL for the request.
Methods:
addFormValue
(name, value)Adds a form value to the request.
addHeader
(header)Adds an HTTP header to the request.
addHeaderValue
(name, value)Adds an HTTP header-value pair to the request.
execute
()Executes the request.
Returns the error code.
readCallback
(size)This method can be overwritten to provide input data for the request.
setInput
(input)Sets the input data container for the request.
setInputSize
(input_size)Sets the size of the input data for the request.
setOutput
(output)Sets the container which receives the data of the response.
setURL
(url)Sets the URL for the request.
setWaitObject
(wo)Sets the wait object for the request.
writeCallback
(data)This method can be overwritten to receive the response for the request.
- addFormValue(name: str, value: str) → None¶
Adds a form value to the request.
- Parameters
name (str) – The name of the value.
value (str) – The value.
- addHeader(header: str) → None¶
Adds an HTTP header to the request.
- Parameters
header (str) – The header.
See also
addHeaderValue()
.
- addHeaderValue(name: str, value: str) → None¶
Adds an HTTP header-value pair to the request.
- Parameters
name (str) – The name of the header.
value (str) – The value of the header.
Available since Cerbero Suite 6.5 and Cerbero Engine 3.5.
See also
addHeader()
.
- execute() → bool¶
Executes the request.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
- getErrorCode() → int¶
- Returns
Returns the error code.
- Return type
int
- readCallback(size: int) → bytes¶
This method can be overwritten to provide input data for the request.
The total size of the input data must be specified by calling
setInputSize()
.
- Parameters
size (int) – The amount of data to read.
- Returns
Returns the data read if successful; otherwise returns an empty
bytes
object.- Return type
bytes
Available since Cerbero Suite 6.5 and Cerbero Engine 3.5.
See also
setInputSize()
.
- setInput(input: Pro.Core.NTContainer) → None¶
Sets the input data container for the request.
- Parameters
input (NTContainer) – The input data.
Available since Cerbero Suite 6.5 and Cerbero Engine 3.5.
See also
setOutput()
,setInputSize()
andreadCallback()
.
- setInputSize(input_size: int) → None¶
Sets the size of the input data for the request.
Hint
When
setInput()
is used, it is not necessary to call this method.
- Parameters
input_size (int) – The size of the input data.
Available since Cerbero Suite 6.5 and Cerbero Engine 3.5.
See also
readCallback()
andsetInput()
.
- setOutput(output: Pro.Core.NTContainer) → None¶
Sets the container which receives the data of the response.
- Parameters
output (NTContainer) – The output container.
See also
setInput()
.
- setURL(url: str) → None¶
Sets the URL for the request.
- Parameters
url (str) – The URL for the request.
- setWaitObject(wo: Pro.Core.NTIWait) → None¶
Sets the wait object for the request.
- Parameters
wo (NTIWait) – The wait object.
See also
NTIWait
.
- writeCallback(data: bytes) → bool¶
This method can be overwritten to receive the response for the request.
- Parameters
data (bytes) – Part of the received response.
- Returns
Returns
True
to continue the operation; otherwise returnsFalse
.- Return type
bool
- REPORT_INT_ODB_NAME: Final[str]¶
Name of the internal files database.
Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.
See also
Report
.
- REPORT_INT_PATH: Final[str]¶
Name of the internal files path.
Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.
See also
Report
.
- REPORT_INT_ROOT_PREFIX: Final[str]¶
The prefix used to reference internal files from root entries.
Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.
See also
Report
.
- class Report¶
This class represents a project.
A project can be unpacked or packed. When it’s unpacked, it consists of a directory containing a number of DBs and other files. When it’s packed, the same files are merged into a single file and may be compressed and/or encrypted. Fundamentally, in the context of file scanning, a project contains a SQLite3 database which, in turn, contains XML reports for each scanned file. The current instance of this class is returned by
ProCoreContext.getReport()
.Internally, a project contains at least two databases. The first one is the main database, which contains miscellaneous information like data layouts or user notes. The second one is the object database, which contains the XML reports for each scanned file.
See also
proCoreContext()
andProCoreContext
.Attributes:
Saves the project as a background operation.
Compresses the files when saving them.
Includes scanned files into the project.
Saves the project as unpacked.
Methods:
close
()Closes the project.
Returns the identifying name of the current target .
Returns the text key for the current target.
dataBase
()Returns the handle of the main project SQLite3 database.
Returns the file name of the main project SQLite3 database.
Returns the path of the main project SQLite3 database.
deleteLayout
(key)Deletes a data layout.
deleteText
(table, key)Deletes a text entry.
Enables error messages to be shown to the user.
flush
()Flushes changes to the object database.
Returns all bookmark entry keys.
getBookmarks
(key)Retrieves the bookmarks for a specific object.
getCarbonDBName
(tlink, uid)Returns a Carbon database name.
getCarbonDBNames
(tlink)Retrieves all Carbon database names for a specific target.
getLayout
(key)Retrieves a layout.
Returns the list of keys of all layout entries.
Returns the list of logic providers used to create the file reports.
getNotes
(key)Retrieves the notes for a specific target.
getNotesCfg
(key)Retrieves the notes configuration for a specific target.
Returns the list of keys of all notes entries.
getText
(table, key)Retrieves a text entry.
getTextCfg
(table, key)Gets the configuration for a text entry.
getTextEntries
(table)Retrieves a list of keys of all the text entries in a specific table.
Returns the key for the global text entry.
hasBookmarks
(key)Checks the presence of bookmarks for a specific target.
hasLayout
(key)Checks the presence of a layout for a specific target.
hasNotes
(key)Checks the presence of notes for a specific target.
hasText
(table, key)Checks the presence of a text entry for a specific target.
Returns
True
if the project includes the scanned files; otherwise returnsFalse
.Returns
True
if the project was modified; otherwise returnsFalse
.
isNull
()Returns
True
if the project is invalid; otherwise returnsFalse
.Returns
True
if the project was packed; otherwise returnsFalse
.Returns
True
if the project hasn’t yet been saved; otherwise returnsFalse
.
isValid
()Returns
True
if the project is valid; otherwise returnsFalse
.
newCarbonDBFileName
(tlink, uid)Creates a new Carbon database name.
newInternalFilePath
(uid)Retrieves the path on disk for a yet unsaved internal file.
Generates a new internal file id.
objAdd
(target, filename, format, risk, …)Adds an entry to the object database.
objBegin
()Starts a multi-part transaction to the object database.
objCount
()Returns the number of entries in the object database.
objCursorDestroy
(cur)Destroys a cursor for the object database.
Returns the cursor pointing at the first entry in the object database.
objCursorFromTarget
(target)Returns a cursor for the object database from a target name.
Returns
True
if there are object entries before the entry referenced by the cursor; otherwise returnsFalse
.
objCursorInfo
(cur, info)Returns information about the object entry referenced by the cursor.
objCursorNext
(cur)Makes the cursor for the object database point at the next entry.
objCursorPosition
(cur)Converts the cursor for the object database into a 0-based entry index.
objCursorPrevious
(cur)Makes the cursor for the object database point at the previous entry.
objCursorRisk
(cur)Returns the risk factor of the object entry referenced by the cursor.
objCursorSetFileName
(cur, filename)Updates the file name field for the object entry referenced by the cursor.
objCursorSetOffset
(cur, offset)Updates the offset field for the object entry referenced by the cursor.
objEnd
()Ends a multi-part transaction to the object database.
objFlush
()Flushes the object database.
Returns a list of file names which constitute the object database.
objGetInfo
(target, info)Returns information about an object entry given a target name.
objGetReport
(target)Returns the XML report of an object entry given a target name.
objGetRisk
(target)Returns the risk factor of an object entry given a target name.
Returns
True
if the object database supports anobjCount()
method; otherwise returnsFalse
.Returns
True
if the object database needs to be flushed; otherwise returnsFalse
.
objRemove
(target)Removes an object entry given a target name.
objRemove2
(target, view)Removes an object entry given a target name and a object database view.
objSetFileName
(target, filename)Updates the file name field of an object entry given a target name.
objSetFormat
(target, format)Updates the format field of an object entry given a target name.
objSetReport
(target, report)Updates the XML report of an object entry given a target name.
objSetRisk
(target, risk, flags)Updates the risk and flags fields of an object entry given a target name.
objViewCount
(view)Returns the number of object entries in the specified window view.
objViewCreate
(vi)Creates a window view of the entries in the object database.
objViewCursor
(view, pos)Returns a cursor for the object database view given an index.
objViewDestroy
(view)Destroys a window view of the object database.
objViewInfo
(view, pos, info)Returns information about an object entry in a window view given an index position.
objViewSetFileName
(view, pos, filename)Updates the file name field for the object entry in the window view given an index position.
openDatabase
(dir)Opens the main and object databases in a given directory.
openProject
(name)Opens a packed or unpacked project.
Returns the name of the packed project.
removeCarbonDBName
(tlink, uid)Removes a Carbon database name.
removeCarbonDBNames
(tlink)Removes all Carbon database names for a given target.
renameLayout
(key, new_key)Renames a data layout.
renameText
(table, key, new_key)Renames a text entry.
retrieveFile
(info_or_target[, context])Retrieves a file included in the project.
retrieveInternalFile
(uid)Retrieves an internal file.
saveAs
(path[, options, password])Saves the project.
saveInternalFile
(uid[, display_name, …])Saves a new internal file.
setBookmarks
(key, bm)Sets the bookmarks for a specific object.
setCarbonDBName
(tlink, uid, dbname)Sets a Carbon database name.
Sets the target currently being analyzed by the user in the workspace.
setLayout
(key, layout)Sets a data layout.
Sets the list of logic providers used to create the file reports.
setModified
(b)Sets the modified status of the project.
setNotes
(key, notes[, cfg])Set the notes for a specific target.
setText
(table, key, txt)Sets a text entry.
Returns the file name of the internal
CFFHeader
of this project (often referred to as the ‘this’ header).
- Save_Unpacked: Final[int]¶
Saves the project as unpacked.
When this option is specified,
Save_Compressed
andSave_IncludeFiles
have no effect.See also
saveAs()
.
- close() → None¶
Closes the project.
See also
openDatabase()
andsaveAs()
.
- currentTarget() → str¶
- Returns
Returns the identifying name of the current target .
- Return type
str
See also
setCurrentTarget()
.
- currentTextKey() → str¶
Returns the text key for the current target.
This key is used to retrieve data such as notes for the current target.
- Returns
Returns the text key.
- Return type
str
See also
currentTarget()
.
- dataBase() → sqlite3¶
Returns the handle of the main project SQLite3 database.
This database does not contain reports of scanned files.
- Returns
Returns the SQLite3 handle.
- Return type
sqlite3
See also
dataBaseFileName()
anddataBasePath()
.
- dataBaseFileName() → str¶
Returns the file name of the main project SQLite3 database.
This database does not contain reports of scanned files.
- Returns
Returns the database file name.
- Return type
str
See also
dataBase()
,dataBasePath()
andprojectFileName()
..
- dataBasePath() → str¶
Returns the path of the main project SQLite3 database.
This is the root path of the unpacked project.
- Returns
Returns the root path of the unpacked project.
- Return type
str
See also
dataBase()
,dataBaseFileName()
andprojectFileName()
.
- deleteLayout(key: str) → bool¶
Deletes a data layout.
- Parameters
key (str) – The key of the layout entry.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
getLayout()
andsetLayout()
.
- deleteText(table: str, key: str) → bool¶
Deletes a text entry.
- Parameters
table (str) – The table name.
key (str) – The key of the text entry.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
- enableErrorMessages(b: bool) → None¶
Enables error messages to be shown to the user.
- Parameters
b (bool) – If
True
, enables error messages; otherwise disables them.Available since Cerbero Suite 7.2 and Cerbero Engine 4.2.
- getBookmarkEntries() → Pro.Core.NTStringList¶
- Returns
Returns all bookmark entry keys.
- Return type
See also
getBookmarks()
andsetBookmarks()
.
- getBookmarks(key: str) → str¶
Retrieves the bookmarks for a specific object.
- Parameters
key (str) – The key of the bookmark entry to retrieve.
- Returns
Returns the bookmarks for the specified object if successful; otherwise returns an empty string.
- Return type
str
See also
setBookmarks()
andgetBookmarkEntries()
.
- getCarbonDBName(tlink: str, uid: int) → str¶
Returns a Carbon database name.
- Parameters
tlink (str) – The target for which to retrieve the database name.
uid (int) – The unique id of the database.
- Returns
Returns the name of the database.
- Return type
str
See also
getCarbonDBNames()
.
- getCarbonDBNames(tlink: str) → Pro.Core.NTStringList¶
Retrieves all Carbon database names for a specific target.
- Parameters
tlink (str) – The target for which to retrieve the list of Carbon database names.
- Returns
Returns the list of Carbon database names.
- Return type
See also
getCarbonDBName()
.
- getLayout(key: str) → str¶
Retrieves a layout.
- Parameters
key (str) – The key of the layout entry.
- Returns
Returns the layout if successful; otherwise returns an empty string.
- Return type
str
See also
setLayout()
anddeleteLayout()
.
- getLayoutEntries() → Pro.Core.NTStringList¶
- Returns
Returns the list of keys of all layout entries.
- Return type
See also
setLayout()
anddeleteLayout()
.
- getLogicProviders() → Pro.Core.NTStringList¶
- Returns
Returns the list of logic providers used to create the file reports.
- Return type
- getNotes(key: str) → str¶
Retrieves the notes for a specific target.
- Parameters
key (str) – The target for which to retrieve the notes.
- Returns
Returns the notes if successful; otherwise returns an empty string.
- Return type
str
See also
setNotes()
andgetNotesCfg()
.
- getNotesCfg(key: str) → str¶
Retrieves the notes configuration for a specific target.
- Parameters
key (str) – The target for which to retrieve the settings.
- Returns
Returns the configuration if successful; otherwise returns an empty string.
- Return type
str
See also
getNotes()
andsetNotes()
.
- getNotesEntries() → Pro.Core.NTStringList¶
- Returns
Returns the list of keys of all notes entries.
- Return type
See also
getNotes()
andsetNotes()
.
- getText(table: str, key: str) → str¶
Retrieves a text entry.
- Parameters
table (str) – The table name.
key (str) – The key of the text entry.
- Returns
Returns the text if successful; otherwise returns an empty string.
- Return type
str
See also
setText()
anddeleteText()
.
- getTextCfg(table: str, key: str) → str¶
Gets the configuration for a text entry.
- Parameters
table (str) – The table name.
key (str) – The key of the text entry.
- Returns
Returns the text configuration if successful; otherwise returns an empty string.
- Return type
str
See also
getText()
,setText()
anddeleteText()
.
- getTextEntries(table: str) → Pro.Core.NTStringList¶
Retrieves a list of keys of all the text entries in a specific table.
- Parameters
table (str) – The table name.
- Returns
Returns the list of keys.
- Return type
- globalTextKey() → str¶
- Returns
Returns the key for the global text entry.
- Return type
str
See also
getNotes()
andsetNotes()
.
- hasBookmarks(key: str) → bool¶
Checks the presence of bookmarks for a specific target.
- Parameters
key (str) – The target for which to check the presence of bookmarks.
- Returns
Returns
True
if the target has bookmarks; otherwise returnsFalse
.- Return type
bool
See also
getBookmarks()
andsetBookmarks()
.
- hasLayout(key: str) → bool¶
Checks the presence of a layout for a specific target.
- Parameters
key (str) – The target for which to check the presence of a layout.
- Returns
Returns
True
if the target has a layout; otherwise returnsFalse
.- Return type
bool
See also
getLayout()
andsetLayout()
.
- hasNotes(key: str) → bool¶
Checks the presence of notes for a specific target.
- Parameters
key (str) – The target for which to check the presence of notes.
- Returns
Returns
True
if the target has notes; otherwise returnsFalse
.- Return type
bool
See also
getNotes()
andsetNotes()
.
- hasText(table: str, key: str) → bool¶
Checks the presence of a text entry for a specific target.
- Parameters
table (str) – The table name.
key (str) – The target for which to check the presence of the text entry.
- Returns
Returns
True
if the target has a text entry; otherwise returnsFalse
.- Return type
bool
- includesFiles() → bool¶
- Returns
Returns
True
if the project includes the scanned files; otherwise returnsFalse
.- Return type
bool
See also
saveAs()
.
- isModified() → bool¶
- Returns
Returns
True
if the project was modified; otherwise returnsFalse
.- Return type
bool
See also
saveAs()
andsetModified()
.
- isNull() → bool¶
- Returns
Returns
True
if the project is invalid; otherwise returnsFalse
.- Return type
bool
See also
isValid()
.
- isProject() → bool¶
- Returns
Returns
True
if the project was packed; otherwise returnsFalse
.- Return type
bool
See also
isTemporary()
.
- isTemporary() → bool¶
- Returns
Returns
True
if the project hasn’t yet been saved; otherwise returnsFalse
.- Return type
bool
See also
isProject()
.
- isValid() → bool¶
- Returns
Returns
True
if the project is valid; otherwise returnsFalse
.- Return type
bool
See also
isNull()
.
- newCarbonDBFileName(tlink: str, uid: int) → str¶
Creates a new Carbon database name.
- Parameters
tlink (str) – The name of the target.
uid (int) – The unique id for the database.
- Returns
Returns the name of the database if successful; otherwise returns an empty string.
- Return type
str
See also
getCarbonDBName()
.
- newInternalFilePath(uid: str) → str¶
Retrieves the path on disk for a yet unsaved internal file.
- Parameters
uid (str) – The internal file id.
- Returns
Returns the file path if successful; otherwise returns an empty string.
- Return type
str
Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.
See also
newInternalFileUID()
,saveInternalFile()
,retrieveInternalFile()
,ScanProvider.addInternalFile()
andProCoreContext.addObjectToReport()
.
- newInternalFileUID() → str¶
Generates a new internal file id.
Example:
from Pro.Core import * def main(): sp = proCoreContext().currentScanProvider() if not sp: return r = sp.getGlobalReport() if not r: return uid = r.newInternalFileUID() if not uid: return path = r.newInternalFilePath(uid) if not path: return with open(path, "w") as f: f.write("hello " * 5) if r.saveInternalFile(uid, "Test", "Test"): # add child object sp.addInternalFile(uid, "", "Internal File") # add root entry proCoreContext().addObjectToReport("Test", REPORT_INT_ROOT_PREFIX + uid) main()
- Returns
Returns the unique id if successful; otherwise returns an empty string.
- Return type
str
Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.
See also
newInternalFilePath()
,saveInternalFile()
,retrieveInternalFile()
,ScanProvider.addInternalFile()
andProCoreContext.addObjectToReport()
.
- objAdd(target: str, filename: str, format: str, risk: int, flags: int, report: bytes) → bool¶
Adds an entry to the object database.
- Parameters
target (str) – The target name.
filename (str) – The file name as on disk.
format (str) – The format of the object.
risk (int) – The combined risk factor for the object and its embedded objects.
flags (int) – The combined flags for the object and its embedded objects (e.g.:
OFLAG_NO_DECRYPT
).report (bytes) – The XML scan report for the object.
- Returns
Returns
True
if the entry was added to the database; otherwise returnsFalse
.- Return type
bool
See also
objGetReport()
.
- objCount() → int¶
- Returns
Returns the number of entries in the object database.
- Return type
int
See also
objHasCount()
andobjCursorPosition()
.
- objCursorDestroy(cur: objdbcur) → None¶
Destroys a cursor for the object database.
- Parameters
cur (objdbcur) – The cursor to destroy.
See also
objCursorFirst()
andobjCursorNext()
.
- objCursorFirst() → objdbcur¶
Returns the cursor pointing at the first entry in the object database.
- Returns
Returns the cursor if the object database has entries; otherwise returns an invalid cursor.
- Return type
objdbcur
See also
objCursorNext()
andobjCursorPrevious()
.
- objCursorFromTarget(target: str) → objdbcur¶
Returns a cursor for the object database from a target name.
- Parameters
target (str) – The target name.
- Returns
Returns the cursor if the target is present in the object database; otherwise returns an invalid cursor.
- Return type
objdbcur
See also
objCursorFirst()
andobjCursorNext()
.
- objCursorHasPrevious() → bool¶
- Returns
Returns
True
if there are object entries before the entry referenced by the cursor; otherwise returnsFalse
.- Return type
bool
See also
objCursorPrevious()
andobjCursorNext()
.
- objCursorInfo(cur: objdbcur, info: objdb_info) → bool¶
Returns information about the object entry referenced by the cursor.
- Parameters
cur (objdbcur) – The cursor for the object database.
info (objdb_info) – The output information.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
objGetReport()
,objCursorRisk()
andobjdb_info
.
- objCursorNext(cur: objdbcur) → bool¶
Makes the cursor for the object database point at the next entry.
- Parameters
cur (objdbcur) – The cursor for the object database.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
objCursorFirst()
andobjCursorInfo()
.
- objCursorPosition(cur: objdbcur) → int¶
Converts the cursor for the object database into a 0-based entry index.
- Parameters
cur (objdbcur) – The cursor for the object database.
- Returns
Returns the 0-based entry index.
- Return type
int
See also
objCursorFirst()
andobjCursorNext()
.
- objCursorPrevious(cur: objdbcur) → bool¶
Makes the cursor for the object database point at the previous entry.
- Parameters
cur (objdbcur) – The cursor for the object database.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
objCursorHasPrevious()
andobjCursorNext()
.
- objCursorRisk(cur: objdbcur) → int¶
Returns the risk factor of the object entry referenced by the cursor.
- Parameters
cur (objdbcur) – The cursor for the object database.
- Returns
Returns the risk factor.
- Return type
int
See also
objGetReport()
andobjCursorInfo()
.
- objCursorSetFileName(cur: objdbcur, filename: str) → bool¶
Updates the file name field for the object entry referenced by the cursor.
- Parameters
cur (objdbcur) – The cursor for the object database.
filename (str) – The new file name to set.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
objCursorSetOffset()
.
- objCursorSetOffset(cur: objdbcur, offset: int) → bool¶
Updates the offset field for the object entry referenced by the cursor.
The offset field is used only when the project includes scanned files.
- Parameters
cur (objdbcur) – The cursor for the object database.
offset (int) – The new offset to set.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
objCursorSetFileName()
.
- objEnd() → None¶
Ends a multi-part transaction to the object database.
See also
objStart()
.
- objFlush() → None¶
Flushes the object database.
See also
objNeedsFlush()
.
- objGetFiles() → Pro.Core.NTStringList¶
- Returns
Returns a list of file names which constitute the object database.
- Return type
- objGetInfo(target: str, info: Pro.Core.objdb_info) → bool¶
Returns information about an object entry given a target name.
- Parameters
target (str) – The target name.
info (objdb_info) – The output information.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
objGetReport()
andobjGetRisk()
.
- objGetReport(target: str) → bytes¶
Returns the XML report of an object entry given a target name.
- Parameters
target (str) – The target name.
- Returns
Returns the utf-8 XML report if successful; otherwise returns an empty byte-array.
- Return type
bytes
See also
objGetInfo()
andobjGetRisk()
.
- objGetRisk(target: str) → int¶
Returns the risk factor of an object entry given a target name.
- Parameters
target (str) – The target name.
- Returns
Returns the risk factor if successful; otherwise returns
0
.- Return type
int
See also
objGetInfo()
andobjGetReport()
.
- objHasCount() → bool¶
- Returns
Returns
True
if the object database supports anobjCount()
method; otherwise returnsFalse
.- Return type
bool
See also
objCount()
andobjCursorPosition()
.
- objNeedsFlush() → bool¶
- Returns
Returns
True
if the object database needs to be flushed; otherwise returnsFalse
.- Return type
bool
See also
objFlush()
.
- objRemove(target: str) → bool¶
Removes an object entry given a target name.
- Parameters
target (str) – The target name.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
objRemove2()
.
- objRemove2(target: str, view: objdbview) → bool¶
Removes an object entry given a target name and a object database view.
- Parameters
target (str) – The target name.
view (objdbview) – The object database view.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
objRemove()
.
- objSetFileName(target: str, filename: str) → bool¶
Updates the file name field of an object entry given a target name.
- Parameters
target (str) – The target name.
filename (str) – The new file name to set.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
objCursorSetFileName()
.
- objSetFormat(target: str, format: str) → bool¶
Updates the format field of an object entry given a target name.
- Parameters
target (str) – The target name.
format (str) – The new format to set.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.
- objSetReport(target: str, report: bytes) → bool¶
Updates the XML report of an object entry given a target name.
- Parameters
target (str) – The target name.
report (bytes) – The new XML report to set.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
objGetReport()
.
- objSetRisk(target: str, risk: int, flags: int) → bool¶
Updates the risk and flags fields of an object entry given a target name.
- Parameters
target (str) – The target name.
risk (int) – The new risk to set.
flags (int) – The new flags to set.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.
See also
objGetRisk()
.
- objViewCount(view: objdbview) → int¶
Returns the number of object entries in the specified window view.
- Parameters
view (objdbview) – The object database view.
- Returns
Returns the number of object entries.
- Return type
int
See also
objViewCreate()
,objCursorFirst()
andobjCursorNext()
.
- objViewCreate(vi: objdbview_info) → objdbview¶
Creates a window view of the entries in the object database.
- Parameters
vi (objdbview_info) – Specifies the parameters for the view.
- Returns
Returns the requested window view.
- Return type
objdbview
See also
objViewInfo()
,objViewDestroy()
andobjdbview_info
.
- objViewCursor(view: objdbview, pos: int) → objdbcur¶
Returns a cursor for the object database view given an index.
- Parameters
view (objdbview) – The object database view.
pos (int) – The 0-based index.
- Returns
Returns the cursor for the object database.
- Return type
objdbcur
See also
objViewCreate()
,objCursorNext()
andobjCursorInfo()
.
- objViewDestroy(view: objdbview) → None¶
Destroys a window view of the object database.
- Parameters
view (objdbview) – The view to destroy.
See also
objViewCreate()
andobjViewInfo()
.
- objViewInfo(view: objdbview, pos: int, info: objdb_info) → bool¶
Returns information about an object entry in a window view given an index position.
- Parameters
view (objdbview) – The object database window view.
pos (int) – The 0-based index.
info (objdb_info) – The output information.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
objViewCreate()
andobjViewDestroy()
.
- objViewSetFileName(view: objdbview, pos: int, filename: str) → bool¶
Updates the file name field for the object entry in the window view given an index position.
- Parameters
view (objdbview) – The object database window view.
pos (int) – The 0-based index.
filename (str) – The new file name to set.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
objSetFileName()
.
- openDatabase(dir: str) → bool¶
Opens the main and object databases in a given directory.
- Parameters
dir (str) – The root directory of the project.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
openProject()
,saveAs()
andclose()
.
- openProject(name: str) → bool¶
Opens a packed or unpacked project.
This method internally calls
openDatabase()
.
- Parameters
name (str) – The full path of the project to open.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
- projectFileName() → str¶
- Returns
Returns the name of the packed project.
- Return type
str
See also
dataBaseFileName()
.
- removeCarbonDBName(tlink: str, uid: int) → bool¶
Removes a Carbon database name.
- Parameters
tlink (str) – The target for which to delete the database name.
uid (int) – The unique id of the database.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
newCarbonDBFileName()
.
- removeCarbonDBNames(tlink: str) → None¶
Removes all Carbon database names for a given target.
- Parameters
tlink (str) – The target for which to delete the database names.
See also
removeCarbonDBName()
.
- renameLayout(key: str, new_key: str) → bool¶
Renames a data layout.
- Parameters
key (str) – The current key of the layout entry.
new_key (str) – The new key of the layout entry.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
getLayout()
anddeleteLayout()
.
- renameText(table: str, key: str, new_key: str) → bool¶
Renames a text entry.
- Parameters
table (str) – The table name.
key (str) – The current key of the text entry.
new_key (str) – The new key of the text entry.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
getText()
anddeleteText()
.
- retrieveFile(info_or_target: Union[Pro.Core.objdb_info, str], context: str = str()) → Pro.Core.NTContainer¶
Retrieves a file included in the project.
- Parameters
info_or_target (Union[objdb_info, str]) – The file to retrieve specified either as a target name or a
objdb_info
instance.context (str) – Reserved for future use.
- Returns
Returns the data of the file if successful; otherwise returns an invalid
NTContainer
.- Return type
See also
saveAs()
andopenDatabase()
.
- retrieveInternalFile(uid: str) → Pro.Core.NTContainer¶
Retrieves an internal file.
- Parameters
uid (str) – The internal file id.
- Returns
Returns the data of the file if successful; otherwise returns an invalid
NTContainer
.- Return type
Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.
See also
saveInternalFile()
.
- saveAs(path: str, options: int = Save_Compressed, password: str = str()) → bool¶
Saves the project.
- Parameters
path (str) – The full path of the saved project.
options (int) – The options for the save operation (e.g.:
Save_Unpacked
).password (str) – The optional password for the project.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
openProject()
,openDatabase()
andretrieveFile()
.
- saveInternalFile(uid: str, display_name: str = str(), associated_target: str = str()) → bool¶
Saves a new internal file.
- Parameters
uid (str) – The internal file id.
display_name (str) – Tag or display name for the internal file.
associated_target (str) – The name of the associated target if any.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.
See also
newInternalFileUID()
,newInternalFilePath()
,retrieveInternalFile()
,ScanProvider.addInternalFile()
andProCoreContext.addObjectToReport()
.
- setBookmarks(key: str, bm: str) → bool¶
Sets the bookmarks for a specific object.
- Parameters
key (str) – The key of the bookmark entry to set.
bm (str) – The bookmarks.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
getBookmarks()
andgetBookmarkEntries()
.
- setCarbonDBName(tlink: str, uid: int, dbname: str) → bool¶
Sets a Carbon database name.
- Parameters
tlink (str) – The name of the target.
uid (int) – The unique id for the database.
dbname (str) – The database name.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
getCarbonDBName()
.
- setCurrentTarget(t: str) → None¶
Sets the target currently being analyzed by the user in the workspace.
- Parameters
t (str) – The current target name.
See also
currentTarget()
.
- setLayout(key: str, layout: str) → bool¶
Sets a data layout.
- Parameters
key (str) – The key of the layout entry.
layout (str) – The data layout to set.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
getLayout()
anddeleteLayout()
.
- setLogicProviders(lp: Pro.Core.NTStringList) → bool¶
Sets the list of logic providers used to create the file reports.
- Parameters
lp (NTStringList) – The list of logic providers.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
getLogicProviders()
.
- setModified(b: bool) → None¶
Sets the modified status of the project.
- Parameters
b (bool) – If
True
, the project is marked as modified.See also
isModified()
.
- setNotes(key: str, notes: str, cfg: Optional[str] = None) → bool¶
Set the notes for a specific target.
- Parameters
key (str) – The target for which to set the notes.
notes (str) – The notes.
cfg (Optional[str]) – The configuration for the notes.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
- setText(table: str, key: str, txt: str) → bool¶
Sets a text entry.
- Parameters
table (str) – The table name.
key (str) – The key of the text entry.
txt (str) – The text to set.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
getText()
anddeleteText()
.
- SCANVIEW_BE: Final[int]¶
Specifies that the returned data is big-endian.
See also
ScanViewData.vflags
.
- SCANVIEW_CARBON: Final[int]¶
Carbon view.
See also
ScanViewData
.
- SCANVIEW_CELLTABLE: Final[int]¶
Cell table view.
See also
ScanViewData
.
- SCANVIEW_CHART: Final[int]¶
Chart view.
See also
ScanViewData
.
- SCANVIEW_CODEC_ASCII: Final[int]¶
Specifies that the returned data is ascii.
See also
ScanViewData.vflags
.
- SCANVIEW_CODEC_MASK: Final[int]¶
Codec mask for the returned data.
See also
ScanViewData.vflags
.
- SCANVIEW_CODEC_UCS2: Final[int]¶
Specifies that the returned data is ucs-2.
See also
ScanViewData.vflags
.
- SCANVIEW_CODEC_UCS4: Final[int]¶
Specifies that the returned data is ucs-4.
See also
ScanViewData.vflags
.
- SCANVIEW_CODEC_UTF16: Final[int]¶
Specifies that the returned data is utf-16.
See also
ScanViewData.vflags
.
- SCANVIEW_CODEC_UTF32: Final[int]¶
Specifies that the returned data is utf-32.
See also
ScanViewData.vflags
.
- SCANVIEW_CODEC_UTF8: Final[int]¶
Specifies that the returned data is utf-8.
See also
ScanViewData.vflags
.
- SCANVIEW_CODE_JAVASCRIPT: Final[int]¶
Specifies that the returned data is JavaScript code.
See also
ScanViewData.vflags
.
- SCANVIEW_CODE_MASK: Final[int]¶
Code mask for the returned data.
See also
ScanViewData.vflags
.
- SCANVIEW_CODE_NONE: Final[int]¶
Specifies no code type for the returned data.
See also
ScanViewData.vflags
.
- SCANVIEW_CODE_VBA: Final[int]¶
Specifies that the returned data is VBA code.
See also
ScanViewData.vflags
.
- SCANVIEW_CODE_VBS: Final[int]¶
Specifies that the returned data is VBS code.
See also
ScanViewData.vflags
.
- SCANVIEW_CUSTOM: Final[int]¶
Custom view.
See also
ScanViewData
.
- SCANVIEW_CUSTOM_2: Final[int]¶
Second custom view.
See also
ScanViewData
.
- SCANVIEW_CUSTOM_3: Final[int]¶
Third custom view.
Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.
- SCANVIEW_CUSTOM_4: Final[int]¶
Fourth custom view.
Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.
- SCANVIEW_CUSTOM_5: Final[int]¶
Fifth custom view.
Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.
- SCANVIEW_DATA_NOT_SHARED: Final[int]¶
Specifies that the returned data is utf-16 is not shared among the views.
See also
ScanViewData.vflags
.
- SCANVIEW_EMASK: Final[int]¶
Endianness mask for the returned data.
See also
ScanViewData.vflags
.
- SCANVIEW_FILEINFO: Final[int]¶
File info view.
See also
ScanViewData
.
- SCANVIEW_FS: Final[int]¶
File system view.
See also
ScanViewData
.
- SCANVIEW_GEO: Final[int]¶
Geo-location view.
See also
ScanViewData
.
- SCANVIEW_HEX: Final[int]¶
Hex view.
See also
ScanViewData
.
- SCANVIEW_KEYVALUE: Final[int]¶
Key-value view.
This value is reserved for future use.
See also
ScanViewData
.
- SCANVIEW_LE: Final[int]¶
Specifies that the returned data is little-endian.
See also
ScanViewData.vflags
.
- SCANVIEW_LIST: Final[int]¶
List view.
This value is reserved for future use.
See also
ScanViewData
.
- SCANVIEW_ME: Final[int]¶
Specifies that the returned data is middle-endian.
This value is reserved for future use.
See also
ScanViewData.vflags
.
- SCANVIEW_MEDIA: Final[int]¶
Media view.
See also
ScanViewData
.
- SCANVIEW_NONE: Final[int]¶
Invalid view.
See also
ScanViewData
.
- SCANVIEW_PLOT: Final[int]¶
Plot view.
See also
ScanViewData
.
- SCANVIEW_RAW: Final[int]¶
Raw hex view.
See also
ScanViewData
.
- SCANVIEW_TABLE: Final[int]¶
Table view.
See also
ScanViewData
.
- SCANVIEW_TEXT: Final[int]¶
Text view.
See also
ScanViewData
.
- SCANVIEW_TEXTBROWSER: Final[int]¶
Text browser view.
See also
ScanViewData
.
- SCANVIEW_TREE: Final[int]¶
Tree view.
See also
ScanViewData
.
- SCANVIEW_WEB: Final[int]¶
Web view.
Note
Since a web-browser is no longer included in the application, this view will simply display the target URL.
See also
ScanViewData
.
- SEC_File: Final[int]¶
Scan entry category for embedded objects.
See also
CT_EmbeddedFile
,ScanProvider.addEntry()
andScanEntryData
.
- SEC_Info: Final[int]¶
Scan entry category for information.
See also
ScanProvider.addEntry()
andScanEntryData
.
- SEC_Intrinsic: Final[int]¶
Scan entry category for intrinsic threats.
See also
ScanProvider.addEntry()
andScanEntryData
.
- SEC_Online: Final[int]¶
Scan entry category for online entries.
Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.
See also
ScanProvider.addEntry()
andScanEntryData
.
- SEC_Privacy: Final[int]¶
Scan entry category for privacy issues.
See also
ScanProvider.addEntry()
andScanEntryData
.
- SEC_Threat: Final[int]¶
Scan entry category for threats.
See also
ScanProvider.addEntry()
andScanEntryData
.
- SEC_Warn: Final[int]¶
Scan entry category for warnings.
See also
ScanProvider.addEntry()
andScanEntryData
.
- SFT_AccessTime: Final[int]¶
Scan provider time type for file access.
See also
ScanProvider.addFileTime()
.
- SFT_CreationTime: Final[int]¶
Scan provider time type for file creation.
See also
ScanProvider.addFileTime()
.
- SFT_ModificationTime: Final[int]¶
Scan provider time type for file modification.
See also
ScanProvider.addFileTime()
.
- class ScanEntryBaseAttributes¶
This class contains the base attributes of a scan entry retrieved from the report.
See also
ScanViewData
andScanProvider
.Attributes:
The category of the scan entry (e.g.,
SEC_Threat
).The source view type for the scan entry.
The format id.
Internal flags for the entry.
The indirect category of the scan entry (e.g.,
SEC_Threat
).The indirect type of the scan entry (e.g.,
CT_JavaScript
).The type of the scan entry (e.g.,
CT_JavaScript
).The unique identifier of the scan entry.
Methods:
clear
([complete])Clears the fields of this class.
- category¶
The category of the scan entry (e.g.,
SEC_Threat
).
- clear(complete: bool = True) → None¶
Clears the fields of this class.
- Parameters
complete (bool) – If
True
, clears all the fields.
- eview¶
The source view type for the scan entry.
- fid¶
The format id.
See also
FormatTree
.
- flags¶
Internal flags for the entry.
- ind_category¶
The indirect category of the scan entry (e.g.,
SEC_Threat
).
- ind_type¶
The indirect type of the scan entry (e.g.,
CT_JavaScript
).
- type¶
The type of the scan entry (e.g.,
CT_JavaScript
).
- uid¶
The unique identifier of the scan entry.
- class ScanEntryData¶
This class represents a scan entry.
See also
ScanProvider.addEntry()
.Attributes:
The category of the scan entry (e.g.,
SEC_Threat
).The data XML string.
Extra XML string.
Internal flags for the entry.
The format of the embedded object.
The target name of the embedded object.
The type of the scan entry (e.g.,
CT_JavaScript
).Methods:
clear
()Clears the fields of this class.
- category¶
The category of the scan entry (e.g.,
SEC_Threat
).
- clear() → None¶
Clears the fields of this class.
- data¶
The data XML string.
This field contains the data which will belong to the data node in the report.
- extra¶
Extra XML string.
This XML string may contain filters and other parameters.
- flags¶
Internal flags for the entry.
- oformat¶
The format of the embedded object.
If
"?"
is specified, the format of the object will be determined by the engine.
- otarget¶
The target name of the embedded object.
If
type
is notCT_EmbeddedFile
, this field is a label for the entry.
- type¶
The type of the scan entry (e.g.,
CT_JavaScript
).
- class ScanMetaDataEntries¶
List of
ScanMetaDataEntry
elements.Methods:
append
(value)Inserts
value
at the end of the list.
at
(i)Returns the item at index position
i
in the list.
clear
()Removes all items from the list.
contains
(value)Checks the presence of an element in the list.
count
(value)Returns the number of occurrences of
value
in the list.
indexOf
(value[, start])Searches for an element in the list.
insert
(i, value)Inserts
value
at index positioni
in the list.
isEmpty
()Checks whether the list is empty.
iterator
()Creates an iterator for the list.
removeAll
(value)Removes all occurrences of
value
in the list and returns the number of entries removed.
removeAt
(i)Removes the item at index position
i
.
reserve
(alloc)Reserve space for
alloc
elements.
size
()Returns the number of items in the list.
takeAt
(i)Removes the item at index position
i
and returns it.
- append(value: Pro.Core.ScanMetaDataEntry) → None¶
Inserts
value
at the end of the list.
- Parameters
value (ScanMetaDataEntry) – The value to add to the list.
See also
insert()
.
- at(i: int) → Pro.Core.ScanMetaDataEntry¶
Returns the item at index position
i
in the list.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to return.
- Returns
Returns the requested element.
- Return type
- clear() → None¶
Removes all items from the list.
- contains(value: Pro.Core.ScanMetaDataEntry) → bool¶
Checks the presence of an element in the list.
- Parameters
value (ScanMetaDataEntry) – The value to check for.
- Returns
Returns
True
if the list contains an occurrence ofvalue
; otherwise returnsFalse
.- Return type
bool
- count(value: Pro.Core.ScanMetaDataEntry) → int¶
Returns the number of occurrences of
value
in the list.
- Parameters
value (ScanMetaDataEntry) – The value to count.
- Returns
Returns the number of occurrences.
- Return type
int
See also
indexOf()
andcontains()
.
- indexOf(value: Pro.Core.ScanMetaDataEntry, start: int = 0) → int¶
Searches for an element in the list.
- Parameters
value (ScanMetaDataEntry) – The value to search for.
start (int) – The start index.
- Returns
Returns the index position of the first occurrence of
value
in the list. Returns-1
if no item was found.- Return type
int
See also
contains()
.
- insert(i: int, value: Pro.Core.ScanMetaDataEntry) → None¶
Inserts
value
at index positioni
in the list. Ifi
is0
, the value is prepended to the list. Ifi
issize()
, the value is appended to the list.
- Parameters
i (int) – The position at which to add the value.
value (ScanMetaDataEntry) – The value to add.
See also
append()
andremoveAt()
.
- isEmpty() → bool¶
Checks whether the list is empty.
- Returns
Returns
True
if the list contains no items; otherwise returnsFalse
.- Return type
bool
See also
size()
.
- iterator() → Pro.Core.ScanMetaDataEntriesIt¶
Creates an iterator for the list.
- Returns
Returns the iterator.
- Return type
- removeAll(value: Pro.Core.ScanMetaDataEntry) → int¶
Removes all occurrences of
value
in the list and returns the number of entries removed.
- Parameters
value (ScanMetaDataEntry) – The value to remove from the list.
- Returns
Returns the number of entries removed.
- Return type
int
See also
removeAt()
.
- removeAt(i: int) → None¶
Removes the item at index position
i
.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the item to remove.
See also
removeAll()
.
- reserve(alloc: int) → None¶
Reserve space for
alloc
elements. Calling this method doesn’t change the size of the list.
- Parameters
alloc (int) – The amount of elements to reserve space for.
- takeAt(i: int) → Pro.Core.ScanMetaDataEntry¶
Removes the item at index position
i
and returns it.i
must be a valid index position in the list (i.e.,0 <= i < size()
).
- Parameters
i (int) – The index of the element to remove from the list.
- Returns
Returns the removed element. If you don’t use the return value,
removeAt()
is more efficient.- Return type
See also
removeAt()
.
- class ScanMetaDataEntriesIt(obj: Pro.Core.ScanMetaDataEntries)¶
Iterator class for
ScanMetaDataEntries
.
- Parameters
obj (ScanMetaDataEntries) – The object to iterate over.
Methods:
hasNext
()Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.
next
()Returns the next item and advances the iterator by one position.
previous
()Returns the previous item and moves the iterator back by one position.
toBack
()Moves the iterator to the back of the container (after the last item).
toFront
()Moves the iterator to the front of the container (before the first item).
- hasNext() → bool¶
- Returns
Returns
True
if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returnsFalse
.- Return type
bool
See also
hasPrevious()
andnext()
.
- hasPrevious() → bool¶
- Returns
Returns
True
if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returnsFalse
.- Return type
bool
See also
hasNext()
andprevious()
.
- next() → Pro.Core.ScanMetaDataEntry¶
- Returns
Returns the next item and advances the iterator by one position.
- Return type
See also
hasNext()
andprevious()
.
- previous() → Pro.Core.ScanMetaDataEntry¶
- Returns
Returns the previous item and moves the iterator back by one position.
- Return type
See also
hasPrevious()
andnext()
.
- toBack() → None¶
Moves the iterator to the back of the container (after the last item).
See also
toFront()
andprevious()
.
- class ScanMetaDataEntry¶
This class represents a scan meta-data entry.
See also
ScanProvider.addMetaData()
andScanProvider.addMetaDataString()
.Attributes:
The content of the meta-data.
The flags of the meta-data (e.g.,
METAFLAG_STRING
).The identifier of the meta-data.
The label of the meta-data.
- content¶
The content of the meta-data.
- flags¶
The flags of the meta-data (e.g.,
METAFLAG_STRING
).
- id¶
The identifier of the meta-data.
- label¶
The label of the meta-data.
- class ScanProvider¶
This is the base class inherited by all the scan engines for the different file formats.
See also
ScanEntryData
,ScanViewData
andScanMetaDataEntry
.Attributes:
If this scan option is set, the default hash of the object will always be computed.
If this scan option is set, child objects will not be scanned.
Error result code.
Finished result code for
_startScan()
.Success result code.
If this scan option is set, child objects will not be scanned.
If this scan option is set, the default hash of the object will not be computed.
If this scan option is set, the object will not be scanned for shellcode.
Methods:
This method must be overwritten by derived classes to receive the notification that all child objects have been scanned.
_childScanned
(dnode, schild, onode)This method must be overwritten by derived classes to receive the notification when a child object has been scanned.
_clear
()This method must be overwritten by derived classes to release internal data.
_customOperation
(params)This method must be overwritten by derived classes to perform a custom operation.
_formatViewData
(sdata)This method must be overwritten by derived classes to provide data or views for a format item.
_formatViewInfo
(finfo)This method must be overwritten by derived classes to provide information about a format item.
This method must be overwritten by derived classes to provide the tree representing the format of the object.
This method must be overwritten by derived classes to provide the basic initialization for the internal
CFFObject
.This method must be overwritten by derived classes which want to provide a different basic initialization for the internal
CFFObject
when loading the object from an existing project.This method must be overwritten by derived classes to receive the notification of when
_threadScan()
has finished.
_scanViewData
(xml, dnode, sdata)This method must be overwritten by derived classes to provide data or views for a scan entry.
This method must be overwritten by derived classes to start the scan process.
This method must be overwritten by derived classes to implement the scanning process in a thread different than the main UI thread.
_uinGetInitialViewData
(context, sdata)This method must be overwritten by derived classes to provide the data for the additional initial views for the object.
_uinSetupInitialViews
(context, sdata)This method must be overwritten by derived classes to implement additional initial views for the object.
addEmbeddedObject
(offset, size, format, name)Adds a child object.
addEntry
(ed)Adds a scan entry.
addFSFile
(fspath, format, name[, offset, …])Adds an embedded object by its internal file-system name.
addFileTime
(type, local_time[, utc_time])Adds a file time.
addHookEntry
(hook_name, ed)Adds a scan entry handled by a hook extension.
addInternalFile
(uid, format, name[, offset, …])Adds an internal file as child object.
addMetaData
(id, content)Adds meta-data information.
addMetaDataString
(label, content)Adds visible meta-data information.
addNativeCodeEntry
(category[, …])Adds a native code scan entry.
addSignatureMatch
(category, content)Adds a signature match scan entry.
Returns the maximum number of allowed child objects for this object.
Returns the maximum extraction size allowed child objects of this object.
Returns the maximum size for file systems that permits to automatically scan their embedded objects.
customOperation
(params)Performs a custom operation.
dataFromEntry
(enode)Retrieves the data node from an entry node.
exclude
([b])Determines the inclusion of a root-level object into the project.
extractMetaDataEntries
(xml, onode[, flags])Retrieves the meta-data entries from an XML report.
Returns the format group for the object being scanned (e.g.,
FormatGroup_Archive
).Returns the project instance.
getHash
(name[, compute, wo])Retrieves a hash from the report by its name.
getInstanceObject
(key[, defval])Retrieves an object shared across parent and children scan providers given a specified key.
getInstanceValue
(key[, defval])Retrieves a value shared across parent and children scan providers given a specified key.
getMetaDataEntries
([flags])Retrieves meta-data entries.
getMetaDataEntry
(id)Retrieves a meta-data entry by its identifier.
getNextEntry
([t, enode])Retrieves the next entry node by its type.
Returns the internal
CFFObject
instance.Returns the format of the object.
Retrieves the internal data container of the object.
Returns the object node of the XML report.
Retrieves the current XML report.
Retrieves the initial data associated with the scan provider.
include
([b])Determines the inclusion of a root-level object into the project.
initCFFObject
(obj)Initializes the
CFFObject
with the default scanning limits.Returns
True
if was aborted; otherwise returnsFalse
.Returns
True
if a batch scan is being performed; otherwise returnsFalse
.Returns
True
if the current scan is nested; otherwise returnsFalse
.Returns the parent scan provider if present; otherwise returns
None
.Returns the root scan provider for the current scan hierarchy.
Returns the current level of nesting. Returns
0
for root level scans.Returns the scan options (e.g.,
SKIP_HASH
).
setBatchScan
(b)Sets the batch scan status.
setCachedObject
(obj)Sets the cached object which is returned by
getObject()
.
setFormatGroup
(group)Sets the format group for the object being scanned.
setInstanceObject
(key, obj[, destroyer_cb])Sets an object shared across parent and children scan providers given a specified key.
setInstanceValue
(key, value)Sets a value shared across parent and children scan providers given a specified key.
setScanOptions
(opt)Sets the scan options.
subtractExtractionSize
(size)Subtracts a specified size from the total amount of allowed extraction size.
Returns the target name for the scan provider if available; otherwise returns an empty string.
visitChildren
(visitor[, wo])Visits the child objects of the current scan provider.
Returns
True
if the current file was excluded from the project; otherwise returnsFalse
.
- COMPUTE_HASH: Final[int]¶
If this scan option is set, the default hash of the object will always be computed.
See also
setScanOptions()
.
- FS_SKIP_EMBEDDED_SCAN: Final[int]¶
If this scan option is set, child objects will not be scanned.
Note
This option has the same effect as
SKIP_EMBEDDED_SCAN
, but it should be set when the file system object exceeds the value returned byallowedFileSystemScanSize()
and the implication is that the file system object should not add embedded object entries.Available since Cerbero Suite 7.7 and Cerbero Engine 4.7.
See also
setScanOptions()
.
- SCAN_RESULT_ERROR: Final[int]¶
Error result code.
See also
_initObject()
and_startScan()
.
- SCAN_RESULT_FINISHED: Final[int]¶
Finished result code for
_startScan()
.See also
_startScan()
.
- SCAN_RESULT_OK: Final[int]¶
Success result code.
See also
_initObject()
and_startScan()
.
- SKIP_EMBEDDED_SCAN: Final[int]¶
If this scan option is set, child objects will not be scanned.
See also
setScanOptions()
.
- SKIP_HASH: Final[int]¶
If this scan option is set, the default hash of the object will not be computed.
See also
setScanOptions()
.
- SKIP_SHELLCODE_SCAN: Final[int]¶
If this scan option is set, the object will not be scanned for shellcode.
Available since Cerbero Suite 5.3 and Cerbero Engine 2.3.
See also
setScanOptions()
.
- _allChildrenScanned() → None¶
This method must be overwritten by derived classes to receive the notification that all child objects have been scanned.
Warning
This method must not be called directly!
See also
_childScanned()
.
- _childScanned(dnode: NTXmlNode, schild: ScanProvider, onode: NTXmlNode) → None¶
This method must be overwritten by derived classes to receive the notification when a child object has been scanned.
Warning
This method must not be called directly!
- Parameters
dnode (NTXmlNode) – The data node for the embedded object.
schild (ScanProvider) – The scan provider of the child object.
onode (NTXmlNode) – The object node of the child object.
See also
_allChildrenScanned()
.
- _clear() → None¶
This method must be overwritten by derived classes to release internal data.
Warning
This method must not be called directly!
- _customOperation(params: Pro.Core.NTStringVariantHash) → Optional[Union[int, float, bool, bytes, str]]¶
This method must be overwritten by derived classes to perform a custom operation.
Warning
This method must not be called directly!
- Parameters
params (NTStringVariantHash) – The parameters for the operation.
- Returns
Returns a value specific to the implementation of this method; by default returns
None
.- Return type
BasicType
See also
customOperation()
.
- _formatViewData(sdata: Pro.Core.ScanViewData) → bool¶
This method must be overwritten by derived classes to provide data or views for a format item.
Warning
This method must not be called directly!
- Parameters
sdata (ScanViewData) – This structure contains both the identifier of the format item (
ScanViewData.fid
) and the data returned by this method.- Returns
Returns
True
if the data is available; otherwise returnsFalse
.- Return type
bool
See also
_getFormat()
,_formatViewInfo()
andScanViewData
.
- _formatViewInfo(finfo: Pro.Core.FormatItemInfo) → bool¶
This method must be overwritten by derived classes to provide information about a format item.
Warning
This method must not be called directly!
- Parameters
finfo (FormatItemInfo) – This structure contains both the identifier of the format item (
FormatItemInfo.fid
) and the information returned by this method.- Returns
Returns
True
if the information is available; otherwise returnsFalse
.- Return type
bool
See also
_getFormat()
,_formatViewData()
andFormatItemInfo
.
- _getFormat() → Pro.Core.FormatTree¶
This method must be overwritten by derived classes to provide the tree representing the format of the object.
Warning
This method must not be called directly!
The tree is made of unique identifiers which are passed to
_formatViewInfo()
and_formatViewData()
to retrieve information and data for a specific item.Important
Before adding items to the tree,
FormatTree.enableIDs()
must be called with a value ofTrue
.
- Returns
Returns the format tree.
- Return type
See also
_formatViewInfo()
,_formatViewData()
and_scanViewData()
.
- _initObject() → int¶
This method must be overwritten by derived classes to provide the basic initialization for the internal
CFFObject
.Warning
This method must not be called directly!
Important
Before calling
CFFObject.Load()
this method must callinitCFFObject()
to initialize theCFFObject
with the default scanning limits.
- Returns
Returns
SCAN_RESULT_OK
if successful; otherwise returnsSCAN_RESULT_ERROR
.- Return type
int
See also
_initObjectWithoutScan()
,_startScan()
andinitCFFObject()
.
- _initObjectWithoutScan() → int¶
This method must be overwritten by derived classes which want to provide a different basic initialization for the internal
CFFObject
when loading the object from an existing project.Warning
This method must not be called directly!
This method is different from
_initObject()
, because it is only called when a scan has already been performed and the scan provider can access an existing report. If this method is not implemented,_initObject()
is called instead.Important
Before calling
CFFObject.Load()
this method must callinitCFFObject()
to initialize theCFFObject
with the default scanning limits.
- Returns
Returns
SCAN_RESULT_OK
if successful; otherwise returnsSCAN_RESULT_ERROR
.- Return type
int
See also
_initObject()
,_startScan()
andinitCFFObject()
.
- _postScan() → None¶
This method must be overwritten by derived classes to receive the notification of when
_threadScan()
has finished.Warning
This method must not be called directly!
See also
_threadScan()
and_startScan()
.
- _scanViewData(xml: NTXml, dnode: NTXmlNode, sdata: ScanViewData) → bool¶
This method must be overwritten by derived classes to provide data or views for a scan entry.
Warning
This method must not be called directly!
- Parameters
xml (NTXml) – The XML report.
dnode (NTXmlNode) – The data node of the scan entry.
sdata (ScanViewData) – This structure contains the data returned by this method.
- Returns
Returns
True
if the data is available; otherwise returnsFalse
.- Return type
bool
See also
addEntry()
,ScanViewData
and_formatViewData()
.
- _startScan() → int¶
This method must be overwritten by derived classes to start the scan process.
Warning
This method must not be called directly!
If the method returns
SCAN_RESULT_OK
, the scan process must be performed from_threadScan()
. Alternatively, if the scanning process is time inexpensive, the method can returnSCAN_RESULT_FINISHED
to specify that the scanning process is terminated. In that case,_threadScan()
will not be invoked.Hint
_startScan()
is called from the main UI thread and should not be used for time consuming operation, otherwise it will block the UI._threadScan()
is called from a different thread than the main UI thread and can be used for long scanning processes.
- Returns
Returns
SCAN_RESULT_OK
orSCAN_RESULT_FINISHED
if successful; otherwise returnsSCAN_RESULT_ERROR
.- Return type
int
See also
_initObject()
,_threadScan()
andaddEntry()
.
- _threadScan() → None¶
This method must be overwritten by derived classes to implement the scanning process in a thread different than the main UI thread.
Warning
This method must not be called directly!
This method is called only when
_startScan()
returnsSCAN_RESULT_OK
.See also
_startScan()
andaddEntry()
.
- _uinGetInitialViewData(context: ProContext, sdata: ScanViewData) → int¶
This method must be overwritten by derived classes to provide the data for the additional initial views for the object.
Warning
This method must not be called directly!
Example:
def previewCallback(cv, self, code, view, data): if code == pvnInit: tv = cv.getView(1) tv.setText(self.previewText()) return 1 return 0 def _uinGetInitialViewData(self, ctx, sdata): ui = "<ui><vlayout margin='0'><text id='1'/></vlayout></ui>"; sdata.data.setData(ui); sdata.setCallback(previewCallback, self) return 1To inform the workspace about additional views,
_uinSetupInitialViews()
must be implemented.Note
This method requires the UI module.
- Parameters
context (ProContext) – The UI context.
sdata (ScanViewData) – The data or views to provide.
- Returns
Returns
1
if successful; otherwise returns0
.- Return type
int
See also
_uinSetupInitialViews()
.
- _uinSetupInitialViews(context: ProContext, sdata: ScanViewData) → int¶
This method must be overwritten by derived classes to implement additional initial views for the object.
Warning
This method must not be called directly!
Example:
def _uinSetupInitialViews(self, ctx, sdata): sdata.supported_views |= SCANVIEW_CUSTOM_2 sdata.addToolBarInfo(SCANVIEW_CUSTOM_2, "Preview", PubIcon_Text) return 0To provide the data for the additional views,
_uinGetInitialViewData()
must be implemented.Note
This method requires the UI module.
- Parameters
context (ProContext) – The UI context.
sdata (ScanViewData) – The information about the views to add.
- Returns
Must return
0
.- Return type
int
See also
_uinGetInitialViewData()
.
- addEmbeddedObject(offset: int, size: int, format: str, name: str, filters: Optional[str] = None) → None¶
Adds a child object.
Note
This is a convenience method for child object which are plainly embedded into the current object. For more complex extractions
addEntry()
andCT_EmbeddedFile
must be used.
- Parameters
offset (int) – The offset of the child object.
size (int) – The size of the object.
format (str) – The format of the object.
"?"
can be specified to make the engine determine the format.name (str) – The name of the object.
filters (str) – Optional XML string specifying which filters to apply to the object before scanning it.
See also
addEntry()
andaddFSFile()
.
- addEntry(ed: Pro.Core.ScanEntryData) → None¶
Adds a scan entry.
Scan entries can be threats, warnings, privacy issues, information and child objects.
- Parameters
ed (ScanEntryData) – The data of the scan entry.
See also
ScanEntryData
,addEmbeddedObject()
,addFSFile()
,addNativeCodeEntry()
,addSignatureMatch()
andaddHookEntry()
.
- addFSFile(fspath: str, format: str, name: str, offset: int = INVALID_STREAM_OFFSET, size: int = 0, filters: Optional[str] = None, data: bytes = bytes()) → None¶
Adds an embedded object by its internal file-system name.
Important
The the file-system interface must be implemented to use this method.
- Parameters
fspath (str) – The file-system name of the object.
format (str) – The format of the object.
"?"
can be specified to make the engine determine the format.name (str) – The name of the object.
offset (int) – The start offset of the object.
size (int) – The size of the object.
filters (str) – Optional XML string specifying which filters to apply to the object before scanning it.
data (bytes) – Optional data XML string.
Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.
See also
addEntry()
andaddEmbeddedObject()
.
- addFileTime(type: int, local_time: Pro.Core.NTDateTime, utc_time: Pro.Core.NTDateTime = NTDateTime()) → None¶
Adds a file time.
- Parameters
type (int) – The type of file time (e.g.,
SFT_CreationTime
).local_time (NTDateTime) – The local time.
utc_time (NTDateTime) – The UTC time.
See also
NTDateTime
,SFT_CreationTime
,SFT_AccessTime
andSFT_ModificationTime
.
- addHookEntry(hook_name: str, ed: Pro.Core.ScanEntryData) → None¶
Adds a scan entry handled by a hook extension.
Hint
The data returned for this entry must be provided by the hook extension associated to it. For this purpose the associated hook extension must implement the scandata function.
Scan entries can be threats, warnings, privacy issues, information and child objects.
- Parameters
hook_name (str) – The name of the hook extension which handles the scan entry.
ed (ScanEntryData) – The data of the scan entry.
Available since Cerbero Suite 5.0 and Cerbero Engine 2.0.
See also
ScanEntryData
andaddEntry()
.
- addInternalFile(uid: str, format: str, name: str, offset: int = INVALID_STREAM_OFFSET, size: int = 0, filters: Optional[str] = None, data: str = str()) → None¶
Adds an internal file as child object.
- Parameters
uid (str) – The id of the internal file.
format (str) – The format of the object.
"?"
can be specified to make the engine determine the format.name (str) – The name of the object.
offset (int) – The offset of the child object.
size (int) – The size of the child object.
filters (str) – Optional XML string specifying which filters to apply to the object before scanning it.
data (str) – Optional data XML string.
Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.
See also
Report.newInternalFileUID()
,Report.newInternalFilePath()
,Report.saveInternalFile()
,Report.retrieveInternalFile()
andProCoreContext.addObjectToReport()
.
- addMetaData(id: str, content: bytes) → None¶
Adds meta-data information.
- Parameters
id (str) – The id of the meta-data.
content (bytes) – The content of the meta-data.
See also
addMetaDataString()
,extractMetaDataEntries()
andgetMetaDataEntries()
.
- addMetaDataString(label: str, content: str) → None¶
Adds visible meta-data information.
- Parameters
label (str) – The label of the meta-data.
content (str) – The content of the meta-data.
See also
addMetaData()
,extractMetaDataEntries()
andgetMetaDataEntries()
.
- addNativeCodeEntry(category: int, carbon_xml_string: str = str(), text: Optional[str] = None) → None¶
Adds a native code scan entry.
self.addNativeCodeEntry(SEC_Info, "<carbon loader='PE'/>", "x64")
- Parameters
category (int) – The category of the scan entry.
carbon_xml_string (str) – The Carbon XML information string.
text (str) – The information string for the Carbon loader.
See also
addEntry()
.
- addSignatureMatch(category: int, content: str) → None¶
Adds a signature match scan entry.
- Parameters
category (int) – The category of the scan entry.
content (str) – The text of the scan entry.
See also
addEntry()
.
- allowedChildrenFiles() → int¶
- Returns
Returns the maximum number of allowed child objects for this object.
- Return type
int
See also
allowedExtractionSize()
.
- allowedExtractionSize() → int¶
- Returns
Returns the maximum extraction size allowed child objects of this object.
- Return type
int
See also
subtractExtractionSize()
andallowedChildrenFiles()
.
- allowedFileSystemScanSize() → int¶
- Returns
Returns the maximum size for file systems that permits to automatically scan their embedded objects.
- Return type
int
Available since Cerbero Suite 7.7 and Cerbero Engine 4.7.
See also
FS_SKIP_EMBEDDED_SCAN
.
- customOperation(params: Pro.Core.NTStringVariantHash) → Optional[Union[int, float, bool, bytes, str]]¶
Performs a custom operation.
- Parameters
params (NTStringVariantHash) – The parameters for the operation.
- Returns
Returns a value specific to the implementation of the internal
_customOperation()
method; by default returnsNone
.- Return type
BasicType
See also
_customOperation()
.
- dataFromEntry(enode: NTXmlNode) → NTXmlNode¶
Retrieves the data node from an entry node.
- Parameters
enode (NTXmlNode) – The entry node.
- Returns
Returns the data node if successful; otherwise returns
None
.- Return type
NTXmlNode
Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.
See also
NTXml
andgetReportXML()
.
- exclude(b: bool = True) → None¶
Determines the inclusion of a root-level object into the project.
- Parameters
b (bool) – If
True
, the object is excluded from the project.See also
include()
andwasExcluded()
.
- static extractMetaDataEntries(xml: NTXml, onode: NTXmlNode, flags: int = - 1) → ScanMetaDataEntries¶
Retrieves the meta-data entries from an XML report.
- Parameters
xml (NTXml) – The XML report.
onode (NTXmlNode) – The object node.
flags (int) – If specified, only the meta-data entries matching this value are retrieved (e.g.
METAFLAG_STRING
).- Returns
Returns a list of meta-data entries.
- Return type
See also
ScanMetaDataEntry
,addMetaData()
,addMetaDataString()
andgetMetaDataEntries()
.
- formatGroup() → int¶
- Returns
Returns the format group for the object being scanned (e.g.,
FormatGroup_Archive
).- Return type
int
Available since Cerbero Suite 7.7 and Cerbero Engine 4.7.
See also
setFormatGroup()
.
- getGlobalReport() → Pro.Core.Report¶
- Returns
Returns the project instance.
- Return type
See also
Report
.
- getHash(name: str, compute: bool = True, wo: Optional[Pro.Core.NTIWait] = None) → bytes¶
Retrieves a hash from the report by its name.
Note
If the
compute
argument isTrue
and the hash is not already present in the report, then the method will compute the hash and try to store it in the report for future retrieval.
- Parameters
name (str) – The name of the hash (e.g., ‘sha256’).
compute (bool) – If
True
, computes the hash if it’s not already present in the report (available since Cerbero Suite 5.6 and Cerbero Engine 2.6.).wo (NTIWait) – The wait object used to compute the hash (available since Cerbero Suite 5.6 and Cerbero Engine 2.6.).
- Returns
Returns the hash if successful; otherwise returns an empty
bytes
object.- Return type
bytes
See also
NTIWait
andCOMPUTE_HASH
.
- getInstanceObject(key: str, defval: Optional[object] = None) → object¶
Retrieves an object shared across parent and children scan providers given a specified key.
- Parameters
key (str) – The key.
defval (object) – The default value to return if the requested object is not available.
- Returns
Returns the requested object if available; otherwise returns the default value.
- Return type
object
See also
setInstanceObject()
andgetInstanceValue()
.
- getInstanceValue(key: str, defval: Optional[Union[int, float, bool, bytes, str]] = None) → Optional[Union[int, float, bool, bytes, str]]¶
Retrieves a value shared across parent and children scan providers given a specified key.
- Parameters
key (str) – The key.
defval (BasicType) – The default value to return if the requested value is not available.
- Returns
Returns the requested value if available; otherwise returns the default value.
- Return type
BasicType
See also
setInstanceValue()
andgetInstanceObject()
.
- getMetaDataEntries(flags: int = - 1) → Pro.Core.ScanMetaDataEntries¶
Retrieves meta-data entries.
- Parameters
flags (int) – If specified, only the meta-data entries matching this value are retrieved (e.g.
METAFLAG_STRING
).- Returns
Returns a list of meta-data entries.
- Return type
See also
ScanMetaDataEntry
,addMetaData()
,addMetaDataString()
andextractMetaDataEntries()
.
- getMetaDataEntry(id: str) → Pro.Core.ScanMetaDataEntry¶
Retrieves a meta-data entry by its identifier.
- Parameters
id (str) – The meta-data identifier.
- Returns
Returns a valid meta-data entry if successful; otherwise returns an empty meta-data entry.
- Return type
See also
ScanMetaDataEntry
andgetMetaDataEntries()
.
- getNextEntry(t: int = - 1, enode: NTXmlNode = None) → NTXmlNode¶
Retrieves the next entry node by its type.
- Parameters
t (int) – The type of entry node to retrieve (e.g.,
CT_EmbeddedFile
).enode (NTXmlNode) – The current entry node.
- Returns
Returns the next entry if available; otherwise returns
None
.- Return type
NTXmlNode
Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.
See also
NTXml
andgetReportXML()
.
- getObject() → object¶
- Returns
Returns the internal
CFFObject
instance.- Return type
object
See also
CFFObject
,getObjectStream()
andgetObjectFormat()
.
- getObjectFormat() → str¶
- Returns
Returns the format of the object.
- Return type
str
See also
getObject()
andgetObjectStream()
.
- getObjectStream() → Pro.Core.NTContainer¶
Retrieves the internal data container of the object.
Hint
This is the equivalent of calling
CFFObject.GetStream()
.
- Returns
Returns the internal data container of the object.
- Return type
See also
getStream()
,getObject()
andgetObjectFormat()
.
- getReportObjectNode() → NTXmlNode¶
- Returns
Returns the object node of the XML report.
- Return type
NTXmlNode
See also
getReportXML()
.
- getReportXML() → Pro.Core.NTXml¶
Retrieves the current XML report.
Important
The XML is available only at the completion of the scanning process.
- Returns
Returns the XML report if available; otherwise returns an invalid
NTXml
instance.- Return type
See also
NTXml
andgetReportObjectNode()
.
- getStream() → Pro.Core.NTContainer¶
Retrieves the initial data associated with the scan provider.
Note
The returned data may differ from the data returned by
getObjectStream
.
- Returns
Returns the initial data associated with the scan provider.
- Return type
See also
getObjectStream()
.
- include(b: bool = True) → None¶
Determines the inclusion of a root-level object into the project.
- Parameters
b (bool) – If
True
, the object is included in the project.See also
exclude()
andwasExcluded()
.
- initCFFObject(obj: Pro.Core.CFFObject) → None¶
Initializes the
CFFObject
with the default scanning limits.Important
This method should be called from the implementations of
_initObject()
and_initObjectWithoutScan()
before these methods callCFFObject.Load()
.
- Parameters
obj (CFFObject) – The object to initialize with the default scanning limits.
See also
_initObject()
and_initObjectWithoutScan()
.
- isAborted() → bool¶
- Returns
Returns
True
if was aborted; otherwise returnsFalse
.- Return type
bool
See also
_stopScan()
.
- isBatchScan() → bool¶
- Returns
Returns
True
if a batch scan is being performed; otherwise returnsFalse
.- Return type
bool
See also
setBatchScan()
.
- isNestedScan() → bool¶
- Returns
Returns
True
if the current scan is nested; otherwise returnsFalse
.- Return type
bool
See also
scanNesting()
.
- parentProvider() → Pro.Core.ScanProvider¶
- Returns
Returns the parent scan provider if present; otherwise returns
None
.- Return type
See also
rootProvider()
andisNestedScan()
.
- rootProvider() → Pro.Core.ScanProvider¶
- Returns
Returns the root scan provider for the current scan hierarchy.
- Return type
See also
parentProvider()
andisNestedScan()
.
- scanNesting() → int¶
- Returns
Returns the current level of nesting. Returns
0
for root level scans.- Return type
int
See also
isNestedScan()
.
- scanOptions() → int¶
- Returns
Returns the scan options (e.g.,
SKIP_HASH
).- Return type
int
See also
setScanOptions()
.
- setBatchScan(b: bool) → None¶
Sets the batch scan status.
- Parameters
b (bool) – The status to set.
See also
isBatchScan()
.
- setCachedObject(obj: Pro.Core.CFFObject) → None¶
Sets the cached object which is returned by
getObject()
.
- Parameters
obj (CFFObject) – The object to set.
Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.
See also
getObject()
and_initObject()
.
- setFormatGroup(group: int) → None¶
Sets the format group for the object being scanned.
Note
The format group is set automatically based on the configuration information of the scan provider. This method should only be used when a specific object can belong to different groups based on its contents.
- Parameters
group (int) – The format group to set (e.g.,
FormatGroup_Archive
).Available since Cerbero Suite 7.7 and Cerbero Engine 4.7.
See also
formatGroup()
.
- setInstanceObject(key: str, obj: object, destroyer_cb: Optional[object] = None) → None¶
Sets an object shared across parent and children scan providers given a specified key.
- Parameters
key (str) – The key.
obj (object) – The object.
destroyer_cb (object) – An optional deletion callback.
See also
getInstanceObject()
andsetInstanceValue()
.
- setInstanceValue(key: str, value: Optional[Union[int, float, bool, bytes, str]]) → None¶
Sets a value shared across parent and children scan providers given a specified key.
- Parameters
key (str) – The key.
value (BasicType) – The value.
See also
getInstanceValue()
andsetInstanceObject()
.
- setScanOptions(opt: int) → None¶
Sets the scan options.
- Parameters
opt (int) – The scan options (e.g.,
SKIP_HASH
).See also
scanOptions()
.
- subtractExtractionSize(size: int) → None¶
Subtracts a specified size from the total amount of allowed extraction size.
Once the limit is reached a
CT_DecompressionBomb
scan entry is automatically added to the report.
- Parameters
size (int) – The size to subtract.
See also
allowedExtractionSize()
.
- targetName() → str¶
- Returns
Returns the target name for the scan provider if available; otherwise returns an empty string.
- Return type
str
Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.
See also
Report.currentTarget()
.
- visitChildren(visitor: Pro.Core.ScanProviderVisitor, wo: Optional[Pro.Core.NTIWait] = None) → int¶
Visits the child objects of the current scan provider.
Note
The reports of the visited scan providers cannot be modified, and any changes to them will be lost. Also, this method does not trigger scanning of child objects. If the child objects haven’t been scanned, they will simply be initialized.
- Parameters
visitor (ScanProviderVisitor) – The visitor class.
wo (NTIWait) – An optional wait object.
- Returns
Returns the value returned by the
ScanProviderVisitor.visit()
method.- Return type
int
Available since Cerbero Suite 8.1 and Cerbero Engine 5.1.
See also
ScanProviderVisitor
.
- class ScanProviderVisitor¶
The base class for the
ScanProvider.visitChildren()
visitor.Available since Cerbero Suite 8.1 and Cerbero Engine 5.1.
Methods:
visit
(sp)This method is invoked for each enumerated child object.
- visit(sp: Pro.Core.ScanProvider) → int¶
This method is invoked for each enumerated child object.
- Parameters
sp (ScanProvider) – The child object scan provider.
- Returns
Returns
0
to continue the enumeration; otherwise it stops the enumeration.- Return type
int
- class ScanProviderWait(sprovider: Pro.Core.ScanProvider)¶
Bases:
Pro.Core.NTIWait
This class only wraps
ScanProvider.isAborted()
.Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
NTIWait
.
- Parameters
sprovider (ScanProvider) – The scan provider to be monitored for abort.
- class ScanViewData¶
Bases:
Pro.Core.ScanEntryBaseAttributes
This class is used as I/O container to retrieve data and UI views from a scan provider.
See also
ScanProvider._scanViewData()
andScanProvider._formatViewData()
.Methods:
addFileTime
(type, local_time[, utc_time])Adds a file time to the returned child object.
addMetaData
(id, content)Adds meta-data to the returned child object.
addMetaDataString
(id_or_label, content_or_label)Adds a meta-data string to the returned child object.
addToolBarInfo
(view, descr, icon)Specifies tool-bar label and icon for a view type.
setCallback
(cb[, ud])Sets the callback for custom view.
setViews
(supported[, preferred])Sets the views for the scan entry.
Attributes:
The analysis delta for a hex view.
A
CFFContainer
which encapsulates the data returned by the scan provider.The data node in the XML report.
The name of the highlighting rules to be used for the returned text.
The default view for the entry (e.g.,
SCANVIEW_TEXT
).The requested view for the entry (e.g.,
SCANVIEW_TEXT
).The supported views for the entry (e.g.,
SCANVIEW_TEXT | SCANVIEW_HEX
).The flags for the views.
- addFileTime(type: int, local_time: Pro.Core.NTDateTime, utc_time: Pro.Core.NTDateTime = NTDateTime()) → None¶
Adds a file time to the returned child object.
- Parameters
type (int) – The type of file time (e.g.,
SFT_CreationTime
).local_time (NTDateTime) – The local time.
utc_time (NTDateTime) – The UTC time.
See also
NTDateTime
,SFT_CreationTime
,SFT_AccessTime
andSFT_ModificationTime
.
- addMetaData(id: str, content: bytes) → None¶
Adds meta-data to the returned child object.
- Parameters
id (str) – The identifier of the meta-data.
content (bytes) – The content of the meta-data.
See also
addMetaDataString()
.
- addMetaDataString(id_or_label: str, content_or_label: str, content: Optional[str] = None) → None¶
Adds a meta-data string to the returned child object.
- Parameters
id_or_label (str) – Either the identifier or the label of the meta-data.
content_or_label (str) – Either the content or the label of the meta-data.
content (Optional[str]) – The content of the meta-data.
See also
addMetaData()
.
- addToolBarInfo(view: SViewType, descr: str, icon: int) → None¶
Specifies tool-bar label and icon for a view type.
- Parameters
view (SViewType) – The view type (e.g.,
SCANVIEW_TEXT
).descr (str) – The label.
icon (int) – The icon.
- analysis_delta¶
The analysis delta for a hex view.
Available since Cerbero Suite 7.7 and Cerbero Engine 4.7.
See also
Pro.UI.ProHexView.setAnalysisDelta()
.
- data¶
A
CFFContainer
which encapsulates the data returned by the scan provider.It can contain raw data, text or an XML string, depending on the type of view that is selected.
See also
CFFContainer
,setViews()
andsetCallback()
.
- dnode¶
The data node in the XML report.
- highlight_rules¶
The name of the highlighting rules to be used for the returned text.
Applies only if the requested view is
SCANVIEW_TEXT
.
- preferred_view¶
The default view for the entry (e.g.,
SCANVIEW_TEXT
).See also
setViews
,supported_views
andrequested_view
.
- requested_view¶
The requested view for the entry (e.g.,
SCANVIEW_TEXT
).See also
setViews
,supported_views
andpreferred_view
.
- setCallback(cb: object, ud: Optional[object] = None) → None¶
Sets the callback for custom view.
When a custom view is requested (e.g.,
SCANVIEW_CUSTOM
orSCANVIEW_CUSTOM_2
), this sets the callback for it.Hint
The
data
field must contain the XML string representing the custom view.
- Parameters
cb (object) – The callback of the custom view.
ud (object) – The user data passed to the callback.
See also
data
.
- setViews(supported: SViewType, preferred: SViewType = 0) → None¶
Sets the views for the scan entry.
- Parameters
supported (SViewType) – The combination of supported views (e.g.,
SCANVIEW_TEXT | SCANVIEW_HEX
).preferred (SViewType) – The preferred view (e.g.,
SCANVIEW_TEXT
).See also
supported_views
,preferred_view
andrequested_view
.
- supported_views¶
The supported views for the entry (e.g.,
SCANVIEW_TEXT | SCANVIEW_HEX
).See also
setViews
,preferred_view
andrequested_view
.
- vflags¶
The flags for the views.
If
SCANVIEW_DATA_NOT_SHARED
is specified, the data is not shared among the views. Consequently, when the view is switched, the scan provider must return different data for each requested view.
- TB_SIZE: Final[int]¶
This constant defines the size of a terabyte.
- THIS_HDR_NAME: Final[str]¶
The special name of the header file associated with the report.
See also
Report.thisHeaderFileName()
.
- THIS_HEADER_NAME: Final[str]¶
The file name of the header file associated with the report.
See also
Report.thisHeaderFileName()
.
- TYPES_NATURE_BASE: Final[int]¶
Base value for type nature.
See also
CFFObject.GetTypeNature()
.
- ToolDir_CheckExistence: Final[int]¶
Checks for the existence of the directory. If the directory doesn’t exist, it causes the function being passed this option to return an empty string.
See also
appDataDir()
,userConfigDir()
,userPluginsDir()
,userHeadersDir()
,userMediaDir()
,userThemesDir()
,userCarbonThemesDir()
anduserPDBSymbolsDir()
.
- ToolDir_CreateIfMissing: Final[int]¶
Creates the directory if missing.
See also
appDataDir()
,userConfigDir()
,userPluginsDir()
,userHeadersDir()
,userMediaDir()
,userThemesDir()
,userCarbonThemesDir()
anduserPDBSymbolsDir()
.
- ToolDir_None: Final[int]¶
Returns the requested directory without checking for its existence or creating it if missing.
See also
appDataDir()
,userConfigDir()
,userPluginsDir()
,userHeadersDir()
,userMediaDir()
,userThemesDir()
,userCarbonThemesDir()
anduserPDBSymbolsDir()
.
- appDataDir(opt: int = ToolDir_CheckExistence) → str¶
Retrieves the user data directory for the application.
- Parameters
opt (int) – By default
ToolDir_CheckExistence
.- Returns
Returns the directory if successful; otherwise returns an empty string.
- Return type
str
See also
ToolDir_CreateIfMissing
.
- applyFilters(data: Pro.Core.NTContainer, str: str, waitdlg_or_wo: Union[Pro.Core.NTIWait, bool] = True) → Pro.Core.NTContainer¶
Applies the specified filters to an
NTContainer
and returns the resulting data as anNTContainer
.For example:
from Pro.Core import * c = NTContainer() c.setData(b"Hello, world!") # compress data with zlib fstr = "<flts><f name='pack/zlib' level='9' raw='true'/></flts>" # set the last parameter to False to hide the wait-box c = applyFilters(c, fstr, True) # print out the compressed data print(c.read(0, c.size()))By using filters it’s possible to perform complex data operations with just a few lines of code. In the code snippet above we use a filter to compress the input data using zlib.
- Parameters
data (NTContainer) – The input data.
str (str) – The filters XML string.
waitdlg_or_wo (Union[NTIWait, bool]) – Optionally displays a wait-dialog If
True
or specifies a wait object.- Returns
Returns the transformed data if successful; otherwise returns an invalid
NTContainer
.- Return type
See also
NTContainer
.
- carbonThemesDir() → str¶
- Returns
Returns the carbon themes directory.
- Return type
str
- cfsFileSystem() → Pro.Core.CFSInstance¶
Maps the computer file system to a
CFSInstance
instance.
- Returns
Returns a valid instance if successful; otherwise returns an invalid
CFSInstance
instance.- Return type
Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.
See also
cfsFileSystemEntry()
.See also
CFSInstance
andcfsFileSystemEntry()
.
- cfsFileSystemEntry(path: str) → Pro.Core.CFSEntry¶
Maps a file system file to a
CFSEntry
instance.
- Parameters
path (str) – The file name.
- Returns
Returns a valid entry if successful; otherwise returns an invalid
CFSEntry
instance.- Return type
Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.
See also
CFSEntry
andcfsFileSystem()
.
- configDir() → str¶
- Returns
Returns the configuration directory.
- Return type
str
- createAddressSpace(name: str, pt_offs: int = 0, arg2: int = 0, arg3: int = 0) → Pro.Core.NTAddressSpace¶
Creates an address space based on a page-table.
- Parameters
name (str) – The name of the address space to create. Supported values are:
"x86"
,"x86pae"
,"x64"
and"bitmap"
.pt_offs (int) – The offset of the page-table. When
"bitmap"
is specified, this parameter represents the offset of the bitmap.arg2 (int) – When
"bitmap"
is specified, this parameter represents size of the bitmap. For all other address spaces this parameter is ignored.arg3 (int) – When
"bitmap"
is specified, this parameter represents offset of the first page. For all other address spaces this parameter is ignored.- Returns
Returns the created address space if successful; otherwise returns an invalid address space.
- Return type
See also
createSparseAddressSpace()
,createBlockIOAddressSpace()
,NTAddressSpace
andNTContainer
.
- createBlockIOAddressSpace(total_size: int, page_size: int) → Pro.Core.NTAddressSpace¶
Creates a block I/O address space.
When applied onto an
NTContainer
object, it ensures that every I/O operation on the container is performed at the granularity of the specified block size.
- Parameters
total_size (int) – The total size that the container should appear to be. This parameter determines the size returned by
NTContainer.size()
.page_size (int) – The block size for I/O operations.
- Returns
Returns the created address space.
- Return type
See also
createAddressSpace()
,createSparseAddressSpace()
,NTAddressSpace
andNTContainer
.
- createContainerFromFile(fname: str) → Pro.Core.NTContainer¶
Creates an
NTContainer
object from a file on disk.Whether the file will be read into an internal memory buffer or accessed from disk is decided on the basis of available memory resources at the time of the call.
- Parameters
fname (str) – The name of the file.
- Returns
Returns a valid
NTContainer
if successful; otherwise returns an invalidNTContainer
.- Return type
See also
newContainer()
andNTContainer
.
- createSparseAddressSpace(reference_as: Pro.Core.NTContainer = NTContainer(), make_contiguous: bool = False, page_size: int = 0) → Pro.Core.NTAddressSpace¶
Creates a sparse address space.
- Parameters
reference_as (NTContainer) – An optional reference container object. This is used to propagate page flags.
make_contiguous (bool) – If
True
, the address space created will be contiguous.page_size (int) – The page size.
- Returns
Returns the created address space.
- Return type
See also
createAddressSpace()
,createBlockIOAddressSpace()
,NTAddressSpace
andNTContainer
.
- enableHook(name: str, enable: bool) → None¶
Enables or disables the specified hook
- Parameters
name (str) – The name of the hook.
enable (bool) – If
True
, the hook is enabled; otherwise it is disabled.
- executeFunctionInMainThread(func: object, ud: Optional[object] = None, blocking: bool = True) → object¶
Executes a function from the main thread.
The main thread is also the UI thread.
- Parameters
func (object) – The function to execute.
ud (object) – Optional object to be passed to the function to execute.
blocking (bool) – If
True
, the current thread will lock until the specified function is executed; otherwiseexecuteFunctionInMainThread()
will return immediately.- Returns
Returns the object returned by the specified function if
blocking=True
; otherwise returnsNone
.See also
isGuiThread()
.
- getFormatDescr(ext: str) → str¶
Retrieves the description for a format or extension.
- Parameters
ext (str) – The format or extension.
- Returns
Returns the description if successful; otherwise returns an empty string.
- Return type
str
Available since Cerbero Suite 7.7 and Cerbero Engine 4.7.
See also
getSupportedFormatsAndDescr()
.
- getFormatExtensions(ext: str) → Pro.Core.NTStringList¶
Retrieves all extensions for the specified format or extension.
- Parameters
ext (str) – The format or extension.
- Returns
Returns the list of extensions.
- Return type
Available since Cerbero Suite 7.7 and Cerbero Engine 4.7.
See also
getSupportedFormatsAndDescr()
andisExtensionSupported()
.
- getFormatFromExtension(ext: str) → str¶
Converts an extension to its format name.
- Parameters
ext (str) – The extension.
- Returns
Returns the format name if successful; otherwise returns an empty string.
- Return type
str
Available since Cerbero Suite 7.7 and Cerbero Engine 4.7.
See also
getFormatExtensions()
andisExtensionSupported()
.
- getFormatGroup(ext: str) → int¶
Converts a format or extension to its format group.
- Parameters
ext (str) – The format or extension.
- Returns
Returns the format group if successful; otherwise returns
FormatGroup_Unknown
.- Return type
int
Available since Cerbero Suite 7.7 and Cerbero Engine 4.7.
See also
getFormatGroupName()
andgetShortFormatGroupName()
.
- getFormatGroupFromShortName(name: str) → int¶
Converts the short name to a format group.
- Parameters
name (str) – The short name of the format group.
- Returns
Returns the format group if successful; otherwise returns
FormatGroup_Unknown
.- Return type
int
Available since Cerbero Suite 7.7 and Cerbero Engine 4.7.
See also
getShortFormatGroupName()
andgetFormatGroup()
.
- getFormatGroupName(group: int, plural: bool = False) → str¶
Retrieves the user-friendly name for the format group.
- Parameters
group (int) – The format group.
plural (bool) – If
True
, returns the plural name for the group; otherwise returns the singular name.- Returns
Returns the user-friendly name for the format group.
- Return type
str
Available since Cerbero Suite 7.7 and Cerbero Engine 4.7.
See also
getShortFormatGroupName()
andgetFormatGroup()
.
- getShortFormatGroupName(group: int) → str¶
Retrieves the short name for the format group.
- Parameters
group (int) – The format group.
- Returns
Returns the short name for the format group.
- Return type
str
Available since Cerbero Suite 7.7 and Cerbero Engine 4.7.
See also
getFormatGroupName()
,getFormatGroupFromShortName()
andgetFormatGroup()
.
- getSupportedFileExtensions() → Pro.Core.NTStringList¶
- Returns
Returns the list of supported file extensions.
- Return type
Available since Cerbero Suite 7.7 and Cerbero Engine 4.7.
See also
getSupportedFormatsAndDescr()
andisExtensionSupported()
.
- getSupportedFormatsAndDescr(flags: int = 0) → Pro.Core.NTStringPairList¶
Returns a list of supported file formats and their description.
- Parameters
flags (int) – Optional flags (e.g.,
GSP_FDFL_ONLY_FORMATS
).- Returns
Returns the list of supported file formats and their description.
- Return type
Available since Cerbero Suite 7.7 and Cerbero Engine 4.7.
See also
getFormatGroup()
.
- headersDir() → str¶
- Returns
Returns the headers directory.
- Return type
str
- identifyPossibleFormats(data: Pro.Core.NTContainer) → Pro.Core.NTStringList¶
Identifies a list of possible file formats for the input data.
- Parameters
data (NTContainer) – The input data.
- Returns
Returns a string list of file formats. If no file format was identified, the returned list is empty.
- Return type
See also
NTContainer
.
- isExtensionSupported(ext: str) → bool¶
Checks whether a format or extension is supported.
- Parameters
ext (str) – The format or extension.
- Returns
Returns
True
if the format or extension is supported; otherwise returnsFalse
.- Return type
bool
- isGuiThread() → bool¶
- Returns
Returns
True
if called from the UI thread; otherwise returnsFalse
.- Return type
bool
See also
executeFunctionInMainThread()
.
- mediaDir() → str¶
- Returns
Returns the media directory.
- Return type
str
- newContainer(size: int = 0, reserve_size: int = 4096, max_size: int = 0) → Pro.Core.NTContainer¶
Creates a new
NTContainer
object.Whether the container will be using an internal memory buffer or a file on disk is decided on the basis of available memory resources at the time of the call.
- Parameters
size (int) – The initial size of the container.
reserve_size (int) – The size to initially reserve for the container.
max_size (int) – The maximum size the container will ever reach. This is an optional parameter used to decide whether the container can operate on a memory buffer.
- Returns
Returns the created container if successful; otherwise returns an invalid container.
- Return type
See also
createContainerFromFile()
andNTContainer
.
- ntAlpha(rgb: int) → int¶
Retrieves the alpha color component from an RGBA value.
- Parameters
rgb (int) – The RGBA value.
- Returns
Returns the alpha color component.
- Return type
int
See also
ntRed()
,ntGreen()
,ntBlue()
,ntRgb()
andntRgba()
.
- ntAlphaBlend(src: int, bkg: int) → int¶
Performs an alpha blend operation on two RGBA values.
- Parameters
src (int) – The source RGBA value.
bkg (int) – The background RGBA value.
- Returns
Returns the RGBA result of the alpha blend operation.
- Return type
int
See also
ntShiftToColor()
,ntRgb()
andntRgba()
.
- ntBlue(rgb: int) → int¶
Retrieves the blue color component from an RGBA value.
- Parameters
rgb (int) – The RGBA value.
- Returns
Returns the blue color component.
- Return type
int
See also
ntRed()
,ntGreen()
,ntAlpha()
,ntRgb()
andntRgba()
.
- ntGreen(rgb: int) → int¶
Retrieves the green color component from an RGBA value.
- Parameters
rgb (int) – The RGBA value.
- Returns
Returns the green color component.
- Return type
int
See also
ntRed()
,ntBlue()
,ntAlpha()
,ntRgb()
andntRgba()
.
- ntRed(rgb: int) → int¶
Retrieves the read color component from an RGBA value.
- Parameters
rgb (int) – The RGBA value.
- Returns
Returns the red color component.
- Return type
int
See also
ntGreen()
,ntBlue()
,ntAlpha()
,ntRgb()
andntRgba()
.
- ntRgb(r: int, g: int, b: int) → int¶
Creates an RGBA value from its red, green and blue color components.
- Parameters
r (int) – The red color component.
g (int) – The green color component.
b (int) – The blue color component.
- Returns
Returns the RGBA value.
- Return type
int
See also
ntRed()
,ntGreen()
,ntBlue()
,ntAlpha()
andntRgba()
.
- ntRgba(r: int, g: int, b: int, a: int) → int¶
Creates an RGBA value from its red, green, blue and alpha color components.
- Parameters
r (int) – The red color component.
g (int) – The green color component.
b (int) – The blue color component.
a (int) – The alpha color component.
- Returns
Returns the RGBA value.
- Return type
int
See also
ntRed()
,ntGreen()
,ntBlue()
,ntAlpha()
andntRgb()
.
- ntShiftToColor(source: int, target: int, fraction: float) → int¶
Shift an RGBA value to another RGBA value.
- Parameters
source (int) – The source RGBA value.
target (int) – The target RGBA value.
fraction (float) – The shift factor expressed as a floating point number.
- Returns
Returns the computed RGBA value.
- Return type
int
See also
ntAlphaBlend()
,ntRgb()
andntRgba()
.
- class objdb_info¶
This class contains information about an entry in the object database.
See also
Report.objGetInfo()
,Report.objCursorInfo()
andReport.objViewInfo()
.Attributes:
The file name of the object as on disk.
The flags of the object (e.g.:
OFLAG_NO_DECRYPT
).The file format of the object.
The offset of the object inside the project database.
The risk factor of the object.
The target name of the object.
- filename¶
The file name of the object as on disk.
- flags¶
The flags of the object (e.g.:
OFLAG_NO_DECRYPT
).
- format¶
The file format of the object.
- offset¶
The offset of the object inside the project database.
This value is only used when scanned files are included in the project.
- risk¶
The risk factor of the object.
- target¶
The target name of the object.
- class objdbview_info¶
This class contains parameters to create a window view of the object database.
See also
Report.objViewCreate()
.Attributes:
The number of pages in the view.
Unused parameter.
The size of the window view.
- pages¶
The number of pages in the view.
This value is returned by
Report.objViewCreate()
.
- pos¶
Unused parameter.
- winsize¶
The size of the window view.
- packageCertificatesDir() → str¶
- Returns
Returns the package certificates directory.
- Return type
str
Available since Cerbero Suite 5.1 and Cerbero Engine 2.1.
- pluginsDir() → str¶
- Returns
Returns the plugins directory.
- Return type
str
Available since Cerbero Suite 5.3 and Cerbero Engine 2.3.
- proAbort(ret: int, msg: str = str()) → None¶
Aborts the application with an optional message.
- Parameters
ret (int) – The return value.
msg (str) – The optional abort message.
- proAddRecentFile(history: str, fname: str, max_list_size: int = 10) → bool¶
Adds a recent file name to a specified historical list.
- Parameters
history (str) – The unique name of the historical list.
fname (str) – The file name to add.
max_list_size (int) – The maximum size the list can reach.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 7.4 and Cerbero Engine 4.4.
See also
proGetRecentItems()
andproAddRecentItem()
.
- proAddRecentItem(history: str, item: str, max_list_size: int = 10) → bool¶
Adds a recent item to a specified historical list.
Hint
This function is used to implement recent items in logic providers.
- Parameters
history (str) – The unique name of the historical list.
item (str) – The item to add.
max_list_size (int) – The maximum size the list can reach.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 7.4 and Cerbero Engine 4.4.
See also
proGetRecentItems()
andproAddRecentFile()
.
- proApplicationFileName() → str¶
- Returns
Returns the path of the main application.
- Return type
str
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
- proArchIsX64() → bool¶
- Returns
Returns
True
if the current architecture is x64; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
proArchName()
andproArchIsX86()
.
- proArchIsX86() → bool¶
- Returns
Returns
True
if the current architecture is x86; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
proArchName()
andproArchIsX64()
.
- proArchName() → str¶
- Returns
Returns the name of the current architecture (e.g.,
'x64'
).- Return type
str
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
proArchIsX86()
andproArchIsX64()
.
- proClearOutput(with_undo: bool = True) → None¶
Clears the output view if available.
- Parameters
with_undo (bool) – If
True
, gives the user the possibility to undo this operation from the UI.See also
proPrint()
andproPrintnl()
.
- proCoreContext() → Pro.Core.ProCoreContext¶
- Returns
Returns the global
ProCoreContext
instance.- Return type
See also
ProCoreContext
.
- proCrashApplication(i: int) → None¶
Crashes the application on purpose.
This function is provided for debugging purposes.
- Parameters
i (int) – A value which may be used to generate the exception.
See also
proAbort()
.
- proDisasmOptions() → int¶
- Returns
Returns the current disassembly options for the text view.
- Return type
int
See also
DisasmOpt_Opcodes
andDisasmOpt_FileOffsets
.
- proGetAvailablePlugins(config_name: str) → Pro.Core.ProPluginList¶
Retrieves a list of generic plugins.
- Parameters
config_name (str) – The configuration name.
Important
The configuration name must the name of the file without the ‘.cfg’ extension. The file must be located in the user configuration directory.
- Returns
Returns a list of
ProPlugin
instances.- Return type
Available since Cerbero Suite 7.6 and Cerbero Engine 4.6.
See also
ProPlugin
andProPluginInterface
.
- proGetIntPtr(name: str) → native_pointer¶
Retrieves an internal pointer.
Note
This function is reserved for internal use.
- Parameters
name (str) – The name of the pointer to retrieve.
- Returns
Returns the requested pointer if successful; otherwise returns
None
.- Return type
native_pointer
Available since Cerbero Suite 6.5 and Cerbero Engine 3.5.
- proGetLine(prompt: str = str()) → str¶
Retrieves an input string either by prompting a dialog box or from the terminal.
Note
This function is used internally by Python’s built-in
input()
function.
- Parameters
prompt (str) – The message prompted to the user.
- Returns
Returns the string entered by the user.
- Return type
str
Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.
See also
proPrint()
andproPrintnl()
.
- proGetRecentItems(history: str) → Pro.Core.NTStringList¶
Retrieves a specified historical list.
Hint
This function is used to implement recent items in logic providers.
- Parameters
history (str) – The unique name of the historical list.
- Returns
Returns the requested historical list.
- Return type
Available since Cerbero Suite 7.4 and Cerbero Engine 4.4.
See also
proAddRecentItem()
andproAddRecentFile()
.
- proGetRiskBgColor(risk: int, bg: int) → int¶
Computes a color based on risk percentage.
- Parameters
risk (int) – The risk percentage.
bg (int) – The background color.
- Returns
Returns the computed risk color.
- Return type
int
See also
ntRgba()
,ntRgb()
andntShiftToColor()
.
- proIsEngine() → bool¶
- Returns
Returns
True
if the code is running under Cerbero Engine; otherwise returnsFalse
.- Return type
bool
- proLaunchApplication(app: str, args: Pro.Core.NTStringList = NTStringList()) → bool¶
Launches an application.
- Parameters
app (str) – The application to launch.
args (NTStringList) – The arguments to be passed to the application.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
proLaunchThisApplication()
.
- proLaunchThisApplication(args: Pro.Core.NTStringList = NTStringList()) → bool¶
Launches the main application.
Note
Internally this function calls
proLaunchApplication()
withproApplicationFileName()
as application.
- Parameters
args (NTStringList) – The arguments to be passed to the application.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
proLaunchApplication()
andproApplicationFileName()
.
- proPlatformIsLinux() → bool¶
- Returns
Returns
True
if the current platform is Linux; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
proPlatformName()
,proPlatformShortName()
,proPlatformIsWindows()
andproPlatformIsMacOS()
.
- proPlatformIsMacOS() → bool¶
- Returns
Returns
True
if the current platform is macOS; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
proPlatformName()
,proPlatformShortName()
,proPlatformIsWindows()
andproPlatformIsLinux()
.
- proPlatformIsWindows() → bool¶
- Returns
Returns
True
if the current platform is Windows; otherwise returnsFalse
.- Return type
bool
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
proPlatformName()
,proPlatformShortName()
,proPlatformIsLinux()
andproPlatformIsMacOS()
.
- proPlatformName() → str¶
- Returns
Returns the name of the current platform (supported values are:
'windows'
,'linux'
and'macos'
).- Return type
str
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
proPlatformShortName()
,proPlatformIsWindows()
,proPlatformIsLinux()
andproPlatformIsMacOS()
.
- proPlatformShortName() → str¶
- Returns
Returns the short name of the current platform (supported values are:
'win'
,'lin'
and'mac'
).- Return type
str
Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.
See also
proPlatformName()
,proPlatformIsWindows()
,proPlatformIsLinux()
andproPlatformIsMacOS()
.
- proPrint(str: str) → None¶
Prints a message to the output view.
The difference with
proPrintnl()
is that the message is not be terminated by a new-line character.
- Parameters
str (str) – The message to print.
See also
proPrintnl()
andproClearOutput()
.
- proPrintnl(str: str) → None¶
Prints a message to the output view.
The difference with
proPrint()
is that a new-line character is automatically appended to the message.
- Parameters
str (str) – The message to print.
See also
proPrint()
andproClearOutput()
.
- proProcessEvents(ms: int = 0) → None¶
Processes thread loop events.
When called from the UI thread, this function processes UI events.
- Parameters
ms (int) – The maximum amount of time expressed in milliseconds to be spent processing queued events. If
0
, all queued events are processed.See also
NTIWait
.
- proSetReturnCode(ret: int) → None¶
Sets the return code for the application.
- Parameters
ret (int) – The return code.
Available since Cerbero Suite 5.1 and Cerbero Engine 2.1.
See also
ProCoreContext.quit()
andproAbort()
.
- proTextStream() → Pro.Core.NTTextBuffer¶
Creates a new
NTTextBuffer
instance with the default disassembly options.
- Returns
Returns a new
NTTextBuffer
instance.- Return type
See also
proDisasmOptions()
andNTTextStream
.
- proVersion() → str¶
- Returns
Returns the current version of the application as a string in the shape of major_version.minor_version.build_version.
- Return type
str
See also
proVersionMajor()
,proVersionMinor()
andproVersionBuild()
.
- proVersionBuild() → int¶
- Returns
Returns the build number of the application.
- Return type
int
Available since Cerbero Suite 5.1 and Cerbero Engine 2.1.
See also
proVersion()
,proVersionMajor()
andproVersionMinor()
.
- proVersionMajor() → int¶
- Returns
Returns the major version of the application.
- Return type
int
Available since Cerbero Suite 5.1 and Cerbero Engine 2.1.
See also
proVersion()
,proVersionMinor()
andproVersionBuild()
.
- proVersionMinor() → int¶
- Returns
Returns the minor version of the application.
- Return type
int
Available since Cerbero Suite 5.1 and Cerbero Engine 2.1.
See also
proVersion()
,proVersionMajor()
andproVersionBuild()
.
- pythonAllowIdleProcessing(b: bool) → None¶
Enables or disables the idle processing of Python code.
This function should be used rarely. Once the idle processing is disabled, it must be re-enabled as soon as possible.
- Parameters
b (bool) – If
False
, disables the idle processing of Python code.
- themesDir() → str¶
- Returns
Returns the themes directory.
- Return type
str
- userCarbonThemesDir(opt: int = ToolDir_CheckExistence) → str¶
Retrieves the user carbon themes directory.
- Parameters
opt (int) – By default
ToolDir_CheckExistence
.- Returns
Returns the directory if successful; otherwise returns an empty string.
- Return type
str
See also
ToolDir_CreateIfMissing
.
- userConfigDir(opt: int = ToolDir_CheckExistence) → str¶
Retrieves the user configuration directory.
- Parameters
opt (int) – By default
ToolDir_CheckExistence
.- Returns
Returns the directory if successful; otherwise returns an empty string.
- Return type
str
See also
ToolDir_CreateIfMissing
.
- userHeadersDir(opt: int = ToolDir_CheckExistence) → str¶
Retrieves the user headers directory.
- Parameters
opt (int) – By default
ToolDir_CheckExistence
.- Returns
Returns the directory if successful; otherwise returns an empty string.
- Return type
str
See also
ToolDir_CreateIfMissing
.
- userMediaDir(opt: int = ToolDir_CheckExistence) → str¶
Retrieves the user media directory.
- Parameters
opt (int) – By default
ToolDir_CheckExistence
.- Returns
Returns the directory if successful; otherwise returns an empty string.
- Return type
str
See also
ToolDir_CreateIfMissing
.
- userPDBSymbolsDir(opt: int = ToolDir_CheckExistence) → str¶
Retrieves the user PDB symbols directory.
- Parameters
opt (int) – By default
ToolDir_CheckExistence
.- Returns
Returns the directory if successful; otherwise returns an empty string.
- Return type
str
See also
ToolDir_CreateIfMissing
.
- userPackageCertificatesDir(opt: int = ToolDir_CheckExistence) → str¶
Retrieves the user package certificates directory.
- Parameters
opt (int) – By default
ToolDir_CheckExistence
.- Returns
Returns the directory if successful; otherwise returns an empty string.
- Return type
str
Available since Cerbero Suite 5.1 and Cerbero Engine 2.1.
See also
ToolDir_CreateIfMissing
.
- userPackagesDir(opt: int = ToolDir_CheckExistence) → str¶
Retrieves the user packages directory.
- Parameters
opt (int) – By default
ToolDir_CheckExistence
.- Returns
Returns the directory if successful; otherwise returns an empty string.
- Return type
str
Available since Cerbero Suite 5.1 and Cerbero Engine 2.1.
See also
ToolDir_CreateIfMissing
.
- userPluginsDir(opt: int = ToolDir_CheckExistence) → str¶
Retrieves the user plugins directory.
- Parameters
opt (int) – By default
ToolDir_CheckExistence
.- Returns
Returns the directory if successful; otherwise returns an empty string.
- Return type
str
See also
ToolDir_CreateIfMissing
anduserPythonPluginsDir()
.
- userPythonPluginsDir(opt: int = ToolDir_CheckExistence) → str¶
Retrieves the user Python plugins directory.
- Parameters
opt (int) – By default
ToolDir_CheckExistence
.- Returns
Returns the directory if successful; otherwise returns an empty string.
- Return type
str
Available since Cerbero Suite 5.1 and Cerbero Engine 2.1.
See also
ToolDir_CreateIfMissing
.
- userThemesDir(opt: int = ToolDir_CheckExistence) → str¶
Retrieves the user themes directory.
- Parameters
opt (int) – By default
ToolDir_CheckExistence
.- Returns
Returns the directory if successful; otherwise returns an empty string.
- Return type
str
See also
ToolDir_CreateIfMissing
.