Hugintrunk
0.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
hugin_base
hugin_utils
alphanum.h
Go to the documentation of this file.
1
/*
2
The Alphanum Algorithm is an improved sorting algorithm for strings
3
containing numbers. Instead of sorting numbers in ASCII order like a
4
standard sort, this algorithm sorts numbers in numeric order.
5
6
The Alphanum Algorithm is discussed at http://www.DaveKoelle.com
7
8
This implementation is Copyright (c) 2008 Dirk Jagdmann <doj@cubic.org>.
9
It is a cleanroom implementation of the algorithm and not derived by
10
other's works. In contrast to the versions written by Dave Koelle this
11
source code is distributed with the libpng/zlib license.
12
13
This software is provided 'as-is', without any express or implied
14
warranty. In no event will the authors be held liable for any damages
15
arising from the use of this software.
16
17
Permission is granted to anyone to use this software for any purpose,
18
including commercial applications, and to alter it and redistribute it
19
freely, subject to the following restrictions:
20
21
1. The origin of this software must not be misrepresented; you
22
must not claim that you wrote the original software. If you use
23
this software in a product, an acknowledgment in the product
24
documentation would be appreciated but is not required.
25
26
2. Altered source versions must be plainly marked as such, and
27
must not be misrepresented as being the original software.
28
29
3. This notice may not be removed or altered from any source
30
distribution. */
31
32
/* $Header: /code/doj/alphanum.hpp,v 1.3 2008/01/28 23:06:47 doj Exp $
33
34
slightly modified version, the main function is unaltered, but the
35
interface definitions are changed to better suit hugins needs
36
*/
37
38
#ifndef ALPHANUM__HPP
39
#define ALPHANUM__HPP
40
41
#include <
hugin_shared.h
>
42
#include <string>
43
44
// TODO: make comparison with hexadecimal numbers. Extend the alphanum_comp() function by traits to choose between decimal and hexadecimal.
45
46
namespace
doj
47
{
48
56
IMPEX
int
alphanum_comp
(
const
std::string& l,
const
std::string& r);
57
IMPEX
int
alphanum_comp
(
const
char
* l,
const
char
* r);
58
60
65
struct
IMPEX
alphanum_less
66
{
67
bool
operator()(
const
std::string& left,
const
std::string& right)
const
;
68
};
69
70
}
71
72
#endif
doj::alphanum_comp
int alphanum_comp(const std::string &l, const std::string &r)
Compare l and r with the same semantics as strcmp(), but with the "Alphanum Algorithm" which produces...
Definition:
alphanum.cpp:119
doj::alphanum_less
Functor class to compare two objects with the "Alphanum Algorithm".
Definition:
alphanum.h:65
hugin_shared.h
IMPEX
#define IMPEX
Definition:
hugin_shared.h:39
Generated on Sun Nov 17 2024 01:25:43 for Hugintrunk by
1.8.5