mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-03 03:30:06 +00:00
Internal work on the ComponentBuilder system.
This commit is contained in:
parent
a511ea6b31
commit
15375dd223
45 changed files with 824 additions and 229 deletions
|
|
@ -460,15 +460,20 @@ namespace CodeHelpers
|
|||
|
||||
static int findBestHashMultiplier (const StringArray& strings)
|
||||
{
|
||||
StringArray allStrings;
|
||||
|
||||
for (int i = strings.size(); --i >= 0;)
|
||||
allStrings.addTokens (strings[i], "|", "");
|
||||
|
||||
int v = 31;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
SortedSet <int> hashes;
|
||||
bool collision = false;
|
||||
for (int i = strings.size(); --i >= 0;)
|
||||
for (int i = allStrings.size(); --i >= 0;)
|
||||
{
|
||||
const int hash = calculateHash (strings[i], v);
|
||||
const int hash = calculateHash (allStrings[i], v);
|
||||
if (hashes.contains (hash))
|
||||
{
|
||||
collision = true;
|
||||
|
|
@ -503,8 +508,20 @@ namespace CodeHelpers
|
|||
<< indent << "{" << newLine;
|
||||
|
||||
for (int i = 0; i < strings.size(); ++i)
|
||||
out << indent << " case 0x" << hexString8Digits (calculateHash (strings[i], hashMultiplier))
|
||||
<< ": " << codeToExecute[i] << newLine;
|
||||
{
|
||||
StringArray matchingStrings;
|
||||
matchingStrings.addTokens (strings[i], "|", "");
|
||||
|
||||
for (int j = 0; j < matchingStrings.size(); ++j)
|
||||
{
|
||||
out << indent << " case 0x" << hexString8Digits (calculateHash (matchingStrings[j], hashMultiplier)) << ":";
|
||||
|
||||
if (j < matchingStrings.size() - 1)
|
||||
out << newLine;
|
||||
}
|
||||
|
||||
out << " " << codeToExecute[i] << newLine;
|
||||
}
|
||||
|
||||
out << indent << " default: break;" << newLine
|
||||
<< indent << "}" << newLine << newLine;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue