MCPcopy Create free account
hub / github.com/KiCad/kicad-source-mirror / ReadDelimitedText

Function ReadDelimitedText

common/string_utils.cpp:439–481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

437
438
439int ReadDelimitedText( wxString* aDest, const char* aSource )
440{
441 std::string utf8; // utf8 but without escapes and quotes.
442 bool inside = false;
443 const char* start = aSource;
444 char cc;
445
446 while( (cc = *aSource++) != 0 )
447 {
448 if( cc == '"' )
449 {
450 if( inside )
451 break; // 2nd double quote is end of delimited text
452
453 inside = true; // first delimiter found, make note, do not copy
454 }
455
456 else if( inside )
457 {
458 if( cc == '\\' )
459 {
460 cc = *aSource++;
461
462 if( !cc )
463 break;
464
465 // do no copy the escape byte if it is followed by \ or "
466 if( cc != '"' && cc != '\\' )
467 utf8 += '\\';
468
469 utf8 += cc;
470 }
471 else
472 {
473 utf8 += cc;
474 }
475 }
476 }
477
478 *aDest = From_UTF8( utf8.c_str() );
479
480 return aSource - start;
481}
482
483
484int ReadDelimitedText( char* aDest, const char* aSource, int aDestSize )

Callers 9

loadSHEETMethod · 0.85
loadPADMethod · 0.85
loadMODULE_TEXTMethod · 0.85
load3DMethod · 0.85
loadNETINFO_ITEMMethod · 0.85
loadPCB_TEXTMethod · 0.85
loadNETCLASSMethod · 0.85
loadZONE_CONTAINERMethod · 0.85
loadDIMENSIONMethod · 0.85

Calls 2

c_strMethod · 0.80
From_UTF8Function · 0.70

Tested by

no test coverage detected