383 while(ptr < p_line_length && !
is_spacing(p_line[ptr])) ptr++;
386 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
387 t_size file_base,file_length, type_base,type_length;
389 if (p_line[ptr] ==
'\"')
393 while(ptr < p_line_length && p_line[ptr] !=
'\"') ptr++;
394 if (ptr == p_line_length) pfc::throw_exception_with_message< exception_cue > (
"invalid FILE syntax");
395 file_length = ptr - file_base;
397 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
402 while(ptr < p_line_length && !
is_spacing(p_line[ptr])) ptr++;
403 file_length = ptr - file_base;
404 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
408 while(ptr < p_line_length && !
is_spacing(p_line[ptr])) ptr++;
409 type_length = ptr - type_base;
410 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
412 if (ptr != p_line_length || file_length == 0 || type_length == 0) pfc::throw_exception_with_message< exception_cue > (
"invalid FILE syntax");
414 p_callback.on_file(p_line + file_base, file_length, p_line + type_base, type_length);
418 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
420 t_size track_base = ptr, track_length;
421 while(ptr < p_line_length && !
is_spacing(p_line[ptr]))
423 if (!
is_numeric(p_line[ptr])) pfc::throw_exception_with_message< exception_cue > (
"invalid TRACK syntax");
426 track_length = ptr - track_base;
427 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
429 t_size type_base = ptr, type_length;
430 while(ptr < p_line_length && !
is_spacing(p_line[ptr])) ptr++;
431 type_length = ptr - type_base;
433 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
434 if (ptr != p_line_length || type_length == 0) pfc::throw_exception_with_message< exception_cue > (
"invalid TRACK syntax");
435 unsigned track =
pfc::atoui_ex(p_line+track_base,track_length);
436 if (track < 1 || track > 99) pfc::throw_exception_with_message< exception_cue > (
"invalid track number");
438 p_callback.on_track(track,p_line + type_base, type_length);
442 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
444 t_size index_base,index_length, time_base,time_length;
446 while(ptr < p_line_length && !
is_spacing(p_line[ptr]))
448 if (!
is_numeric(p_line[ptr])) pfc::throw_exception_with_message< exception_cue > (
"invalid INDEX syntax" );
451 index_length = ptr - index_base;
453 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
455 while(ptr < p_line_length && !
is_spacing(p_line[ptr]))
457 if (!
is_numeric(p_line[ptr]) && p_line[ptr] !=
':')
458 pfc::throw_exception_with_message< exception_cue > (
"invalid INDEX syntax");
461 time_length = ptr - time_base;
463 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
465 if (ptr != p_line_length || index_length == 0 || time_length == 0)
466 pfc::throw_exception_with_message< exception_cue > (
"invalid INDEX syntax");
468 unsigned index =
pfc::atoui_ex(p_line+index_base,index_length);
469 if (index > 99) pfc::throw_exception_with_message< exception_cue > (
"invalid INDEX syntax");
472 p_callback.on_index(index,time);
476 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
478 t_size time_base, time_length;
480 while(ptr < p_line_length && !
is_spacing(p_line[ptr]))
482 if (!
is_numeric(p_line[ptr]) && p_line[ptr] !=
':')
483 pfc::throw_exception_with_message< exception_cue > (
"invalid PREGAP syntax");
486 time_length = ptr - time_base;
488 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
490 if (ptr != p_line_length || time_length == 0)
491 pfc::throw_exception_with_message< exception_cue > (
"invalid PREGAP syntax");
495 p_callback.on_pregap(time);
499 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
500 if (ptr == p_line_length) pfc::throw_exception_with_message< exception_cue > (
"invalid TITLE syntax");
501 if (p_line[ptr] ==
'\"')
505 while(ptr < p_line_length && p_line[ptr] !=
'\"') ptr++;
506 if (ptr == p_line_length) pfc::throw_exception_with_message< exception_cue > (
"invalid TITLE syntax");
509 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
510 if (ptr != p_line_length) pfc::throw_exception_with_message< exception_cue > (
"invalid TITLE syntax");
511 p_callback.on_title(p_line+base,length);
515 p_callback.on_title(p_line+ptr,p_line_length-ptr);
520 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
521 if (ptr == p_line_length) pfc::throw_exception_with_message< exception_cue > (
"invalid PERFORMER syntax");
522 if (p_line[ptr] ==
'\"')
526 while(ptr < p_line_length && p_line[ptr] !=
'\"') ptr++;
527 if (ptr == p_line_length) pfc::throw_exception_with_message< exception_cue > (
"invalid PERFORMER syntax");
530 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
531 if (ptr != p_line_length) pfc::throw_exception_with_message< exception_cue > (
"invalid PERFORMER syntax");
532 p_callback.on_performer(p_line+base,length);
536 p_callback.on_performer(p_line+ptr,p_line_length-ptr);
541 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
542 if (ptr == p_line_length) pfc::throw_exception_with_message< exception_cue > (
"invalid SONGWRITER syntax");
543 if (p_line[ptr] ==
'\"')
547 while(ptr < p_line_length && p_line[ptr] !=
'\"') ptr++;
548 if (ptr == p_line_length) pfc::throw_exception_with_message< exception_cue > (
"invalid SONGWRITER syntax");
551 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
552 if (ptr != p_line_length) pfc::throw_exception_with_message< exception_cue > (
"invalid SONGWRITER syntax");
553 p_callback.on_songwriter(p_line+base,length);
557 p_callback.on_songwriter(p_line+ptr,p_line_length-ptr);
562 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
563 t_size length = p_line_length - ptr;
564 if (length == 0) pfc::throw_exception_with_message< exception_cue > (
"invalid ISRC syntax");
565 p_callback.on_isrc(p_line+ptr,length);
569 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
570 t_size length = p_line_length - ptr;
571 if (length == 0) pfc::throw_exception_with_message< exception_cue > (
"invalid CATALOG syntax");
572 p_callback.on_catalog(p_line+ptr,length);
576 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
577 if (ptr < p_line_length)
578 p_callback.on_flags(p_line + ptr, p_line_length - ptr);
582 while(ptr < p_line_length &&
is_spacing(p_line[ptr])) ptr++;
583 if (ptr < p_line_length)
584 p_callback.on_comment(p_line + ptr, p_line_length - ptr);
587 pfc::throw_exception_with_message< exception_cue > (
"POSTGAP is not supported");
591 else pfc::throw_exception_with_message< exception_cue > (
"unknown cuesheet item");
int SHARED_EXPORT stricmp_utf8_ex(const char *p1, t_size len1, const char *p2, t_size len2)
unsigned atoui_ex(const char *p_string, t_size p_string_len)
unsigned cuesheet_parse_index_time_ticks_e(const char *p_string, t_size p_length)
static bool is_numeric(char c)
static bool is_spacing(char c)