# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- # # This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. #
import gdb import six
from libreoffice.util import printing
class B2DRangePrinter(object): '''Prints a B2DRange object.'''
def _count(self): # It's a call into the inferior (being debugged) process. # Will not work with core dumps and can cause a deadlock. if self.value.__str__() == "": return 0 else: return int(gdb.parse_and_eval( "(('basegfx::B2DPolygon' *) {})->count()".format(self.value.address)))
def _isEmpty(self): return self._count() == 0
def _hasCurves(self): # It's a call into the inferior (being debugged) process. # Will not work with core dumps and can cause a deadlock. if self.value.__str__() == "": returnFalse else: return int(gdb.parse_and_eval( "(('basegfx::B2DPolygon' *) {})->areControlPointsUsed()".format(self.value.address))) != 0
# It's a call into the inferior (being debugged) process. # Will not work with core dumps and can cause a deadlock.
prevControl = gdb.parse_and_eval( "(('basegfx::B2DPolygon' *) {})->getPrevControlPoint({:d})".format(self.value.address, self.index)) # It's a call into the inferior (being debugged) process. # Will not work with core dumps and can cause a deadlock.
nextControl = gdb.parse_and_eval( "(('basegfx::B2DPolygon' *) {})->getNextControlPoint({:d})".format(self.value.address, self.index))
self.index += 1 return ('point %d' % (self.index-1), 'p: (%15f, %15f) c-1: (%15f, %15f) c1: (%15f, %15f)' %
(currPoint['mnX'], currPoint['mnY'],
prevControl['mnX'], prevControl['mnY'],
nextControl['mnX'], nextControl['mnY']))
class B2DPolyPolygonPrinter(object): '''Prints a B2DPolyPolygon object.'''
def __init__(self, typename, value):
self.typename = typename
self.value = value
def to_string(self): if self._isEmpty(): return"empty %s" % (self.typename) else: return"%s %s with %d sub-polygon(s)" % ('closed'if self._isClosed() else'open',
self.typename,
self._count())
def _count(self): # It's a call into the inferior (being debugged) process. # Will not work with core dumps and can cause a deadlock. if self.value.__str__() == "": return 0 else: return int(gdb.parse_and_eval( "(('basegfx::B2DPolyPolygon' *) {})->count()".format(self.value.address)))
def _isClosed(self): # It's a call into the inferior (being debugged) process. # Will not work with core dumps and can cause a deadlock. if self.value.__str__() == "": returnTrue else: return int(gdb.parse_and_eval( "(('basegfx::B2DPolyPolygon' *) {})->isClosed()".format(self.value.address))) != 0
def _isEmpty(self): return self._count() == 0
def children(self): if self.value['mpPolyPolygon']['m_pimpl'].type.code in (gdb.TYPE_CODE_PTR, gdb.TYPE_CODE_MEMBERPTR): if self.value['mpPolyPolygon']['m_pimpl']: try:
vector = self.value['mpPolyPolygon']['m_pimpl'].dereference()['m_value']['maPolygons'] import libstdcxx.v6.printers as std return std.StdVectorPrinter("std::vector", vector).children() except RuntimeError:
gdb.write("Cannot access memory at address " + str(self.value['mpPolyPolygon']['m_pimpl'].address))
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.