Commit Graph

7 Commits

Author SHA1 Message Date
Mark Olesen
883196981d ENH: add offset support to stringOps::split functions
- for example,

     string buffer = ...;
     SubStrings<string> split;
     {
         auto colon = buffer.find(':');

         if (colon != std::string::npos)
         {
             split = stringOps::splitSpace(buffer, colon+1);
         }
     }

    Not really possible with a substr() since that would create a new
    temporary which then disappears.  Similarly awkward to split and
    then scan for the ':' to decide how many to discard.

ENH: add pop_front() and pop_back() methods to SubStrings

- the content is trivial enough (a pair of iterators) and the total
  number of elements is usually reasonable short so that removal of
  elements is inexpensive

  For example,

     string buffer = ...;
     auto split = stringOps::splitSpace(buffer);

     if (!split.empty() && split[0].str() == "face")
     {
         split.pop_front();
     }
2024-05-02 17:53:53 +02:00
Mark Olesen
4f43f0302d ENH: additional Map/HashTable constructors and ListOp functions
- construct Map/HashTable from key/value lists.

- invertToMap() : like invert() but returns a Map<label>,
  which is useful for sparse numbering

- inplaceRenumber() : taking a Map<label> for the mapper

ENH: construct/reset CStringList for list of C-strings
2024-02-23 18:10:48 +01:00
Mark Olesen
7c60c80edd ENH: new/revised emplace_back() [for DynamicList/List/PtrDynList/PtrList]
- returns reference as per C++17 std::vector

STYLE: drop unused, redundant DynamicField remove() method
2023-01-27 09:50:45 +01:00
OpenFOAM bot
e9219558d7 GIT: Header file updates 2019-10-31 14:48:44 +00:00
Mark Olesen
e9323ecbbb STYLE: use finiteVolume in Make/options placeholder 2019-02-24 17:32:13 +01:00
Mark Olesen
a881204946 ENH: stringOps inplace methods now use a std::string parameter
- this makes them applicable to Foam::string, Foam::word etc

ENH: improvements to CStringList

- add strings() sublist variant which can be useful when handling
  command arguments separately

- add construct from SubStrings.
2017-11-22 08:03:52 +01:00
Mark Olesen
42b2086683 ENH: adapter for a list of C++ strings <-> a list of C-style strings
- Translate a list of C++ strings into C-style (argc, argv) pair.
- Translate C-style (argc, argv) pair to list of C++ strings.

Useful when interfacing to external C-code and some libraries
2016-06-16 08:22:53 +02:00