几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】oddbtextiterator with zero-length string (http://www.dimcax.com/hust/showthread.php?t=17627)

yang686526 2009-05-06 08:19 PM

【转帖】oddbtextiterator with zero-length string
 
oddbtextiterator with zero-length string
oddbtextiterator with zero-length string
hello-
it appears to me that if an oddbtextiterator is initialized with a string of zero length, then the current properties field is not initialized correctly. this structure includes a field, blastchar, that can be used to determine if the iterator is at the end of the string. this field is not set upon initialization, and so testing it, then calling nextchar() when blastchar is false, will attempt to read a character (though nextchar() returns 0 and then sets blastchar).
shouldn't this field be set upon initialization of the oddbtextiterator? is there something else i am missing? is there a better way to test if an iterator is at its end that is initialized immediately?
thanks,
mike ryan
hello,
you are right. the current properties are valid after call nextchar(). it is as design.
quote:
is there a better way to test if an iterator is at its end that is initialized immediately?
you can avoid using textiterator for empty string via test odstring.isempty() befor init it.
best regards,
sergey z.


所有的时间均为北京时间。 现在的时间是 07:45 AM.