winIDEA SDK
|
In general the Python API is the same as C++ API, since Python wrapper is automatically generated from C++ header files. The only exception is package isystem.test
, which contains python.exports.isystem.itest.PTestCase(). This class implements functionality of isys::CTestCase()
, except that its callback methods are Python methods. It also contains some additional helper functions.
Module isystem.connect contains method getModuleVersion()
, which returns a string containing version of winIDEA SDK
for Python installed on your computer:
import isystem.connect as ic print(ic.getModuleVersion())
isystem.connect
also contains Python wrappers for containers from C++ Standard Library. It is recommended to consult a C++ Standard Library manual for method details. Python's function help(object)
is also useful to see the list of available methods for each wrapper.
Python wrapper for std::map
provides functionality of Python mapping, but only for string type: std:map<std::string, std::string>
. It is instantiated as StrStrMap
, which supports overloaded operators, iterators, and easy conversion between C++ and Python objects. Example:
import isystem.connect as ic m = {'a': 'r', 'b': 'q'} sm = ic.StrStrMap(m) # init StrStrMap with Python mapping m2 = dict(sm) # init Python mapping m2 with StrStrMap sm['counter'] = '10' # overloaded [], but for strings only print(sm['counter']) sm['g_timeout'] = '30' for k in sm: print(k, ': ', sm[k], sep='')
Output: 10 a: r b: q counter: 10 g_timeout: 30
Methods:
begin()
- returns iterator pointing to the first element
clear()
- removes all elements from map
count()
- returns the number of elements in he map
empty()
- returns true, if map is empty
end()
- returns iterator pointing to end
erase(iterator)
- removes elements defined by iterator
erase(iterator_1, iterator_2)
- removes elements between iterators
find(K key)
- returns iterator pointing to key
has_key(K key)
- returns true, if map contains key
items()
- returns Python list of (K, V) tuples, for example
[('a', '10'), ('b', '20')]
iterator()
- returns iterator object
iteritems()
- returns items iterator
iterkeys()
- returns keys iterator
itervalues()
- returns values iterator
key_iterator()
- returns key iterator
keys()
- returns Python list containing all keys from map
lower_bound(K key)
- returns an iterator pointing to the first element in the container whose key does not compare less than x
rbegin()
- returns reverse iterator to reverse beginning
rend()
- returns reverse iterator to reverse end
size()
- returns the number of elements in map
swap(std::map<K, V>)
- swaps map content
upper_bound(K key)
- returns an iterator pointing to the first element in the container whose key compares greater than x
value_iterator()
- returns iterator to map values
values()
- returns Python list of all values from map
C++ container std::vector<std::string> is available in isystem.connect
as isystem.connect.StrVector()
. Instantiate it when needed as method parameter.
It contains the following methods:
Methods:
operator
[i] - returns element at index i
append(T element)
- appends element to the end
assign(int count, T element)
- fills vector with count
copies of element
back()
- returns the last element
begin()
- returns iterator pointing to the first element
capacity(*args)
- returns size of allocated storage capacity
clear()
- removes all elements
empty()
- returns true, if vector is empty
end()
- returns iterator pointing to end
erase(iterator)
- removes elements defined by iterator
erase(iterator_1, iterator_2)
- removes elements between iterators
front(*args)
- returns the first element
insert(iterator position, T element)
- inserts element at the given position
iterator()
- returns iterator object
pop()
- removes and returns the last element in vector
pop_back()
- removes the last element in vector
push_back(T element)
- appends element to the end
rbegin()
- returns reverse iterator to reverse beginning
rend()
- returns reverse iterator to reverse end
reserve(*args)
- changes vector capacity
resize(*args)
- changes vector size
size()
- returns the number of elements in vector
swap(std::vector<T> v2)
- swaps contents