mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
36 lines
1.1 KiB
Cython
36 lines
1.1 KiB
Cython
# Copyright 2014 The Chromium Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
# distutils: language = c++
|
|
|
|
from libc.stdint cimport uint8_t
|
|
from libcpp cimport bool
|
|
from libcpp.string cimport string
|
|
from libcpp.vector cimport vector
|
|
|
|
cdef extern from "third_party/cython/python_export.h":
|
|
pass
|
|
|
|
cdef extern from "mojo/public/cpp/bindings/tests/validation_test_input_parser.h":
|
|
cdef bool ParseValidationTestInput "mojo::test::ParseValidationTestInput"(
|
|
string input,
|
|
vector[uint8_t]* data,
|
|
size_t* num_handles,
|
|
string* error_message)
|
|
|
|
class Data(object):
|
|
def __init__(self, data, num_handles, error_message):
|
|
self.data = data
|
|
self.num_handles = num_handles
|
|
self.error_message = error_message
|
|
|
|
def ParseData(value):
|
|
cdef string value_as_string = value
|
|
cdef vector[uint8_t] data_as_vector
|
|
cdef size_t num_handles
|
|
cdef string error_message
|
|
ParseValidationTestInput(
|
|
value, &data_as_vector, &num_handles, &error_message)
|
|
return Data(bytearray(data_as_vector), num_handles, error_message)
|