Beispiel #1
0
def functions(parent):
    functions = [
        ('Logger getLogger()',
         'Return the root logger.'),
        ('Logger getLogger(std::wstring name)',
         'Return a logger with the specified name.'),
        ('boost::python::object getLoggerClass()',
         'Return either the standard Logger class, or the last class passed to setLoggerClass().'),
        ('void log(Level l, std::wstring msg)',
         'Logs a message with level level on the root logger.'),
        ('void disable(Level l)',
         'Provides an overriding level lvl for all loggers which takes precedence over the logger\'s own level.'),
        ('void addLevelName(Level l, std::wstring name)',
         'Associates level lvl with text levelName in an internal dictionary, which is used to map numeric levels to a textual representation, for example when a Formatter formats a message. '),
        ('std::wstring getLevelName(Level l)',
         'Returns the textual representation of logging level lvl.'),
        # TODO: makeLogRecord
        ('void shutdown()',
         'Informs the logging system to perform an orderly shutdown by flushing and closing all handlers. This should be called at application exit and no further use of the logging system should be made after this call.'),
        ('void setLoggerClass(boost::python::object klass)',
         'Tells the logging system to use the class klass when instantiating a logger.'),
        ('void exception(std::wstring msg)',
         'Logs a message with level ERROR on the root logger. Exception info is added to the logging message. This function should only be called from an exception handler.'),
        ]

    for f in functions:
        function(f[0], parent=parent, doc=f[1])

    for lvl in ['debug', 'info', 'warning', 'error', 'critical']:
        function('void {0}(std::wstring msg)'.format(lvl),
                 parent=parent,
                 doc='Logs a message with level {0} on the root logger.'.format(lvl.upper()))
Beispiel #2
0
def definition(env):
    t = TranslationUnit(
        guard='INCLUDE_ACKWARD_TIME_MODULE_HPP')
    n = Namespace('ackward', 'time', parent=t)
    Module(name='time', parent=n)
    function('float time()', parent=n)

    return t
Beispiel #3
0
def functions(parent):
    funcs = [
        (fileConfig1_doc,
         'void fileConfig(std::wstring filename)'),
        (fileConfig2_doc,
         'void fileConfig(std::wstring filename, boost::python::dict defaults)'),
        # (listen1_doc,
        #  'void listen()'),
        # (listen2_doc,
        #  'void listen(unsigned int port)'),
        # (stopListening_doc,
        #  'void stopListening()'),
        ]

    for d,f in funcs:
        func = function(f, parent=parent)
        if d: func.doc = d
Beispiel #4
0
def definition(env):
    t = TranslationUnit(
        header_includes=[("ackward", "uuid", "Types.hpp"), ("ackward", "uuid", "UUID.hpp")],
        impl_includes=[("ackward", "uuid", "Module.hpp")],
    )

    ns = Namespace("ackward", "uuid", parent=t)

    # NOTE: This method fails mysteriously when not under the
    # debugger. Why?
    function("Node getnode()", doc=get_node_doc, parent=ns)

    # uuid.uuid1([node[, clock_seq]]) Generate a UUID from a
    # host ID, sequence number, and the current time. If node
    # is not given, getnode() is used to obtain the hardware
    # address. If clock_seq is given, it is used as the
    # sequence number; otherwise a random 14-bit sequence
    # number is chosen.
    function("UUID uuid1()", doc=uuid1_doc, parent=ns)

    function("UUID uuid1(Node node)", doc=uuid1_doc, parent=ns)
    function("UUID uuid1(Node node, unsigned int clock_seq)", doc=uuid1_doc, parent=ns)

    # uuid.uuid3(namespace, name) Generate a UUID based on the
    # MD5 hash of a namespace identifier (which is a UUID) and
    # a name (which is a string).
    function("UUID uuid3(UUID name_space, std::string name)", parent=ns, doc=uuid3_doc)

    # uuid.uuid4()
    # Generate a random UUID.
    function("UUID uuid4()", doc=uuid4_doc, parent=ns)

    function("UUID uuid5(UUID name_space, std::string name)", doc=uuid5_doc, parent=ns)

    # The uuid module defines the following namespace
    # identifiers for use with uuid3() or uuid5().

    # uuid.NAMESPACE_DNS
    # When this namespace is specified, the name string is a
    # fully-qualified domain name.

    mod = Module(name="uuid", parent=ns)
    ModuleProperty(
        name="NAMESPACE_DNS",
        type="UUID",
        doc="When this namespace is specified, the name string is a fully-qualified domain name.",
        parent=mod,
    )
    ModuleProperty(
        name="NAMESPACE_URL", type="UUID", doc="When this namespace is specified, the name string is a URL.", parent=mod
    )
    ModuleProperty(
        name="NAMESPACE_OID",
        type="UUID",
        doc="When this namespace is specified, the name string is an ISO OID.",
        parent=mod,
    )
    ModuleProperty(
        name="NAMESPACE_X500",
        type="UUID",
        doc="When this namespace is specified, the name string is an X.500 DN in DER or a text output format.",
        parent=mod,
    )

    return t