MCPcopy Create free account
hub / github.com/KDE/labplot / readAnnotationElement

Method readAnnotationElement

src/3rdparty/liborigin/OriginAnyParser.cpp:575–669  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

573}
574
575bool OriginAnyParser::readAnnotationElement()
576{
577 LOG_PRINT(logfile, "readAnnotationElement()\n")
578 /* get general info and details of an Annotation
579 * return true if an Annotation is found, otherwise return false */
580 unsigned int ane_header_size = 0;
581 std::streamoff anh_start = 0;
582
583 // get annotation header size
584 ane_header_size = readObjectSize();
585 if (ane_header_size == 0)
586 return false;
587
588 curpos = file.tellg();
589 anh_start = curpos;
590 LOG_PRINT(logfile,
591 " Annotation found: header size %d [0x%X], starts at %" PRId64 " [0x%" PRIx64
592 "]: ",
593 ane_header_size, ane_header_size, curpos, curpos)
594 string ane_header = readObjectAsString(ane_header_size);
595
596 // get known info
597 string name(41, 0);
598 name = ane_header.substr(0x46, 41);
599 LOG_PRINT(logfile, "%s\n", name.c_str())
600
601 // go to end of annotation header
602 file.seekg(anh_start + ane_header_size + 1, ios_base::beg);
603
604 // data of an annotation element is divided in three blocks
605 // first block
606 unsigned int ane_data_1_size = 0;
607 std::streamoff andt1_start = 0;
608 ane_data_1_size = readObjectSize();
609
610 andt1_start = file.tellg();
611 LOG_PRINT(logfile, " block 1 size %d [0x%X] at %" PRId64 " [0x%" PRIx64 "]\n",
612 ane_data_1_size, ane_data_1_size, andt1_start, andt1_start)
613 string andt1_data = readObjectAsString(ane_data_1_size);
614
615 // TODO: get known info
616
617 // go to end of first data block
618 file.seekg(andt1_start + ane_data_1_size + 1, ios_base::beg);
619
620 // second block
621 unsigned int ane_data_2_size = 0;
622 std::streamoff andt2_start = 0;
623 ane_data_2_size = readObjectSize();
624 andt2_start = file.tellg();
625 LOG_PRINT(logfile, " block 2 size %d [0x%X] at %" PRId64 " [0x%" PRIx64 "]\n",
626 ane_data_2_size, ane_data_2_size, andt2_start, andt2_start)
627 string andt2_data;
628
629 // check for group of annotations
630 if (((ane_data_1_size == 0x5e) || (ane_data_1_size == 0x0A)) && (ane_data_2_size == 0x04)) {
631 curpos = file.tellg();
632 LOG_PRINT(logfile, " Annotation group found at %" PRId64 " [0x%" PRIx64 "] ...\n", curpos,

Callers

nothing calls this directly

Calls 2

tellgMethod · 0.45
seekgMethod · 0.45

Tested by

no test coverage detected