mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-11 23:54:18 +00:00
Projucer: Pulled out the module and PIP header parsing methods into a single method
This commit is contained in:
parent
5354c33fc3
commit
653d94c7a0
5 changed files with 74 additions and 124 deletions
|
|
@ -30,58 +30,9 @@
|
|||
#include "../Application/jucer_Application.h"
|
||||
|
||||
//==============================================================================
|
||||
static var parseModuleDesc (const StringArray& lines)
|
||||
{
|
||||
DynamicObject* o = new DynamicObject();
|
||||
var result (o);
|
||||
|
||||
for (auto line : lines)
|
||||
{
|
||||
line = trimCommentCharsFromStartOfLine (line);
|
||||
|
||||
auto colon = line.indexOfChar (':');
|
||||
|
||||
if (colon >= 0)
|
||||
{
|
||||
auto key = line.substring (0, colon).trim();
|
||||
auto value = line.substring (colon + 1).trim();
|
||||
|
||||
o->setProperty (key, value);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static var parseModuleDesc (const File& header)
|
||||
{
|
||||
StringArray lines;
|
||||
header.readLines (lines);
|
||||
|
||||
for (int i = 0; i < lines.size(); ++i)
|
||||
{
|
||||
if (trimCommentCharsFromStartOfLine (lines[i]).startsWith ("BEGIN_JUCE_MODULE_DECLARATION"))
|
||||
{
|
||||
StringArray desc;
|
||||
|
||||
for (int j = i + 1; j < lines.size(); ++j)
|
||||
{
|
||||
if (trimCommentCharsFromStartOfLine (lines[j]).startsWith ("END_JUCE_MODULE_DECLARATION"))
|
||||
return parseModuleDesc (desc);
|
||||
|
||||
desc.add (lines[j]);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
ModuleDescription::ModuleDescription (const File& folder)
|
||||
: moduleFolder (folder),
|
||||
moduleInfo (parseModuleDesc (getHeader()))
|
||||
moduleInfo (parseJUCEHeaderMetadata (getHeader()))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue