Point Cloud Library (PCL)
1.9.1
surface
include
pcl
surface
3rdparty
opennurbs
opennurbs_base32.h
1
/* $NoKeywords: $ */
2
/*
3
//
4
// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
5
// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
6
// McNeel & Associates.
7
//
8
// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
9
// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
10
// MERCHANTABILITY ARE HEREBY DISCLAIMED.
11
//
12
// For complete openNURBS copyright information see <http://www.opennurbs.org>.
13
//
14
////////////////////////////////////////////////////////////////
15
*/
16
17
#if !defined(ON_BASE32_INC_)
18
#define ON_BASE32_INC_
19
20
21
/*
22
Description:
23
Convert a number into base32 digits.
24
Parameters:
25
x - [in]
26
x_count - [in]
27
x[] is an array of length x_count and represents the value
28
x[0]*2^(8*(x_count-1)) + ... + x[x_count-2]*256 + x[x_count-1].
29
base32_digits - [out]
30
When base32_digits is not a dynamic array, base32_digits[]
31
must a be an array of length at least
32
((8*x_count)/5) + (((8*x_count)%5)?1:0) or 1,
33
whichever is greater.
34
35
The base32_digits[] array will be filled in with base32 digit
36
values (0 to 31) so that the value
37
b[0]*32^(b_count-1) + ... + b[b_count-2]*32 + b[b_count-1]
38
is the same as that defined by the x[] array.
39
Returns
40
The number of base 32 digits in the base32_digits[] array.
41
If 0 is returned, the input is not valid.
42
*/
43
ON_DECL
44
int
ON_GetBase32Digits(
const
ON_SimpleArray<unsigned char>
& x,
ON_SimpleArray<unsigned char>
& base32_digits );
45
ON_DECL
46
int
ON_GetBase32Digits(
const
unsigned
char
* x,
int
x_count,
unsigned
char
* base32_digits );
47
48
49
/*
50
Description:
51
Convert a list of base32 digits into a string form.
52
Parameters:
53
base32_digits - [in]
54
base32_digit_count - [in]
55
base32_digits[] is an array of length base32_digit_count.
56
Each element is in the range 0 to 31.
57
sBase32 - [out]
58
sBase32[] must be an array of length base32_digit_count+1 or 2,
59
whichever is greater. The string representation of the base 32
60
number will be put in this string. A hash mark symbol (#) is
61
used to indicate an error in the input value. The returned
62
string is null terminated.
63
Returns
64
True if the input is valid. False if the input is not valid,
65
in which case hash marks indicate the invalid entries.
66
*/
67
ON_DECL
68
bool
ON_Base32ToString(
const
ON_SimpleArray<unsigned char>
& base32_digits,
ON_String
& sBase32 );
69
ON_DECL
70
bool
ON_Base32ToString(
const
ON_SimpleArray<unsigned char>
& base32_digits,
ON_wString
& sBase32 );
71
ON_DECL
72
bool
ON_Base32ToString(
const
unsigned
char
* base32_digits,
int
base32_digit_count,
char
* sBase32 );
73
74
75
/*
76
Description:
77
Fixt a common typos in sBase32 string. Lower case letters are
78
converted to upper case. The letters 'I', 'L', 'O' and 'S' are
79
converted to '1' (one), '1' (one) '0' zero and '5' (five).
80
Parameters:
81
sBase32 - [in]
82
sBase32clean - [out]
83
(can be the same string as sBase32)
84
Returns:
85
If the input is valid, the length of the converted string is returned.
86
If the input is not valid, 0 is returned.
87
*/
88
ON_DECL
89
int
ON_CorrectBase32StringTypos(
const
wchar_t
* sBase32,
ON_wString
& sBase32clean );
90
ON_DECL
91
int
ON_CorrectBase32StringTypos(
const
char
* sBase32,
ON_String
& sBase32clean );
92
ON_DECL
93
int
ON_CorrectBase32StringTypos(
const
char
* sBase32,
char
* sBase32clean );
94
95
96
/*
97
Description:
98
Convert a null terminate string containing the 32 symbols
99
100
0 1 2 3 4 5 6 7 8 9 A B C D E F G H J K M N P Q R T U V W X Y Z
101
102
(I,L,O and S are missing) into a list of base 32 digits.
103
Parameters:
104
sBase32 - [in]
105
String with base 32 digits
106
base32_digits - [out]
107
base32_digits[] is an array of length strlen(sBase32).
108
The returned array, element will be in the range 0 to 31.
109
sBase32[] must be an array of length base32_digit_count+1 or 2,
110
whichever is greater. The string representation of the base 32
111
number will be put in this string. A hash mark symbol (#) is
112
used to indicate an error in the input value. The returned
113
string is null terminated.
114
Returns
115
True if the input is valid. False if the input is not valid,
116
in which case hash marks indicate the invalid entries.
117
*/
118
ON_DECL
119
int
ON_StringToBase32(
const
ON_wString
& sBase32,
ON_SimpleArray<unsigned char>
& base32_digits );
120
ON_DECL
121
int
ON_StringToBase32(
const
ON_String
& sBase32,
ON_SimpleArray<unsigned char>
& base32_digits );
122
ON_DECL
123
int
ON_StringToBase32(
const
char
* sBase32,
unsigned
char
* base32_digits );
124
125
126
#endif
ON_SimpleArray
Definition:
opennurbs_array.h:46
ON_wString
Definition:
opennurbs_string.h:700
ON_String
Definition:
opennurbs_string.h:405