Browse Source

Revert commit 49359df and e5204ba to ensure that ValueWithDefault objects can be set to non-default empty strings

tags/2021-05-28
ed 6 years ago
parent
commit
3913269620
3 changed files with 4 additions and 24 deletions
  1. +2
    -10
      extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h
  2. +0
    -12
      modules/juce_data_structures/values/juce_ValueWithDefault.cpp
  3. +2
    -2
      modules/juce_data_structures/values/juce_ValueWithDefault.h

+ 2
- 10
extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h View File

@@ -49,7 +49,7 @@ protected:
props.add (new ChoicePropertyComponent (architectureTypeValue, "Architecture", props.add (new ChoicePropertyComponent (architectureTypeValue, "Architecture",
{ "<None>", "Native", "32-bit (-m32)", "64-bit (-m64)", "ARM v6", "ARM v7" }, { "<None>", "Native", "32-bit (-m32)", "64-bit (-m64)", "ARM v6", "ARM v7" },
{ "none" , "-march=native", "-m32", "-m64", "-march=armv6", "-march=armv7" }),
{ { String() }, "-march=native", "-m32", "-m64", "-march=armv6", "-march=armv7" }),
"Specifies the 32/64-bit architecture to use."); "Specifies the 32/64-bit architecture to use.");
} }
@@ -70,15 +70,7 @@ protected:
return "${JUCE_ARCH_LABEL}"; return "${JUCE_ARCH_LABEL}";
} }
String getArchitectureTypeString() const
{
auto archString = architectureTypeValue.get();
if (archString == "none")
return {};
return archString;
}
String getArchitectureTypeString() const { return architectureTypeValue.get(); }
//============================================================================== //==============================================================================
ValueWithDefault architectureTypeValue; ValueWithDefault architectureTypeValue;


+ 0
- 12
modules/juce_data_structures/values/juce_ValueWithDefault.cpp View File

@@ -52,17 +52,6 @@ public:
expectEquals (vwd.get().toString(), String ("default")); expectEquals (vwd.get().toString(), String ("default"));
} }
beginTest ("empty property");
{
ValueTree t ("root");
t.setProperty ("testKey", {}, nullptr);
ValueWithDefault vwd (t, "testKey", nullptr, "default");
expect (vwd.isUsingDefault());
expectEquals (vwd.get().toString(), String ("default"));
}
beginTest ("non-empty property"); beginTest ("non-empty property");
{ {
ValueTree t ("root"); ValueTree t ("root");
@@ -77,7 +66,6 @@ public:
beginTest ("set default"); beginTest ("set default");
{ {
ValueTree t ("root"); ValueTree t ("root");
t.setProperty ("testkey", {}, nullptr);
ValueWithDefault vwd (t, "testkey", nullptr); ValueWithDefault vwd (t, "testkey", nullptr);
vwd.setDefault ("default"); vwd.setDefault ("default");


+ 2
- 2
modules/juce_data_structures/values/juce_ValueWithDefault.h View File

@@ -121,10 +121,10 @@ public:
} }
} }
/** Returns true if the property does not exist or is empty. */
/** Returns true if the property does not exist in the referenced ValueTree. */
bool isUsingDefault() const bool isUsingDefault() const
{ {
return ! targetTree.hasProperty (targetProperty) || targetTree.getProperty (targetProperty).toString().isEmpty();
return ! targetTree.hasProperty (targetProperty);
} }
/** Removes the property from the referenced ValueTree. */ /** Removes the property from the referenced ValueTree. */


Loading…
Cancel
Save