MCPcopy Create free account
hub / github.com/acl-dev/acl / check_comment

Method check_comment

lib_acl_cpp/src/serialize/gsoner.cpp:602–657  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

600}
601
602bool gsoner::check_comment(void)
603{
604 std::string commemt;
605 bool result = false;
606 if (codes_[pos_] == '/' && codes_[pos_ + 1] == '/') {
607 result = true;
608 pos_++;
609 pos_++;
610 //skip a line
611 while (codes_[pos_] != '\n') {
612 commemt.push_back(codes_[pos_]);
613 pos_++;
614 }
615 } else if (codes_[pos_] == '/' && codes_[pos_ + 1] == '*') {
616 result = true;
617 //skip /**/comment
618 pos_++;
619 pos_++;
620 while (codes_[pos_] != '*' || codes_[pos_ + 1] != '/') {
621 commemt.push_back(codes_[pos_]);
622 pos_++;
623 }
624 pos_++;
625 pos_++;
626 }
627
628 if (!result) {
629 return result;
630 }
631
632 if (commemt.find("Gson@optional") != std::string::npos) {
633 required_ = false;
634 }
635 if (commemt.find("Gson@required") != std::string::npos) {
636 required_ = true;
637 }
638 if (commemt.find("Gson@skip") != std::string::npos) {
639 skip_ = true;
640 }
641 if (commemt.find("Gson@rename:") != std::string::npos) {
642 std::size_t pos = commemt.find("Gson@rename:") + strlen("Gson@rename:");
643 std::size_t n = 0;
644 if (commemt[commemt.size() - 1] == '\n') {
645 n++;
646 }
647 if (commemt[commemt.size() - 2] == '\r') {
648 n++;
649 }
650 newname_ = commemt.substr( pos ,commemt.size() - pos - n);
651 if (newname_.empty()) {
652 std::cout << "Gson@rename:{} error, new name empty" << std::endl;
653 throw syntax_error();
654 }
655 }
656 return result;
657}
658
659std::string gsoner::get_static_string(const std::string &str, int &index)

Callers

nothing calls this directly

Calls 6

syntax_errorClass · 0.85
substrMethod · 0.80
push_backMethod · 0.45
findMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected