core
lib
Geomatics
format.hpp
Go to the documentation of this file.
1
//==============================================================================
2
//
3
// This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4
//
5
// The GNSSTk is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU Lesser General Public License as published
7
// by the Free Software Foundation; either version 3.0 of the License, or
8
// any later version.
9
//
10
// The GNSSTk is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU Lesser General Public License for more details.
14
//
15
// You should have received a copy of the GNU Lesser General Public
16
// License along with GNSSTk; if not, write to the Free Software Foundation,
17
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18
//
19
// This software was developed by Applied Research Laboratories at the
20
// University of Texas at Austin.
21
// Copyright 2004-2022, The Board of Regents of The University of Texas System
22
//
23
//==============================================================================
24
25
//==============================================================================
26
//
27
// This software was developed by Applied Research Laboratories at the
28
// University of Texas at Austin, under contract to an agency or agencies
29
// within the U.S. Department of Defense. The U.S. Government retains all
30
// rights to use, duplicate, distribute, disclose, or release this software.
31
//
32
// Pursuant to DoD Directive 523024
33
//
34
// DISTRIBUTION STATEMENT A: This software has been approved for public
35
// release, distribution is unlimited.
36
//
37
//==============================================================================
38
40
41
#ifndef CLASS_FORMAT_HELPER_INCLUDE
42
#define CLASS_FORMAT_HELPER_INCLUDE
43
44
#include <ostream>
45
46
namespace
gnsstk
47
{
51
class
format
52
{
53
int
form
;
54
int
wide
;
55
int
prec
;
56
57
public
:
59
explicit
format
(
int
w
,
int
p
,
int
f = 1) :
form
(f),
wide
(
w
),
prec
(
p
) {}
60
62
format
&
scientific
()
63
{
64
form
= 2;
65
return
*
this
;
66
}
67
69
format
&
sci
()
70
{
71
form
= 2;
72
return
*
this
;
73
}
74
76
format
&
fixed
()
77
{
78
form
= 1;
79
return
*
this
;
80
}
81
83
format
&
fix
()
84
{
85
form
= 1;
86
return
*
this
;
87
}
88
90
format
&
general
()
91
{
92
form
= 0;
93
return
*
this
;
94
}
95
97
format
&
gen
()
98
{
99
form
= 0;
100
return
*
this
;
101
}
102
104
format
&
width
(
int
w
)
105
{
106
wide
=
w
;
107
return
*
this
;
108
}
109
111
format
&
w
(
int
w
)
112
{
113
wide
=
w
;
114
return
*
this
;
115
}
116
118
format
&
precision
(
int
p
)
119
{
120
prec
=
p
;
121
return
*
this
;
122
}
123
125
format
&
p
(
int
p
)
126
{
127
prec
=
p
;
128
return
*
this
;
129
}
130
132
format
&
wp
(
int
w
,
int
p
)
133
{
134
prec
=
p
;
135
wide
=
w
;
136
return
*
this
;
137
}
138
140
friend
std::ostream&
operator<<
(std::ostream& os,
const
format
& f);
141
142
};
// end class format
143
144
//---------------------------------------------------------------------------------
145
}
// namespace gnsstk
146
#endif
gnsstk::format::sci
format & sci()
Set format to scientific.
Definition:
format.hpp:69
gnsstk::format::general
format & general()
Set format to general.
Definition:
format.hpp:90
gnsstk::format::width
format & width(int w)
Set width to w characters.
Definition:
format.hpp:104
gnsstk::format::form
int form
Definition:
format.hpp:53
gnsstk::format::prec
int prec
precision in char
Definition:
format.hpp:55
gnsstk::format::fixed
format & fixed()
Set format to fixed.
Definition:
format.hpp:76
gnsstk::format::precision
format & precision(int p)
Set precision to p digits.
Definition:
format.hpp:118
gnsstk::format::gen
format & gen()
Set format to general.
Definition:
format.hpp:97
gnsstk
For Sinex::InputHistory.
Definition:
BasicFramework.cpp:50
gnsstk::format::p
format & p(int p)
Set precision to p digits.
Definition:
format.hpp:125
gnsstk::format::fix
format & fix()
Set format to fixed.
Definition:
format.hpp:83
gnsstk::format::w
format & w(int w)
Set width to w characters.
Definition:
format.hpp:111
gnsstk::format::wp
format & wp(int w, int p)
Set both width and precision.
Definition:
format.hpp:132
gnsstk::format::wide
int wide
0=general,1=float,2=scientific, default is 1
Definition:
format.hpp:54
gnsstk::format
Definition:
format.hpp:51
gnsstk::format::operator<<
friend std::ostream & operator<<(std::ostream &os, const format &f)
ostream operator for format
gnsstk::format::format
format(int w, int p, int f=1)
Constructor.
Definition:
format.hpp:59
gnsstk::format::scientific
format & scientific()
Set format to scientific.
Definition:
format.hpp:62
gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:39