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.
  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.
              ? 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)
  3. 11 Nov, 2018 1 commit
  4. 04 Nov, 2018 1 commit
  5. 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.
           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.
  6. 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
  7. 07 Mar, 2018 1 commit
  8. 11 Aug, 2017 1 commit
  9. 18 May, 2017 1 commit
    • Mark Olesen's avatar
      ENH: added constant predicates · f93bacd5
      Mark Olesen authored
      - predicates::always and predicates::never returning true and false,
        respectively. These simple classes make it easier when writing
        templated code.
        As well as unary and binary predicate forms, they also contain a
        match(std::string) method for compatibility with regex-based classes.
      STYLE: write bool and direction as primitive 'int' not as 'label'.
  10. 12 Aug, 2016 1 commit
  11. 17 Jan, 2016 1 commit
  12. 10 Dec, 2014 1 commit