Mercurial > octave
annotate liboctave/system/mach-info.h @ 23756:26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
* mach-info.h (class oct_mach_info): Define class with individually
deprecated functions since namespace can't be used as a typedef.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 09 Jul 2017 10:42:55 -0400 |
parents | a732be902061 |
children | 1a08d0ac510f |
rev | line source |
---|---|
1960 | 1 /* |
2 | |
23219
3ac9f9ecfae5
maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents:
23083
diff
changeset
|
3 Copyright (C) 1996-2017 John W. Eaton |
1960 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
9 the Free Software Foundation; either version 3 of the License, or |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
10 (at your option) any later version. |
1960 | 11 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
15 GNU General Public License for more details. |
1960 | 16 |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
1960 | 20 |
21 */ | |
22 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
23 #if ! defined (octave_mach_info_h) |
2317 | 24 #define octave_mach_info_h 1 |
25 | |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
26 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
27 |
2317 | 28 #include <string> |
29 | |
21739
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
30 namespace octave |
2317 | 31 { |
23745
a732be902061
don't use singleton pattern for mach_info
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
32 namespace mach_info |
21739
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
33 { |
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
34 enum float_format |
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
35 { |
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
36 flt_fmt_unknown, |
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
37 flt_fmt_ieee_little_endian, |
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
38 flt_fmt_ieee_big_endian, |
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
39 }; |
2317 | 40 |
23745
a732be902061
don't use singleton pattern for mach_info
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
41 float_format native_float_format (void); |
2317 | 42 |
23745
a732be902061
don't use singleton pattern for mach_info
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
43 bool words_big_endian (void); |
2317 | 44 |
23745
a732be902061
don't use singleton pattern for mach_info
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
45 bool words_little_endian (void); |
2317 | 46 |
23745
a732be902061
don't use singleton pattern for mach_info
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
47 float_format string_to_float_format (const std::string&); |
13983
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
48 |
23745
a732be902061
don't use singleton pattern for mach_info
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
49 std::string float_format_as_string (float_format); |
a732be902061
don't use singleton pattern for mach_info
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
50 } |
21739
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
51 } |
2317 | 52 |
21739
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
53 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS) |
2317 | 54 |
23756
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
55 class oct_mach_info |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
56 { |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
57 public: |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
58 |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
59 typedef octave::mach_info::float_format float_format; |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
60 |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
61 OCTAVE_DEPRECATED (4.4, "use 'octave::mach_info::native_float_format' instead") |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
62 static float_format native_float_format (void) |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
63 { |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
64 return octave::mach_info::native_float_format (); |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
65 } |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
66 |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
67 OCTAVE_DEPRECATED (4.4, "use 'octave::mach_info::words_big_endian' instead") |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
68 static bool words_big_endian (void) |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
69 { |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
70 return octave::mach_info::words_big_endian (); |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
71 } |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
72 |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
73 OCTAVE_DEPRECATED (4.4, "use 'octave::mach_info::words_little_endian' instead") |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
74 static bool words_little_endian (void) |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
75 { |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
76 return octave::mach_info::words_little_endian (); |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
77 } |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
78 |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
79 OCTAVE_DEPRECATED (4.4, "use 'octave::mach_info::string_to_float_format' instead") |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
80 static float_format string_to_float_format (const std::string& str) |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
81 { |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
82 return octave::mach_info::string_to_float_format (str); |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
83 } |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
84 |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
85 OCTAVE_DEPRECATED (4.4, "use 'octave::mach_info::float_format_as_string' instead") |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
86 static std::string float_format_as_string (float_format ff) |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
87 { |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
88 return octave::mach_info::float_format_as_string (ff); |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
89 } |
26e19cf8e0d9
use class instead of typedef to preserve deprecated function names
John W. Eaton <jwe@octave.org>
parents:
23745
diff
changeset
|
90 }; |
1960 | 91 |
92 #endif | |
21739
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
93 |
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
94 #endif |