////////////////////////////////////////////////////////////////////////// CreatePropVector -- given the string representation of the attribute vector, create an FCOPropVector //////////////////////////////////////////////////////////////////////////
| 666 | // create an FCOPropVector |
| 667 | /////////////////////////////////////////////////////////////////////////////// |
| 668 | void cParserUtil::CreatePropVector(const TSTRING& strPropListC, class cFCOPropVector& v, iParserGenreUtil* pHelper) |
| 669 | { |
| 670 | ASSERT(pHelper != NULL); |
| 671 | |
| 672 | // state: turning modes on or off |
| 673 | enum Mode |
| 674 | { |
| 675 | MO_TURNON, |
| 676 | MO_TURNOFF |
| 677 | }; |
| 678 | Mode mode = MO_TURNON; |
| 679 | |
| 680 | // clear out all spaces in the string |
| 681 | TSTRING strPropList = strPropListC; |
| 682 | strPropList.erase(std::remove_if(strPropList.begin(), strPropList.end(), std::ptr_fun<int, int>(std::isspace)), |
| 683 | strPropList.end()); |
| 684 | |
| 685 | // zero it out |
| 686 | v.Clear(); |
| 687 | |
| 688 | TSTRING::const_iterator iter; |
| 689 | TSTRING::size_type i; // index into string |
| 690 | for (iter = strPropList.begin(), i = 0; iter != strPropList.end(); ++iter, ++i) |
| 691 | { |
| 692 | int propIndex = -1; // index into propvector |
| 693 | |
| 694 | switch (*iter) |
| 695 | { |
| 696 | ///////////////////////////////////////////////////////////// |
| 697 | // parsing modes |
| 698 | case '+': |
| 699 | mode = MO_TURNON; |
| 700 | continue; |
| 701 | case '-': |
| 702 | mode = MO_TURNOFF; |
| 703 | continue; |
| 704 | ///////////////////////////////////////////////////////////// |
| 705 | |
| 706 | ///////////////////////////////////////////////////////////// |
| 707 | // long attribute names |
| 708 | case '&': |
| 709 | { |
| 710 | // |
| 711 | // collect string |
| 712 | // |
| 713 | |
| 714 | // find next '&', '+', or '-' |
| 715 | TSTRING::size_type next = util_FindNextDelim(strPropList, i + 1); |
| 716 | |
| 717 | // get attribute name |
| 718 | TSTRING strProp; |
| 719 | if (next == TSTRING::npos) |
| 720 | strProp = strPropList.substr(i + 1); |
| 721 | else |
| 722 | strProp = strPropList.substr(i + 1, next - i - 1); |
| 723 | |
| 724 | // increment past string |
| 725 | iter += strProp.length(); |
nothing calls this directly
no test coverage detected