| 437 | } |
| 438 | |
| 439 | bool gsoner::check_struct_begin(void) |
| 440 | { |
| 441 | if(status_ != e_uninit) { |
| 442 | return false; |
| 443 | } |
| 444 | |
| 445 | std::string struct_laber = codes_.substr(pos_, strlen("struct")); |
| 446 | std::string class_laber = codes_.substr(pos_, strlen("class")); |
| 447 | |
| 448 | //struct user_t |
| 449 | if(struct_laber == "struct") { |
| 450 | pos_ += (int) strlen("struct"); |
| 451 | } else if(class_laber == "class") { |
| 452 | pos_ += (int) strlen("class"); |
| 453 | } else { |
| 454 | return false; |
| 455 | } |
| 456 | |
| 457 | status_ = e_struct_begin; |
| 458 | std::string obj_name = next_token(default_delimiters_+ ":;{"); |
| 459 | current_obj_.name_ = get_namespace()+obj_name; |
| 460 | |
| 461 | if (codes_[pos_] == '{') { |
| 462 | pos_++; |
| 463 | return true; |
| 464 | } |
| 465 | |
| 466 | if (codes_[pos_] == ';') { |
| 467 | pos_++; |
| 468 | //struct user_t ; end of struct; |
| 469 | status_ = e_uninit; |
| 470 | return true; |
| 471 | } |
| 472 | |
| 473 | if (codes_[pos_] != ':') { |
| 474 | return true; |
| 475 | } |
| 476 | |
| 477 | pos_++; |
| 478 | std::string token ; |
| 479 | std::string level; |
| 480 | |
| 481 | while ((token = next_token(" \\\r\n\t,")) != "{") { |
| 482 | if(codes_[pos_] == ',') { |
| 483 | pos_++; |
| 484 | } |
| 485 | |
| 486 | if (token == "public") { |
| 487 | level = "public"; |
| 488 | continue; |
| 489 | } |
| 490 | |
| 491 | if (token == "protect") { |
| 492 | level = "protect"; |
| 493 | continue; |
| 494 | } |
| 495 | |
| 496 | if (token == "private") { |