| 470 | } |
| 471 | |
| 472 | void ProjectSerializer::WriteName(const wxString & name) |
| 473 | { |
| 474 | wxASSERT(name.length() * sizeof(wxStringCharType) <= SHRT_MAX); |
| 475 | UShort id; |
| 476 | |
| 477 | auto nameiter = mNames.find(name); |
| 478 | if (nameiter != mNames.end()) |
| 479 | { |
| 480 | id = nameiter->second; |
| 481 | } |
| 482 | else |
| 483 | { |
| 484 | // mNames is static. This appends each name to static mDict only once |
| 485 | // in each run. |
| 486 | UShort len = name.length() * sizeof(wxStringCharType); |
| 487 | |
| 488 | id = mNames.size(); |
| 489 | mNames[name] = id; |
| 490 | |
| 491 | mDict.AppendByte(FT_Name); |
| 492 | WriteUShort( mDict, id ); |
| 493 | WriteUShort( mDict, len ); |
| 494 | mDict.AppendData(name.wx_str(), len); |
| 495 | |
| 496 | mDictChanged = true; |
| 497 | } |
| 498 | |
| 499 | WriteUShort( mBuffer, id ); |
| 500 | } |
| 501 | |
| 502 | const MemoryStream &ProjectSerializer::GetDict() const |
| 503 | { |
nothing calls this directly
no test coverage detected