MCPcopy Create free account
hub / github.com/audacity/audacity / ParseChoice

Method ParseChoice

libraries/lib-nyquist-effects/NyquistBase.cpp:1757–1787  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1755}
1756
1757std::vector<EnumValueSymbol> NyquistBase::ParseChoice(const wxString& text)
1758{
1759 std::vector<EnumValueSymbol> results;
1760 if (text[0] == wxT('('))
1761 {
1762 // New style: expecting a Lisp-like list of strings
1763 Tokenizer tzer;
1764 tzer.Tokenize(text, true, 1, 1);
1765 auto& choices = tzer.tokens;
1766 wxString extra;
1767 for (auto& choice : choices)
1768 {
1769 auto label = UnQuote(choice, true, &extra);
1770 if (extra.empty())
1771 results.push_back(TranslatableString { label, {} });
1772 else
1773 results.push_back({ extra, TranslatableString { label, {} } });
1774 }
1775 }
1776 else
1777 {
1778 // Old style: expecting a comma-separated list of
1779 // un-internationalized names, ignoring leading and trailing spaces
1780 // on each; and the whole may be quoted
1781 auto choices = wxStringTokenize(
1782 text[0] == wxT('"') ? text.Mid(1, text.length() - 2) : text, wxT(","));
1783 for (auto& choice : choices)
1784 results.push_back({ choice.Trim(true).Trim(false) });
1785 }
1786 return results;
1787}
1788
1789FileExtensions NyquistBase::ParseFileExtensions(const wxString& text)
1790{

Callers

nothing calls this directly

Calls 5

TokenizeMethod · 0.80
emptyMethod · 0.45
push_backMethod · 0.45
lengthMethod · 0.45
TrimMethod · 0.45

Tested by

no test coverage detected