Browse Source

Projucer: Added an option to CodeHelpers::makeValidIdentifier() to allow asterisks so that pointer types are not ignored when automatically generating header files in the GUI editor

tags/2021-05-28
ed 8 years ago
parent
commit
693fde9f21
3 changed files with 7 additions and 3 deletions
  1. +1
    -1
      extras/Projucer/Source/ComponentEditor/jucer_JucerDocument.cpp
  2. +4
    -1
      extras/Projucer/Source/Utility/jucer_CodeHelpers.cpp
  3. +2
    -1
      extras/Projucer/Source/Utility/jucer_CodeHelpers.h

+ 1
- 1
extras/Projucer/Source/ComponentEditor/jucer_JucerDocument.cpp View File

@@ -171,7 +171,7 @@ void JucerDocument::setParentClasses (const String& classes)
type = s = String();
}
s = type + CodeHelpers::makeValidIdentifier (s.trim(), false, false, true);
s = type + CodeHelpers::makeValidIdentifier (s.trim(), false, false, true, true);
parentClassLines.set (i, s);
}


+ 4
- 1
extras/Projucer/Source/Utility/jucer_CodeHelpers.cpp View File

@@ -69,7 +69,7 @@ namespace CodeHelpers
return lines.joinIntoString (newLine);
}
String makeValidIdentifier (String s, bool capitalise, bool removeColons, bool allowTemplates)
String makeValidIdentifier (String s, bool capitalise, bool removeColons, bool allowTemplates, bool allowAsterisks)
{
if (s.isEmpty())
return "unknown";
@@ -93,6 +93,9 @@ namespace CodeHelpers
if (! removeColons)
allowedChars += ":";
if (allowAsterisks)
allowedChars += "*";
StringArray words;
words.addTokens (s.retainCharacters (allowedChars), false);
words.trim();


+ 2
- 1
extras/Projucer/Source/Utility/jucer_CodeHelpers.h View File

@@ -32,7 +32,8 @@ namespace CodeHelpers
{
String indent (const String& code, int numSpaces, bool indentFirstLine);
String unindent (const String& code, int numSpaces);
String makeValidIdentifier (String s, bool capitalise, bool removeColons, bool allowTemplates);
String makeValidIdentifier (String s, bool capitalise, bool removeColons,
bool allowTemplates, bool allowAsterisks = false);
String createIncludeStatement (const File& includedFile, const File& targetFile);
String createIncludeStatement (const String& includePath);
String makeHeaderGuardName (const File& file);


Loading…
Cancel
Save