MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / SplitParameters

Function SplitParameters

Sources/Shared/IO/WebRequest.cpp:474–549  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

472 namespace
473 {
474 String SplitParameters(StringView s, WebRequestHeaderMap& parameters)
475 {
476 SmallVector<char, 64> value;
477 auto it = s.begin();
478 auto end = s.end();
479 while (it != end && *it == ' ') {
480 ++it;
481 }
482 while (it != end && *it != ';') {
483 value.push_back(*it++);
484 }
485 StringView valueView = value;
486 valueView = valueView.trimmed();
487 if (it != end) {
488 ++it;
489 }
490 parameters.clear();
491 SmallVector<char, 32> pname;
492 SmallVector<char, 64> pvalue;
493 while (it != end) {
494 pname.clear();
495 pvalue.clear();
496 while (it != end && *it == ' ') {
497 ++it;
498 }
499 while (it != end && *it != '=' && *it != ';') {
500 pname.push_back(*it++);
501 }
502 StringView pnameView = pname;
503 pnameView = pnameView.trimmed();
504
505 if (it != end && *it != ';') {
506 ++it;
507 }
508 while (it != end && *it == ' ') {
509 ++it;
510 }
511 while (it != end && *it != ';') {
512 if (*it == '"') {
513 ++it;
514 while (it != end && *it != '"') {
515 if (*it == '\\') {
516 ++it;
517 if (it != end) {
518 pvalue.push_back(*it++);
519 }
520 } else {
521 pvalue.push_back(*it++);
522 }
523 }
524 if (it != end) {
525 ++it;
526 }
527 } else if (*it == '\\') {
528 ++it;
529 if (it != end) {
530 pvalue.push_back(*it++);
531 }

Callers 1

GetSuggestedFileNameMethod · 0.85

Calls 6

beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45
trimmedMethod · 0.45
clearMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected