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

polserver / polserver / 28964407401

08 Jul 2026 05:58PM UTC coverage: 61.276% (+0.3%) from 60.927%
28964407401

push

github

web-flow
Split bobject header  (#892)

* splitted bobject header

* fixed runecl

* crashfix

* missing header

* more missing (debug build)

* runecl debug include

* renamed contiter, moved formating

* removed more unused headers

1145 of 1517 new or added lines in 23 files covered. (75.48%)

217 existing lines in 4 files now uncovered.

44972 of 73392 relevant lines covered (61.28%)

557151.3 hits per line

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

35.85
/pol-core/bscript/str.cpp
1
#include "str.h"
2

3
#include "bdouble.h"
4
#include "blong.h"
5
#include "bobject.h"
6

7
namespace Pol::Bscript
8
{
UNCOV
9
void int_to_binstr( int& value, std::stringstream& s )
×
10
{
11
  int i;
12
  for ( i = 31; i > 0; i-- )
×
13
  {
14
    if ( value & ( 1 << i ) )
×
15
      break;
×
16
  }
17
  for ( ; i >= 0; i-- )
×
18
  {
19
    if ( value & ( 1 << i ) )
×
20
      s << "1";
×
21
    else
22
      s << "0";
×
23
  }
24
}
×
25

26
bool try_to_format( std::stringstream& to_stream, BObjectImp* what, std::string& frmt )
1,363✔
27
{
28
  if ( frmt.empty() )
1,363✔
29
  {
30
    to_stream << what->getStringRep();
1,129✔
31
    return false;
1,129✔
32
  }
33

34
  if ( frmt.find( 'b' ) != std::string::npos )
234✔
35
  {
36
    if ( auto* plong = impptrIf<BLong>( what ) )
×
37
    {
38
      int n = plong->value();
×
39
      if ( frmt.find( '#' ) != std::string::npos )
×
40
        to_stream << ( ( n < 0 ) ? "-" : "" ) << "0b";
×
41
      int_to_binstr( n, to_stream );
×
42
    }
43
    else
44
    {
45
      to_stream << "<needs Int>";
×
46
      return false;
×
47
    }
48
  }
49
  else if ( frmt.find( 'x' ) != std::string::npos )
234✔
50
  {
51
    if ( auto* plong = impptrIf<BLong>( what ) )
234✔
52
    {
53
      int n = plong->value();
199✔
54
      if ( frmt.find( '#' ) != std::string::npos )
199✔
55
        to_stream << "0x";
9✔
56
      to_stream << std::hex << n << std::dec;
199✔
57
    }
58
    else
59
    {
60
      to_stream << "<needs Int>";
35✔
61
      return false;
35✔
62
    }
63
  }
64
  else if ( frmt.find( 'o' ) != std::string::npos )
×
65
  {
66
    if ( auto* plong = impptrIf<BLong>( what ) )
×
67
    {
68
      int n = plong->value();
×
69
      if ( frmt.find( '#' ) != std::string::npos )
×
70
        to_stream << "0o";
×
71
      to_stream << std::oct << n << std::dec;
×
72
    }
73
    else
74
    {
75
      to_stream << "<needs Int>";
×
76
      return false;
×
77
    }
78
  }
79
  else if ( frmt.find( 'd' ) != std::string::npos )
×
80
  {
81
    int n;
82
    if ( auto* plong = impptrIf<BLong>( what ) )
×
83
      n = plong->value();
×
84
    else if ( auto* pdbl = impptrIf<Double>( what ) )
×
85
      n = (int)pdbl->value();
×
86
    else
87
    {
88
      to_stream << "<needs Int, Double>";
×
89
      return false;
×
90
    }
91
    to_stream << std::dec << n;
×
92
  }
93
  else
94
  {
95
    to_stream << "<bad format: " << frmt << ">";
×
96
    return false;
×
97
  }
98
  return true;
199✔
99
}
100

101
std::string get_formatted( BObjectImp* what, std::string& frmt )
222✔
102
{
103
  std::stringstream result;
222✔
104
  try_to_format( result, what, frmt );
222✔
105
  return result.str();
444✔
106
}
222✔
107
}  // namespace Pol::Bscript
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc