diff options
author | Adrian Thurston <thurston@colm.net> | 2019-09-08 20:50:12 -0600 |
---|---|---|
committer | Adrian Thurston <thurston@colm.net> | 2019-09-08 20:50:12 -0600 |
commit | a90aad94da641125a47de44a3f7552df8d861bee (patch) | |
tree | 243b8259f0f1338af21b1666cf4fd9b7be5f81b7 /aapl/compare.h | |
parent | cf1179fca1bf8c3454730918f149c17c13f49cdc (diff) | |
download | colm-a90aad94da641125a47de44a3f7552df8d861bee.tar.gz |
merging aapl src dirs: added CmpStr and CmpString to colm/aapl
CmpStr is defined in colm/*.h so we need to also move it aside when we add it to aapl.
With this commit there are no more diffs between the aapl src dirs, with the
exception of a three files added to the aapl-repos package. Will use this as
the definitive version.
Diffstat (limited to 'aapl/compare.h')
-rw-r--r-- | aapl/compare.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/aapl/compare.h b/aapl/compare.h index 464e73e0..bbfa2136 100644 --- a/aapl/compare.h +++ b/aapl/compare.h @@ -24,6 +24,7 @@ #define _AAPL_COMPARE_H #include <string.h> +#include <string> #include "table.h" #ifdef AAPL_NAMESPACE @@ -51,6 +52,27 @@ namespace Aapl { */ /** + * \brief Compare two null terminated character sequences. + * + * This comparision class is a wrapper for strcmp. + */ +struct CmpStr +{ + /** + * \brief Compare two null terminated string types. + */ + static inline long compare(const char *k1, const char *k2) + { return strcmp(k1, k2); } +}; + +struct CmpString +{ + static inline long compare(const std::string &k1, const std::string &k2) + { return k1.compare( k2 ); } +}; + + +/** * \brief Compare a type for which < and > are implemented. * * CmpOrd is suitable for simple types such as integers and pointers that by |