Thrill  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
strings.hpp
Go to the documentation of this file.
1 /*******************************************************************************
2  * tlx/sort/strings.hpp
3  *
4  * Front-end for string sorting algorithms.
5  *
6  * Part of tlx - http://panthema.net/tlx
7  *
8  * Copyright (C) 2018 Timo Bingmann <[email protected]>
9  *
10  * All rights reserved. Published under the Boost Software License, Version 1.0
11  ******************************************************************************/
12 
13 #ifndef TLX_SORT_STRINGS_HEADER
14 #define TLX_SORT_STRINGS_HEADER
15 
16 #include <cstdint>
17 #include <string>
18 #include <vector>
19 
20 namespace tlx {
21 
22 //! \addtogroup tlx_sort
23 //! \{
24 //! \name String Sorting Algorithms
25 //! \{
26 
27 /*!
28  * Sort a set of strings represented by C-style char* in place.
29  *
30  * The strings are sorted as _unsigned_ 8-bit characters, not signed characters!
31  * If the memory limit is non zero, possibly slower algorithms will be selected
32  * to stay within the memory limit.
33  */
34 void sort_strings(char** strings, size_t size, size_t memory = 0);
35 
36 /*!
37  * Sort a set of strings represented by C-style uint8_t* in place.
38  *
39  * If the memory limit is non zero, possibly slower algorithms will be selected
40  * to stay within the memory limit.
41  */
42 void sort_strings(unsigned char** strings, size_t size, size_t memory = 0);
43 
44 /*!
45  * Sort a set of strings represented by C-style char* in place.
46  *
47  * The strings are sorted as _unsigned_ 8-bit characters, not signed characters!
48  * If the memory limit is non zero, possibly slower algorithms will be selected
49  * to stay within the memory limit.
50  */
51 void sort_strings(const char** strings, size_t size, size_t memory = 0);
52 
53 /*!
54  * Sort a set of strings represented by C-style uint8_t* in place.
55  *
56  * If the memory limit is non zero, possibly slower algorithms will be selected
57  * to stay within the memory limit.
58  */
59 void sort_strings(
60  const unsigned char** strings, size_t size, size_t memory = 0);
61 
62 /******************************************************************************/
63 
64 /*!
65  * Sort a set of strings represented by C-style char* in place.
66  *
67  * The strings are sorted as _unsigned_ 8-bit characters, not signed characters!
68  * If the memory limit is non zero, possibly slower algorithms will be selected
69  * to stay within the memory limit.
70  */
71 void sort_strings(std::vector<char*>& strings, size_t memory = 0);
72 
73 /*!
74  * Sort a set of strings represented by C-style uint8_t* in place.
75  *
76  * If the memory limit is non zero, possibly slower algorithms will be selected
77  * to stay within the memory limit.
78  */
79 void sort_strings(std::vector<unsigned char>& strings, size_t memory = 0);
80 
81 /*!
82  * Sort a set of strings represented by C-style char* in place.
83  *
84  * The strings are sorted as _unsigned_ 8-bit characters, not signed characters!
85  * If the memory limit is non zero, possibly slower algorithms will be selected
86  * to stay within the memory limit.
87  */
88 void sort_strings(std::vector<const char*>& strings, size_t memory = 0);
89 
90 /*!
91  * Sort a set of strings represented by C-style uint8_t* in place.
92  *
93  * If the memory limit is non zero, possibly slower algorithms will be selected
94  * to stay within the memory limit.
95  */
96 void sort_strings(
97  std::vector<const unsigned char*>& strings, size_t memory = 0);
98 
99 /******************************************************************************/
100 
101 /*!
102  * Sort a set of std::strings in place.
103  *
104  * The strings are sorted as _unsigned_ 8-bit characters, not signed characters!
105  * If the memory limit is non zero, possibly slower algorithms will be selected
106  * to stay within the memory limit.
107  */
108 void sort_strings(std::string* strings, size_t size, size_t memory = 0);
109 
110 /*!
111  * Sort a vector of std::strings in place.
112  *
113  * The strings are sorted as _unsigned_ 8-bit characters, not signed characters!
114  * If the memory limit is non zero, possibly slower algorithms will be selected
115  * to stay within the memory limit.
116  */
117 void sort_strings(std::vector<std::string>& strings, size_t memory = 0);
118 
119 //! \}
120 //! \}
121 
122 } // namespace tlx
123 
124 #endif // !TLX_SORT_STRINGS_HEADER
125 
126 /******************************************************************************/
void sort_strings(char **strings, size_t size, size_t memory=0)
Sort a set of strings represented by C-style char* in place.
Definition: strings1.cpp:20
std::basic_string< char, std::char_traits< char >, Allocator< char > > string
string with Manager tracking
Definition: allocator.hpp:220