natural_sort Struct Reference

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

Classes

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

Public Member Functions

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

Static Public Member Functions

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

Detailed Description

Encapsulation of natural order sorting for algorithms.

Definition at line 63 of file stringOpsSort.H.

Member Function Documentation

◆ compare()

static 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 71 of file stringOpsSort.H.

References Foam::stringOps::natstrcmp().

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

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

◆ less()

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

Natural compare two strings for a less-than relationship.

Definition at line 83 of file stringOpsSort.H.

References natural_sort::compare().

Here is the call graph for this function:

◆ greater()

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

Natural compare two strings for a greater-than relationship.

Definition at line 95 of file stringOpsSort.H.

References natural_sort::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 natural_sort::compare().

Here is the call graph for this function:

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