1. 30 Jan, 2019 1 commit
    • Mark Olesen's avatar
      ENH: minor adjustments to Switch · 40122a8f
      Mark Olesen authored
      - assignment operators return a value, for consistency with bool.
      
      - partial revert of DEFAULT_TRUE, DEFAULT_FALSE, to reduce complexity.
      40122a8f
  2. 29 Jan, 2019 1 commit
    • Mark Olesen's avatar
      ENH: add 'default' as possible Switch state, but not as input/output · fd348374
      Mark Olesen authored
      - in some circumstances we need to pass a bool value upwards to the
        caller and know if the true/false value was set based on real input
        or is a default value.
      
        Eg, in the object::read() we might normally have
      
           enabled_(dict.readIfPresent(key, true));
      
        but would lose information about why the value is true/false.
      
        We can change that by using
      
           enabled_(dict.readIfPresent<Switch>(key, Switch::DEFAULT_ON));
      
        After which we can use this information is testing.
      
            if
            (
                child.enabled().nonDefault()
              ? child.enabled()
              : parent.enabled()
            )
            { ... }
      
         And thus enable output if the parent requested it explicitly or by
         default and it has not been explicitly disabled in the child.
      
        No difference when testing as a bool and the text representation
        of DEFAULT_ON / DEFAULT_OFF will simply be "true" / "false".
      
      ENH: add construction of Switch from dictionary (similar to Enum)
      fd348374
  3. 01 Nov, 2018 1 commit
  4. 19 Oct, 2018 1 commit
    • Mark Olesen's avatar
      ENH: cleanup of Enum class · 9fd7e9fc
      Mark Olesen authored
      - more dictionary-like methods, enforce keyType::LITERAL for all
        lookups to avoid any spurious keyword matching.
      
      - new readEntry, readIfPresent methods
      
      - The get() method replaces the now deprecate lookup() method.
      
      - Deprecate lookupOrFailsafe()
        Failsafe behaviour is now an optional parameter for lookupOrDefault,
        which makes it easier to tailor behaviour at runtime.
      
      - output of the names is now always flatted without line-breaks.
        Thus,
      
           os << flatOutput(someEnumNames.names()) << nl;
           os << someEnumNames << nl;
      
        both generate the same output.
      
      - Constructor now uses C-string (const char*) directly instead of
        Foam::word in its initializer_list.
      
      - Remove special enum + initializer_list constructor form since
        it can create unbounded lookup indices.
      
      - Removd old hasEnum, hasName forms that were provided during initial
        transition from NamedEnum.
      
      - Added static_assert on Enum contents to restrict to enum or
        integral values.  Should not likely be using this class to enumerate
        other things since it internally uses an 'int' for its values.
      
        Changed volumeType accordingly to enumerate on its type (enum),
        not the class itself.
      9fd7e9fc
  5. 26 Mar, 2018 1 commit
    • Mark Olesen's avatar
      STYLE: consistent lookupOrDefault template parameters · bba7511c
      Mark Olesen authored
      - in many cases can just use lookupOrDefault("key", bool) instead of
        lookupOrDefault<bool> or lookupOrDefault<Switch> since reading a
        bool from an Istream uses the Switch(Istream&) anyhow
      
      STYLE: relocated Switch string names into file-local scope
      bba7511c
  6. 07 Mar, 2018 1 commit
  7. 11 Aug, 2017 1 commit
  8. 29 Feb, 2016 1 commit
  9. 08 Nov, 2015 1 commit
  10. 10 Dec, 2014 1 commit