Loading...
Searching...
No Matches
natural_sort Struct Reference

Encapsulation of natural order sorting for algorithms. More...

#include <stringOpsSort.H>

Classes

struct  reverse
 Reverse natural sorting. More...
struct  list_less
 A UList compare binary predicate for natural sort. More...
struct  list_greater
 A Ulist compare binary predicate for reverse natural sort. More...

Public Member Functions

bool operator() (const std::string &s1, const std::string &s2) const
 Default (forward) natural sorting.

Static Public Member Functions

static int compare (const std::string &s1, const std::string &s2)
 Natural compare for std::string.
static bool less (const std::string &s1, const std::string &s2)
 Natural compare two strings for a less-than relationship.
static bool greater (const std::string &s1, const std::string &s2)
 Natural compare two strings for a greater-than relationship.

Detailed Description

Encapsulation of natural order sorting for algorithms.

Definition at line 63 of file stringOpsSort.H.

Member Function Documentation

◆ compare()

int compare ( const std::string & s1,
const std::string & s2 )
inlinestatic

Natural compare for std::string.

Returns
-1 when s1 < s2, 0 when s1 == s2, 1 when s1 > s2

Definition at line 70 of file stringOpsSort.H.

References Foam::stringOps::natstrcmp().

Referenced by greater(), less(), natural_sort::list_greater< T >::operator()(), natural_sort::list_less< T >::operator()(), operator()(), and natural_sort::reverse::operator()().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ less()

bool less ( const std::string & s1,
const std::string & s2 )
inlinestatic

Natural compare two strings for a less-than relationship.

Definition at line 82 of file stringOpsSort.H.

References compare().

Here is the call graph for this function:

◆ greater()

bool greater ( const std::string & s1,
const std::string & s2 )
inlinestatic

Natural compare two strings for a greater-than relationship.

Definition at line 94 of file stringOpsSort.H.

References compare().

Here is the call graph for this function:

◆ operator()()

bool operator() ( const std::string & s1,
const std::string & s2 ) const
inline

Default (forward) natural sorting.

Definition at line 106 of file stringOpsSort.H.

References compare().

Here is the call graph for this function:

The documentation for this struct was generated from the following file: