• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

polserver / polserver / 21100551564

17 Jan 2026 08:40PM UTC coverage: 60.504% (+0.01%) from 60.492%
21100551564

Pull #857

github

turleypol
fixed scope
Pull Request #857: ClangTidy readability-else-after-return

837 of 1874 new or added lines in 151 files covered. (44.66%)

48 existing lines in 26 files now uncovered.

44445 of 73458 relevant lines covered (60.5%)

515341.61 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.1
/pol-core/bscript/blong.cpp
1
/** @file
2
 *
3
 * @par History
4
 */
5

6

7
#include <sstream>
8
#include <string>
9

10
#include "../clib/stlutil.h"
11
#include "berror.h"
12
#include "bobject.h"
13
#include "impstr.h"
14

15

16
namespace Pol::Bscript
17
{
18
#if BOBJECTIMP_DEBUG
19
BLong::BLong( int lval ) : BObjectImp( OTLong ), lval_( static_cast<int>( lval ) ) {}
20

21
BLong::BLong( const BLong& L ) : BObjectImp( OTLong ), lval_( L.lval_ ) {}
22
#endif
23

24

25
std::string BLong::pack() const
78✔
26
{
27
  OSTRINGSTREAM os;
78✔
28
  os << "i" << lval_;
78✔
29
  return OSTRINGSTREAM_STR( os );
156✔
30
}
78✔
31

32
std::string BLong::pack( int val )
×
33
{
34
  OSTRINGSTREAM os;
×
35
  os << "i" << val;
×
36
  return OSTRINGSTREAM_STR( os );
×
37
}
×
38

39

40
void BLong::packonto( std::ostream& os ) const
135✔
41
{
42
  os << "i" << lval_;
135✔
43
}
135✔
44

45
BObjectImp* BLong::unpack( std::istream& is )
358✔
46
{
47
  int lv;
48
  if ( is >> lv )
358✔
49
  {
50
    return new BLong( lv );
358✔
51
  }
52

NEW
53
  return new BError( "Error extracting Integer value" );
×
54
}
55

56
BObjectImp* BLong::copy() const
17,211✔
57
{
58
  return new BLong( *this );
17,211✔
59
}
60

61
size_t BLong::sizeEstimate() const
1,670✔
62
{
63
  return sizeof( BLong );
1,670✔
64
}
65

66
bool BLong::isTrue() const
85,150✔
67
{
68
  return ( lval_ != 0 );
85,150✔
69
}
70

71
bool BLong::operator==( const BObjectImp& objimp ) const
14,571✔
72
{
73
  if ( objimp.isa( OTLong ) )
14,571✔
74
  {
75
    return lval_ == ( (BLong&)objimp ).lval_;
10,382✔
76
  }
77
  if ( objimp.isa( OTDouble ) )
4,189✔
78
  {
79
    return lval_ == ( (Double&)objimp ).value();
117✔
80
  }
81
  if ( objimp.isa( OTBoolean ) )
4,072✔
82
  {
83
    return isTrue() == static_cast<const BBoolean&>( objimp ).isTrue();
6✔
84
  }
85

86
  return false;
4,066✔
87
}
88

89
bool BLong::operator<( const BObjectImp& objimp ) const
16,545✔
90
{
91
  if ( objimp.isa( OTLong ) )
16,545✔
92
  {
93
    return lval_ < ( (BLong&)objimp ).lval_;
16,307✔
94
  }
95
  if ( objimp.isa( OTDouble ) )
238✔
96
  {
97
    return lval_ < ( (Double&)objimp ).value();
201✔
98
  }
99

100
  return base::operator<( objimp );
37✔
101
}
102

103
std::string BLong::getStringRep() const
13,061✔
104
{
105
  OSTRINGSTREAM os;
13,061✔
106

107
  os << lval_;
13,061✔
108

109
  return OSTRINGSTREAM_STR( os );
26,122✔
110
}
13,061✔
111

112
BObjectImp* BLong::selfPlusObjImp( const BObjectImp& objimp ) const
13,188✔
113
{
114
  return objimp.selfPlusObj( *this );
13,188✔
115
}
116
BObjectImp* BLong::selfPlusObj( const BLong& objimp ) const
11,130✔
117
{
118
  return new BLong( lval_ + objimp.lval_ );
11,130✔
119
}
120
BObjectImp* BLong::selfPlusObj( const Double& objimp ) const
16✔
121
{
122
  return new Double( lval_ + objimp.value() );
16✔
123
}
124
BObjectImp* BLong::selfPlusObj( const String& objimp ) const
33✔
125
{
126
  return new String( getStringRep() + objimp.value() );
33✔
127
}
128

129
void BLong::selfPlusObjImp( BObjectImp& objimp, BObject& obj )
552✔
130
{
131
  objimp.selfPlusObj( *this, obj );
552✔
132
}
552✔
133
void BLong::selfPlusObj( BLong& objimp, BObject& /*obj*/ )
516✔
134
{
135
  lval_ += objimp.value();
516✔
136
}
516✔
137
void BLong::selfPlusObj( Double& objimp, BObject& obj )
3✔
138
{
139
  obj.setimp( selfPlusObj( objimp ) );
3✔
140
}
3✔
141
void BLong::selfPlusObj( String& objimp, BObject& obj )
3✔
142
{
143
  obj.setimp( selfPlusObj( objimp ) );
3✔
144
}
3✔
145

146
BObjectImp* BLong::selfMinusObjImp( const BObjectImp& objimp ) const
2,763✔
147
{
148
  return objimp.selfMinusObj( *this );
2,763✔
149
}
150
BObjectImp* BLong::selfMinusObj( const BLong& objimp ) const
2,733✔
151
{
152
  return new BLong( lval_ - objimp.value() );
2,733✔
153
}
154
BObjectImp* BLong::selfMinusObj( const Double& objimp ) const
16✔
155
{
156
  return new Double( lval_ - objimp.value() );
16✔
157
}
158
BObjectImp* BLong::selfMinusObj( const String& objimp ) const
21✔
159
{
160
  String s( getStringRep() );
21✔
161
  return s.selfMinusObj( objimp );
42✔
162
}
21✔
163
void BLong::selfMinusObjImp( BObjectImp& objimp, BObject& obj )
54✔
164
{
165
  objimp.selfMinusObj( *this, obj );
54✔
166
}
54✔
167
void BLong::selfMinusObj( BLong& objimp, BObject& /*obj*/ )
27✔
168
{
169
  lval_ -= objimp.value();
27✔
170
}
27✔
171
void BLong::selfMinusObj( Double& objimp, BObject& obj )
3✔
172
{
173
  obj.setimp( selfMinusObj( objimp ) );
3✔
174
}
3✔
175
void BLong::selfMinusObj( String& objimp, BObject& obj )
3✔
176
{
177
  obj.setimp( selfMinusObj( objimp ) );
3✔
178
}
3✔
179

180
BObjectImp* BLong::selfTimesObjImp( const BObjectImp& objimp ) const
1,238✔
181
{
182
  return objimp.selfTimesObj( *this );
1,238✔
183
}
184
BObjectImp* BLong::selfTimesObj( const BLong& objimp ) const
1,169✔
185
{
186
  return new BLong( lval_ * objimp.lval_ );
1,169✔
187
}
188
BObjectImp* BLong::selfTimesObj( const Double& objimp ) const
27✔
189
{
190
  return new Double( lval_ * objimp.value() );
27✔
191
}
192
void BLong::selfTimesObjImp( BObjectImp& objimp, BObject& obj )
54✔
193
{
194
  objimp.selfTimesObj( *this, obj );
54✔
195
}
54✔
196
void BLong::selfTimesObj( BLong& objimp, BObject& /*obj*/ )
27✔
197
{
198
  lval_ *= objimp.lval_;
27✔
199
}
27✔
200
void BLong::selfTimesObj( Double& objimp, BObject& obj )
3✔
201
{
202
  obj.setimp( selfTimesObj( objimp ) );
3✔
203
}
3✔
204

205
BObjectImp* BLong::selfDividedByObjImp( const BObjectImp& objimp ) const
56✔
206
{
207
  return objimp.selfDividedByObj( *this );
56✔
208
}
209
BObjectImp* BLong::selfDividedByObj( const BLong& objimp ) const
8✔
210
{
211
  int divisor = objimp.lval_;
8✔
212
  if ( !divisor )
8✔
213
    return new BError( "Divide by Zero" );
×
214
  return new BLong( lval_ / divisor );
8✔
215
}
216
BObjectImp* BLong::selfDividedByObj( const Double& objimp ) const
6✔
217
{
218
  double divisor = objimp.value();
6✔
219
  if ( divisor == 0.0 )
6✔
220
    return new BError( "Divide by Zero" );
×
221
  return new Double( lval_ / divisor );
6✔
222
}
223
void BLong::selfDividedByObjImp( BObjectImp& objimp, BObject& obj )
42✔
224
{
225
  objimp.selfDividedByObj( *this, obj );
42✔
226
}
42✔
227
void BLong::selfDividedByObj( BLong& objimp, BObject& obj )
15✔
228
{
229
  if ( !objimp.lval_ )
15✔
230
    obj.setimp( new BError( "Divide by Zero" ) );
×
231
  else
232
    lval_ /= objimp.lval_;
15✔
233
}
15✔
234
void BLong::selfDividedByObj( Double& objimp, BObject& obj )
3✔
235
{
236
  obj.setimp( selfDividedByObj( objimp ) );
3✔
237
}
3✔
238

239
BObjectImp* BLong::selfModulusObjImp( const BObjectImp& objimp ) const
144✔
240
{
241
  return objimp.selfModulusObj( *this );
144✔
242
}
243
BObjectImp* BLong::selfModulusObj( const BLong& objimp ) const
81✔
244
{
245
  int divisor = objimp.lval_;
81✔
246
  if ( !divisor )
81✔
247
    return new BError( "Divide by Zero" );
9✔
248
  return new BLong( lval_ % divisor );
72✔
249
}
250
BObjectImp* BLong::selfModulusObj( const Double& objimp ) const
78✔
251
{
252
  if ( !objimp.value() )
78✔
253
    return new BError( "Divide by Zero" );
18✔
254
  return new Double( fmod( lval_, objimp.value() ) );
60✔
255
}
256
void BLong::selfModulusObjImp( BObjectImp& objimp, BObject& obj )
105✔
257
{
258
  objimp.selfModulusObj( *this, obj );
105✔
259
}
105✔
260
void BLong::selfModulusObj( BLong& objimp, BObject& obj )
42✔
261
{
262
  if ( !objimp.lval_ )
42✔
263
    obj.setimp( new BError( "Divide by Zero" ) );
9✔
264
  else
265
    lval_ %= objimp.lval_;
33✔
266
}
42✔
267
void BLong::selfModulusObj( Double& objimp, BObject& obj )
39✔
268
{
269
  obj.setimp( selfModulusObj( objimp ) );
39✔
270
}
39✔
271

272

273
BObjectImp* BLong::selfBitShiftRightObjImp( const BObjectImp& objimp ) const
30✔
274
{
275
  return objimp.selfBitShiftRightObj( *this );
30✔
276
}
277
BObjectImp* BLong::selfBitShiftRightObj( const BLong& objimp ) const
3✔
278
{
279
  return new BLong( lval_ >> objimp.lval_ );
3✔
280
}
281
void BLong::selfBitShiftRightObjImp( BObjectImp& objimp, BObject& obj )
×
282
{
283
  objimp.selfBitShiftRightObj( *this, obj );
×
284
}
×
285
void BLong::selfBitShiftRightObj( BLong& objimp, BObject& /*obj*/ )
×
286
{
287
  lval_ >>= objimp.lval_;
×
288
}
×
289

290
BObjectImp* BLong::selfBitShiftLeftObjImp( const BObjectImp& objimp ) const
30✔
291
{
292
  return objimp.selfBitShiftLeftObj( *this );
30✔
293
}
294
BObjectImp* BLong::selfBitShiftLeftObj( const BLong& objimp ) const
3✔
295
{
296
  return new BLong( lval_ << objimp.lval_ );
3✔
297
}
298
void BLong::selfBitShiftLeftObjImp( BObjectImp& objimp, BObject& obj )
×
299
{
300
  objimp.selfBitShiftLeftObj( *this, obj );
×
301
}
×
302
void BLong::selfBitShiftLeftObj( BLong& objimp, BObject& /*obj*/ )
×
303
{
304
  lval_ <<= objimp.lval_;
×
305
}
×
306

307
BObjectImp* BLong::selfBitAndObjImp( const BObjectImp& objimp ) const
33✔
308
{
309
  return objimp.selfBitAndObj( *this );
33✔
310
}
311
BObjectImp* BLong::selfBitAndObj( const BLong& objimp ) const
5✔
312
{
313
  return new BLong( lval_ & objimp.lval_ );
5✔
314
}
315
void BLong::selfBitAndObjImp( BObjectImp& objimp, BObject& obj )
×
316
{
317
  objimp.selfBitAndObj( *this, obj );
×
318
}
×
319
void BLong::selfBitAndObj( BLong& objimp, BObject& /*obj*/ )
×
320
{
321
  lval_ &= objimp.lval_;
×
322
}
×
323

324
BObjectImp* BLong::selfBitOrObjImp( const BObjectImp& objimp ) const
30✔
325
{
326
  return objimp.selfBitOrObj( *this );
30✔
327
}
328
BObjectImp* BLong::selfBitOrObj( const BLong& objimp ) const
3✔
329
{
330
  return new BLong( lval_ | objimp.lval_ );
3✔
331
}
332
void BLong::selfBitOrObjImp( BObjectImp& objimp, BObject& obj )
×
333
{
334
  objimp.selfBitOrObj( *this, obj );
×
335
}
×
336
void BLong::selfBitOrObj( BLong& objimp, BObject& /*obj*/ )
×
337
{
338
  lval_ |= objimp.lval_;
×
339
}
×
340

341
BObjectImp* BLong::selfBitXorObjImp( const BObjectImp& objimp ) const
30✔
342
{
343
  return objimp.selfBitXorObj( *this );
30✔
344
}
345
BObjectImp* BLong::selfBitXorObj( const BLong& objimp ) const
3✔
346
{
347
  return new BLong( lval_ ^ objimp.lval_ );
3✔
348
}
349
void BLong::selfBitXorObjImp( BObjectImp& objimp, BObject& obj )
×
350
{
351
  objimp.selfBitXorObj( *this, obj );
×
352
}
×
353
void BLong::selfBitXorObj( BLong& objimp, BObject& /*obj*/ )
×
354
{
355
  lval_ ^= objimp.lval_;
×
356
}
×
357

358
BObjectImp* BLong::bitnot() const
24✔
359
{
360
  return new BLong( ~lval_ );
24✔
361
}
362
}  // namespace Pol::Bscript
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc