From a4a0c8f20bff1517ea1a47f136e99359572b4b1a Mon Sep 17 00:00:00 2001 From: Zen Date: Mon, 5 Aug 2024 09:35:44 +0800 Subject: [PATCH] Rename the type for HeaderComments --- stfpy/stfpy/stf_inst_reader.pxd | 20 ++++++++++---------- stfpy/stfpy/stf_inst_reader.pyx | 8 ++++---- stfpy/stfpy/stf_lib/stf_inst_reader.pxd | 6 +++--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/stfpy/stfpy/stf_inst_reader.pxd b/stfpy/stfpy/stf_inst_reader.pxd index 28a2b9f..9790186 100644 --- a/stfpy/stfpy/stf_inst_reader.pxd +++ b/stfpy/stfpy/stf_inst_reader.pxd @@ -2,27 +2,27 @@ from cython.operator cimport dereference from stfpy.stf_lib.stf_inst_reader cimport STFInstReader as _STFInstReader -from stfpy.stf_lib.stf_inst_reader cimport StringVector as _StringVector, StringVectorIterator as _StringVectorIterator +from stfpy.stf_lib.stf_inst_reader cimport HeaderCommentsType as _HeaderCommentsType, HeaderCommentsTypeIterator as _HeaderCommentsTypeIterator ctypedef _STFInstReader.iterator _STFInstReaderIterator -cdef class StringVectorIterator: - cdef _StringVectorIterator c_it - cdef _StringVectorIterator c_end_it +cdef class HeaderCommentsTypeIterator: + cdef _HeaderCommentsTypeIterator c_it + cdef _HeaderCommentsTypeIterator c_end_it @staticmethod - cdef inline StringVectorIterator _construct(const _StringVector* vec): - it = StringVectorIterator() + cdef inline HeaderCommentsTypeIterator _construct(const _HeaderCommentsType* vec): + it = HeaderCommentsTypeIterator() it.c_it = dereference(vec).begin() it.c_end_it = dereference(vec).end() return it -cdef class StringVector: - cdef const _StringVector* c_vec +cdef class HeaderCommentsType: + cdef const _HeaderCommentsType* c_vec @staticmethod - cdef inline StringVector _construct(const _StringVector& vec): - new_vec = StringVector() + cdef inline HeaderCommentsType _construct(const _HeaderCommentsType& vec): + new_vec = HeaderCommentsType() new_vec.c_vec = &vec return new_vec diff --git a/stfpy/stfpy/stf_inst_reader.pyx b/stfpy/stfpy/stf_inst_reader.pyx index e615ab2..52d362f 100644 --- a/stfpy/stfpy/stf_inst_reader.pyx +++ b/stfpy/stfpy/stf_inst_reader.pyx @@ -7,7 +7,7 @@ from stfpy.stf_inst import STFInst from cython.operator cimport dereference, preincrement include "stfpy/stf_lib/stf_reader_constants.pxi" -cdef class StringVectorIterator: +cdef class HeaderCommentsTypeIterator: def __next__(self): if self.c_it == self.c_end_it: raise StopIteration @@ -15,9 +15,9 @@ cdef class StringVectorIterator: preincrement(self.c_it) return value -cdef class StringVector: +cdef class HeaderCommentsType: def __iter__(self): - return StringVectorIterator._construct(self.c_vec) + return HeaderCommentsTypeIterator._construct(self.c_vec) def __len__(self): return dereference(self.c_vec).size() @@ -73,4 +73,4 @@ cdef class STFInstReader: return self.c_reader.minor() def getHeaderComments(self): - return StringVector._construct(dereference(self.c_reader).getHeaderCommentsString()) + return HeaderCommentsType._construct(dereference(self.c_reader).getHeaderCommentsString()) diff --git a/stfpy/stfpy/stf_lib/stf_inst_reader.pxd b/stfpy/stfpy/stf_lib/stf_inst_reader.pxd index 28904aa..dcd7176 100644 --- a/stfpy/stfpy/stf_lib/stf_inst_reader.pxd +++ b/stfpy/stfpy/stf_lib/stf_inst_reader.pxd @@ -5,8 +5,8 @@ from libcpp.vector cimport vector from cython.cimports.libcpp.string import string from stfpy.stf_lib.stf_inst cimport STFInst -ctypedef vector[string] StringVector -ctypedef vector[string].const_iterator StringVectorIterator +ctypedef vector[string] HeaderCommentsType +ctypedef vector[string].const_iterator HeaderCommentsTypeIterator cdef extern from "stf_inst_reader.hpp" namespace "stf": cdef cppclass STFInstReader: @@ -25,4 +25,4 @@ cdef extern from "stf_inst_reader.hpp" namespace "stf": iterator end() uint32_t major() uint32_t minor() - const StringVector& getHeaderCommentsString() + const HeaderCommentsType& getHeaderCommentsString()