Pol  Revision:3cfda13
basicmod.cpp
Go to the documentation of this file.
1 
12 #include "basicmod.h"
13 
14 #include <cstdio>
15 #include <cstdlib>
16 #include <cstring>
17 #include <picojson.h>
18 #include <string>
19 
20 #include "../../bscript/berror.h"
21 #include "../../bscript/bobject.h"
22 #include "../../bscript/dict.h"
23 #include "../../bscript/executor.h"
24 #include "../../bscript/impstr.h"
25 #include "../../clib/stlutil.h"
26 
27 namespace Pol
28 {
29 namespace Module
30 {
31 using namespace Bscript;
32 
34  : Bscript::TmplExecutorModule<BasicExecutorModule>( "Basic", exec )
35 {
36 }
37 
39 {
41  if ( imp->isa( Bscript::BObjectImp::OTArray ) )
42  {
43  Bscript::ObjArray* arr = static_cast<Bscript::ObjArray*>( imp );
44  return new BLong( static_cast<int>( arr->ref_arr.size() ) );
45  }
46  else if ( imp->isa( Bscript::BObjectImp::OTString ) )
47  {
48  return new BLong( static_cast<int>( imp->getStringRep().length() ) );
49  }
50  else if ( imp->isa( Bscript::BObjectImp::OTError ) )
51  {
52  BError* err = static_cast<BError*>( imp );
53  return new BLong( static_cast<int>( err->mapcount() ) );
54  }
55  else
56  {
57  return new BLong( 0 );
58  }
59 }
60 
62 {
63  exec.makeString( 0 );
64  String* str = static_cast<String*>( exec.getParamImp( 0 ) );
65  const char* s = exec.paramAsString( 1 );
66  int d = static_cast<int>( exec.paramAsLong( 2 ) );
67 
68  int posn = str->find( d ? ( d - 1 ) : 0, s ) + 1;
69 
70  return new BLong( posn );
71 }
72 
74 {
75  exec.makeString( 0 );
76  String* str = static_cast<String*>( exec.getParamImp( 0 ) );
77  int start = static_cast<int>( exec.paramAsLong( 1 ) );
78  int length = static_cast<int>( exec.paramAsLong( 2 ) );
79 
80  return str->StrStr( start, length );
81 }
82 
84 {
86  if ( !( imp->isa( Bscript::BObjectImp::OTString ) ) )
87  {
88  return new BError( "Param 1 must be a string." );
89  }
90  String* string = static_cast<String*>( imp );
91  int type = static_cast<int>( exec.paramAsLong( 1 ) );
92  const char* cset = exec.paramAsString( 2 );
93  if ( type > 3 )
94  type = 3;
95  if ( type < 1 )
96  type = 1;
97 
98  return string->ETrim( cset, type );
99 }
100 
101 /*
102 eScript Function Useage
103 
104 StrReplace(str, to_replace, replace_with);
105 */
107 {
109  std::unique_ptr<String> string( new String( imp->getStringRep().c_str() ) );
110  String* to_replace = static_cast<String*>( exec.getParamImp( 1, Bscript::BObjectImp::OTString ) );
111  if ( !to_replace )
112  return new BError( "Invalid parameter type" );
113  String* replace_with =
114  static_cast<String*>( exec.getParamImp( 2, Bscript::BObjectImp::OTString ) );
115  if ( !replace_with )
116  return new BError( "Invalid parameter type" );
117 
118  if ( string->length() < 1 )
119  return new BError( "Cannot use empty string for string haystack." );
120  if ( to_replace->length() < 1 )
121  return new BError( "Cannot use empty string for string needle." );
122 
123  string->EStrReplace( to_replace, replace_with );
124 
125  return string.release();
126 }
127 
128 // SubStrReplace(str, replace_with, start, length:=0);
130 {
132  std::unique_ptr<String> string( new String( imp->getStringRep().c_str() ) );
133  String* replace_with =
134  static_cast<String*>( exec.getParamImp( 1, Bscript::BObjectImp::OTString ) );
135  if ( !replace_with )
136  return new BError( "Invalid parameter type" );
137  int index = static_cast<int>( exec.paramAsLong( 2 ) );
138  int len = static_cast<int>( exec.paramAsLong( 3 ) );
139 
140  if ( index < 0 )
141  return new BError( "Index must not be negative" );
142  if ( static_cast<unsigned>( index - 1 ) > string->length() )
143  return new BError( "Index out of range" );
144 
145  // We set it to 1 because of doing -1 later to stay with eScript handling.
146  if ( !index )
147  index = 1;
148 
149  if ( static_cast<unsigned>( len ) > ( string->length() - index ) )
150  return new BError( "Length out of range" );
151  if ( len < 0 )
152  return new BError( "Length must not be negative" );
153 
154  if ( !len )
155  len = static_cast<int>( replace_with->length() - index );
156 
157  string->ESubStrReplace( replace_with, static_cast<unsigned>( index ),
158  static_cast<unsigned>( len ) );
159 
160  return string.release();
161 }
162 
163 // OMG I HATED THIS REQUEST. Ugly code, but necessary for all the checks
164 // just in case someone's code is bugged :(
166 {
167  std::string str1 = exec.paramAsString( 0 );
168  std::string str2 = exec.paramAsString( 1 );
169  int pos1_index = static_cast<int>( exec.paramAsLong( 2 ) );
170  int pos1_len = static_cast<int>( exec.paramAsLong( 3 ) );
171  int pos2_index = static_cast<int>( exec.paramAsLong( 4 ) );
172  int pos2_len = static_cast<int>( exec.paramAsLong( 5 ) );
173 
174  if ( pos1_index != 0 )
175  {
176  if ( pos1_index < 0 )
177  return new BError( "Index must not be negative for param 1" );
178  if ( static_cast<unsigned>( pos1_index - 1 ) > str1.length() )
179  return new BError( "Index out of range for param 1" );
180  }
181  if ( pos2_index != 0 )
182  {
183  if ( pos2_index < 0 )
184  return new BError( "Index must not be negative for param 2" );
185  if ( static_cast<unsigned>( pos2_index - 1 ) > str2.length() )
186  return new BError( "Index out of range for param 2" );
187  }
188 
189 
190  if ( pos1_len < 0 )
191  return new BError( "Length must not be negative for param 1" );
192  if ( static_cast<unsigned>( pos1_len ) > ( str1.length() - pos1_index ) )
193  return new BError( "Length out of range for param 1" );
194  if ( pos2_len < 0 )
195  return new BError( "Length must not be negative for param 2" );
196  if ( static_cast<unsigned>( pos2_len ) > ( str2.length() - pos2_index ) )
197  return new BError( "Length out of range for param 2" );
198 
199 
200  if ( pos1_index == 0 )
201  {
202  unsigned int result = str1.compare( str2 );
203  if ( result != 0 )
204  return new BLong( 0 );
205  else
206  return new BLong( 1 );
207  }
208  else if ( pos1_index > 0 && pos2_index == 0 )
209  {
210  unsigned int result = str1.compare( pos1_index - 1, pos1_len, str2 );
211  if ( result != 0 )
212  return new BLong( 0 );
213  else
214  return new BLong( 1 );
215  }
216  else
217  {
218  unsigned int result = str1.compare( pos1_index - 1, pos1_len, str2, pos2_index - 1, pos2_len );
219  if ( result != 0 )
220  return new BLong( 0 );
221  else
222  return new BLong( 1 );
223  }
224 }
225 
227 {
228  String* string = new String( exec.paramAsString( 0 ) );
229  string->toLower();
230  return string;
231 }
232 
234 {
235  String* string = new String( exec.paramAsString( 0 ) );
236  string->toUpper();
237  return string;
238 }
239 
241 {
243  if ( imp->isa( Bscript::BObjectImp::OTLong ) )
244  {
245  return imp->copy();
246  }
247  else if ( imp->isa( Bscript::BObjectImp::OTString ) )
248  {
249  String* str = static_cast<String*>( imp );
250  return new BLong( strtoul( str->data(), NULL, 0 ) );
251  }
252  else if ( imp->isa( Bscript::BObjectImp::OTDouble ) )
253  {
254  Double* dbl = static_cast<Double*>( imp );
255  return new BLong( static_cast<int>( dbl->value() ) );
256  }
257  else
258  {
259  return new BLong( 0 );
260  }
261 }
262 
264 {
266  if ( imp->isa( Bscript::BObjectImp::OTLong ) )
267  {
268  BLong* lng = static_cast<BLong*>( imp );
269  return new Double( lng->value() );
270  }
271  else if ( imp->isa( Bscript::BObjectImp::OTString ) )
272  {
273  String* str = static_cast<String*>( imp );
274  return new Double( strtod( str->data(), NULL ) );
275  }
276  else if ( imp->isa( Bscript::BObjectImp::OTDouble ) )
277  {
278  return imp->copy();
279  }
280  else
281  {
282  return new Double( 0 );
283  }
284 }
285 
287 {
289  return new String( imp->getStringRep() );
290 }
291 
293 {
295  if ( imp->isa( Bscript::BObjectImp::OTString ) )
296  {
297  String* str = static_cast<String*>( imp );
298  return new BLong( static_cast<unsigned char>( str->data()[0] ) );
299  }
300  else
301  {
302  return new BError( "Invalid parameter type" );
303  }
304 }
305 
307 {
309  std::string tmp = imp->getStringRep();
310  int nullterm = static_cast<int>( exec.paramAsLong( 1 ) );
311  std::unique_ptr<Bscript::ObjArray> arr( new Bscript::ObjArray );
312  for ( size_t i = 0; i < tmp.size(); ++i )
313  {
314  arr->addElement( new BLong( static_cast<unsigned char>( tmp[i] ) ) );
315  }
316  if ( nullterm )
317  arr->addElement( new BLong( 0 ) );
318 
319  return arr.release();
320 }
321 
323 {
324  int val;
325  if ( getParam( 0, val ) )
326  {
327  char s[2];
328  s[0] = static_cast<char>( val );
329  s[1] = '\0';
330  return new String( s );
331  }
332  else
333  {
334  return new BError( "Invalid parameter type" );
335  }
336 }
337 
339 {
340  std::string res;
341  Bscript::ObjArray* arr =
343  int break_first_null = static_cast<int>( exec.paramAsLong( 1 ) );
344  if ( !arr )
345  return new BError( "Invalid parameter type" );
346  for ( Bscript::ObjArray::const_iterator itr = arr->ref_arr.begin(), itrend = arr->ref_arr.end();
347  itr != itrend; ++itr )
348  {
349  BObject* bo = ( itr->get() );
350  if ( bo == NULL )
351  continue;
352  Bscript::BObjectImp* imp = bo->impptr();
353  if ( imp )
354  {
355  if ( imp->isa( Bscript::BObjectImp::OTLong ) )
356  {
357  BLong* blong = static_cast<BLong*>( imp );
358  if ( break_first_null && blong->value() == 0 )
359  break;
360  char s[2];
361  s[0] = static_cast<char>( blong->value() );
362  s[1] = '\0';
363  res += s;
364  }
365  }
366  }
367  return new String( res );
368 }
369 
371 {
373  if ( imp->isa( Bscript::BObjectImp::OTLong ) )
374  {
375  BLong* plong = static_cast<BLong*>( imp );
376  char s[20];
377  sprintf( s, "0x%X", static_cast<unsigned int>( plong->value() ) );
378  return new String( s );
379  }
380  else if ( imp->isa( Bscript::BObjectImp::OTDouble ) )
381  {
382  Double* pdbl = static_cast<Double*>( imp );
383  char s[20];
384  sprintf( s, "0x%X", static_cast<unsigned int>( pdbl->value() ) );
385  return new String( s );
386  }
387  else if ( imp->isa( Bscript::BObjectImp::OTString ) )
388  {
389  String* str = static_cast<String*>( imp );
390  char s[20];
391  sprintf( s, "0x%X", static_cast<unsigned int>( strtoul( str->data(), NULL, 0 ) ) );
392  return new String( s );
393  }
394  else
395  {
396  return new BError( "Hex() expects an Integer, Real, or String" );
397  }
398 }
399 
400 #ifdef __unix__
401 char* itoa( int value, char* result, int base )
402 {
403  // check that the base is valid
404  if ( base < 2 || base > 16 )
405  {
406  *result = 0;
407  return result;
408  }
409 
410  char* out = result;
411  int quotient = value;
412 
413  do
414  {
415  *out = "0123456789abcdef"[std::abs( quotient % base )];
416  ++out;
417  quotient /= base;
418  } while ( quotient );
419 
420  // Only apply negative sign for base 10
421  if ( value < 0 && base == 10 )
422  *out++ = '-';
423 
424  std::reverse( result, out );
425  *out = 0;
426  return result;
427 }
428 #endif
429 
431 {
433  if ( imp->isa( Bscript::BObjectImp::OTLong ) )
434  {
435  BLong* plong = static_cast<BLong*>( imp );
436  int number = plong->value();
437  char buffer[sizeof( int ) * 8 + 1];
438  return new String( itoa( number, buffer, 2 ) );
439  }
440  else
441  {
442  return new BError( "Bin() expects an Integer" );
443  }
444 }
445 
447 {
448  Bscript::BObjectImp* bimp_split = exec.getParamImp( 0 );
449  std::string source = bimp_split->getStringRep();
450 
451  const String* bimp_delimiter;
452  if ( !exec.getStringParam( 1, bimp_delimiter ) )
453  {
454  return new BError( "Invalid parameter type." );
455  }
456  std::string delimiter = bimp_delimiter->getStringRep();
457 
458  // max_split parameter
459  int max_split = -1;
460  int count = 0;
461 
462  if ( exec.hasParams( 3 ) )
463  {
464  max_split = static_cast<int>( exec.paramAsLong( 2 ) );
465  }
466 
467  std::unique_ptr<Bscript::ObjArray> objarr( new Bscript::ObjArray );
468 
469  // Support for how it previously worked.
470  // Kept to support spaces and tabs as the same.
471  if ( delimiter == " " )
472  {
473  ISTRINGSTREAM is( source );
474  std::string tmp;
475  std::streamoff tellg = -1;
476  bool splitted = false;
477 
478  while ( is >> tmp )
479  {
480  tellg = is.tellg();
481  if ( count == max_split && tellg != -1 )
482  { // added max_split parameter
483  splitted = true;
484  break;
485  }
486  objarr->addElement( new String( tmp ) );
487  tmp = "";
488  count += 1;
489  }
490 
491  // Merges the remaining of the string
492  if ( splitted )
493  {
494  std::string remaining_string;
495  remaining_string = source.substr( tellg - tmp.length(), source.length() );
496  objarr->addElement( new String( remaining_string ) );
497  }
498 
499  return objarr.release();
500  }
501 
502  // New delimiter support.
503  std::string new_string = source;
504  std::string::size_type found;
505  do
506  {
507  found = new_string.find( delimiter, 0 );
508  if ( found == std::string::npos )
509  break;
510  else if ( count == max_split )
511  { // added max_split parameter
512  break;
513  }
514 
515  std::string add_string = new_string.substr( 0, found );
516 
517  // Shinigami: will not hang server on queue of delimiter
518  // if ( add_string.empty() )
519  // continue;
520 
521  objarr->addElement( new String( add_string ) );
522  std::string tmp_string = new_string.substr( found + delimiter.length(), new_string.length() );
523  new_string = tmp_string;
524  count += 1;
525  } while ( found != std::string::npos );
526 
527  // Catch leftovers here.
528  if ( !new_string.empty() )
529  objarr->addElement( new String( new_string ) );
530 
531  return objarr.release();
532 }
533 
535 {
537  return new String( imp->pack() );
538 }
539 
541 {
542  const String* str;
543 
544  if ( exec.getStringParam( 0, str ) )
545  {
546  return Bscript::BObjectImp::unpack( str->data() );
547  }
548  else
549  {
550  return new BError( "Invalid parameter type" );
551  }
552 }
554 {
556  return new String( imp->typeOf() );
557 }
559 {
561  return new BLong( static_cast<int>( imp->sizeEstimate() ) );
562 }
564 {
565  BObjectImp* imp = exec.getParamImp( 0 );
566  return new BLong( imp->typeOfInt() );
567 }
568 
569 picojson::value recurseE2J( BObjectImp* v )
570 {
571  if ( v->isa( BObjectImp::OTString ) )
572  {
573  return picojson::value( v->getStringRep() );
574  }
575  else if ( v->isa( BObjectImp::OTLong ) )
576  {
577  int intVal = static_cast<BLong*>( v )->value();
578  return picojson::value( static_cast<double>( intVal ) );
579  }
580  else if ( v->isa( BObjectImp::OTDouble ) )
581  {
582  return picojson::value( static_cast<Double*>( v )->value() );
583  }
584  else if ( v->isa( BObjectImp::OTBoolean ) )
585  {
586  return picojson::value( static_cast<BBoolean*>( v )->value() );
587  }
588  else if ( v->isa( BObjectImp::OTArray ) )
589  {
590  ObjArray* arr = static_cast<ObjArray*>( v );
591  picojson::array jsonArr;
592 
593  for ( const auto& elem : arr->ref_arr )
594  {
595  BObject* bo = elem.get();
596  if ( bo == nullptr )
597  continue;
598  BObjectImp* imp = bo->impptr();
599  jsonArr.push_back( recurseE2J( imp ) );
600  }
601  return picojson::value( jsonArr );
602  }
603  else if ( v->isa( BObjectImp::OTStruct ) )
604  {
605  BStruct* bstruct = static_cast<BStruct*>( v );
606  picojson::object jsonObj;
607  for ( const auto& content : bstruct->contents() )
608  {
609  BObjectImp* imp = content.second->impptr();
610  jsonObj.insert( std::pair<std::string, picojson::value>( content.first, recurseE2J( imp ) ) );
611  }
612  return picojson::value( jsonObj );
613  }
614  else if ( v->isa( BObjectImp::OTDictionary ) )
615  {
616  BDictionary* cpropdict = static_cast<Bscript::BDictionary*>( v );
617  picojson::object jsonObj;
618  for ( const auto& content : cpropdict->contents() )
619  {
620  BObjectImp* imp = content.second->impptr();
621  jsonObj.insert( std::pair<std::string, picojson::value>( content.first->getStringRep(),
622  recurseE2J( imp ) ) );
623  }
624  return picojson::value( jsonObj );
625  }
626  return picojson::value();
627 }
629 {
630  BObjectImp* imp = exec.getParamImp( 0 );
631  return new String( recurseE2J( imp ).serialize() );
632 }
633 
634 
635 Bscript::BObjectImp* recurseJ2E( const picojson::value& v )
636 {
637  if ( v.is<std::string>() )
638  {
639  return new String( v.get<std::string>() );
640  }
641  else if ( v.is<double>() )
642  {
643  // Possible improvement: separate into BLong and Double
644  return new Double( v.get<double>() );
645  }
646  else if ( v.is<bool>() )
647  {
648  return new BBoolean( v.get<bool>() );
649  }
650  else if ( v.is<picojson::array>() )
651  {
652  std::unique_ptr<ObjArray> objarr( new ObjArray );
653  const picojson::array& arr = v.get<picojson::array>();
654  for ( const auto& elem : arr )
655  {
656  objarr->addElement( recurseJ2E( elem ) );
657  }
658  return objarr.release();
659  }
660  else if ( v.is<picojson::object>() )
661  {
662  std::unique_ptr<BStruct> objstruct( new BStruct );
663  for ( const auto& content : v.get<picojson::object>() )
664  {
665  objstruct->addMember( content.first.c_str(), recurseJ2E( content.second ) );
666  }
667  return objstruct.release();
668  }
669  else
670  return UninitObject::create();
671 }
672 
674 {
675  const String* str;
676 
677  if ( exec.getStringParam( 0, str ) )
678  {
679  picojson::value v;
680  std::string err = picojson::parse( v, str->data() );
681  if ( !err.empty() )
682  {
683  return new BError( err );
684  }
685  return recurseJ2E( v );
686  }
687  else
688  {
689  return new BError( "Invalid parameter type" );
690  }
691 }
692 
694 {
696  if ( imp->isa( Bscript::BObjectImp::OTLong ) )
697  {
698  BLong* plong = static_cast<BLong*>( imp );
699  return new BBoolean( plong->value() != 0 );
700  }
701  else if ( imp->isa( Bscript::BObjectImp::OTBoolean ) )
702  {
703  return new BBoolean( *static_cast<BBoolean*>( imp ) );
704  }
705  else
706  {
707  return new BError( "Boolean() expects an Integer or Boolean" );
708  }
709 }
710 } // namespace Module
711 
712 namespace Bscript
713 {
714 using namespace Module;
715 template <>
718  {"find", &BasicExecutorModule::find},
719  {"len", &BasicExecutorModule::len},
720  {"upper", &BasicExecutorModule::upper},
721  {"lower", &BasicExecutorModule::lower},
722  {"Substr", &BasicExecutorModule::mf_substr},
723  {"Trim", &BasicExecutorModule::mf_Trim},
724  {"StrReplace", &BasicExecutorModule::mf_StrReplace},
725  {"SubStrReplace", &BasicExecutorModule::mf_SubStrReplace},
726  {"Compare", &BasicExecutorModule::mf_Compare},
727  {"CInt", &BasicExecutorModule::mf_CInt},
728  {"CStr", &BasicExecutorModule::mf_CStr},
729  {"CDbl", &BasicExecutorModule::mf_CDbl},
730  {"CAsc", &BasicExecutorModule::mf_CAsc},
731  {"CChr", &BasicExecutorModule::mf_CChr},
732  {"CAscZ", &BasicExecutorModule::mf_CAscZ},
733  {"CChrZ", &BasicExecutorModule::mf_CChrZ},
734  {"Bin", &BasicExecutorModule::mf_Bin},
735  {"Hex", &BasicExecutorModule::mf_Hex},
736  {"SplitWords", &BasicExecutorModule::mf_SplitWords},
737  {"Pack", &BasicExecutorModule::mf_Pack},
738  {"Unpack", &BasicExecutorModule::mf_Unpack},
739  {"TypeOf", &BasicExecutorModule::mf_TypeOf},
740  {"SizeOf", &BasicExecutorModule::mf_SizeOf},
741  {"TypeOfInt", &BasicExecutorModule::mf_TypeOfInt},
742  {"Boolean", &BasicExecutorModule::mf_Boolean},
743  {"PackJSON", &BasicExecutorModule::mf_PackJSON},
744  {"UnpackJSON", &BasicExecutorModule::mf_UnpackJSON}};
745 }
746 }
Bscript::BObjectImp * mf_Trim()
Definition: basicmod.cpp:83
virtual std::string getStringRep() const =0
size_t mapcount() const
Definition: bstruct.cpp:190
Bscript::BObjectImp * mf_Compare()
Definition: basicmod.cpp:165
int value() const
Definition: bobject.h:592
Bscript::BObjectImp * lower()
Definition: basicmod.cpp:226
int find(int begin, const char *target)
Definition: str.cpp:170
bool isa(BObjectType type) const
Definition: bobject.h:353
Bscript::BObjectImp * mf_TypeOfInt()
Definition: basicmod.cpp:563
Bscript::BObjectImp * len()
Definition: basicmod.cpp:38
Bscript::BObjectImp * mf_SplitWords()
Definition: basicmod.cpp:446
unsigned int release()
Definition: refptr.h:125
bool getParam(unsigned param, int &value)
Definition: execmodl.cpp:62
Bscript::BObjectImp * mf_Boolean()
Definition: basicmod.cpp:693
Bscript::BObjectImp * mf_StrReplace()
Definition: basicmod.cpp:106
virtual std::string getStringRep() const POL_OVERRIDE
Definition: impstr.h:129
const Contents & contents() const
Definition: bstruct.cpp:466
Bscript::BObjectImp * upper()
Definition: basicmod.cpp:233
int makeString(unsigned param)
Definition: executor.cpp:196
virtual BObjectImp * copy() const =0
virtual u8 typeOfInt() const
Definition: object.cpp:263
Bscript::BObjectImp * mf_PackJSON()
Definition: basicmod.cpp:628
int paramAsLong(unsigned param)
Definition: executor.cpp:240
Bscript::BObjectImp * recurseJ2E(const picojson::value &v)
Definition: basicmod.cpp:635
const char * paramAsString(unsigned param)
Definition: executor.cpp:209
void toUpper(void)
Definition: str.cpp:368
Bscript::BObjectImp * mf_TypeOf()
Definition: basicmod.cpp:553
virtual std::string pack() const
Definition: object.cpp:201
Cont::const_iterator const_iterator
Definition: bobject.h:509
unsigned char buffer[10000]
Definition: UoToolMain.cpp:109
picojson::value recurseE2J(BObjectImp *v)
Definition: basicmod.cpp:569
Bscript::BObjectImp * mf_CStr()
Definition: basicmod.cpp:286
Bscript::BObjectImp * mf_Pack()
Definition: basicmod.cpp:534
static UninitObject * create()
Definition: bobject.h:482
BasicExecutorModule(Bscript::Executor &exec)
Definition: basicmod.cpp:33
static BObjectImp * unpack(const char *pstr)
Definition: object.cpp:120
Bscript::BObjectImp * find()
Definition: basicmod.cpp:61
Bscript::BObjectImp * mf_CAscZ()
Definition: basicmod.cpp:306
Bscript::BObjectImp * mf_SubStrReplace()
Definition: basicmod.cpp:129
String * StrStr(int begin, int len)
Definition: str.cpp:37
Bscript::BObjectImp * mf_CDbl()
Definition: basicmod.cpp:263
Bscript::BObjectImp * mf_UnpackJSON()
Definition: basicmod.cpp:673
Bscript::BObjectImp * mf_CChrZ()
Definition: basicmod.cpp:338
#define ISTRINGSTREAM
Definition: stlutil.h:73
const Contents & contents() const
Definition: dict.cpp:435
const String * getStringParam(unsigned param)
Definition: executor.cpp:347
Bscript::BObjectImp * mf_CChr()
Definition: basicmod.cpp:322
Bscript::BObjectImp * mf_substr()
Definition: basicmod.cpp:73
bool hasParams(unsigned howmany) const
Definition: executor.h:144
virtual size_t sizeEstimate() const =0
void toLower(void)
Definition: str.cpp:376
double value() const
Definition: bobject.h:713
Bscript::BObjectImp * mf_Unpack()
Definition: basicmod.cpp:540
const char * data() const
Definition: impstr.h:66
Bscript::BObjectImp * mf_Bin()
Definition: basicmod.cpp:430
Bscript::BObjectImp * mf_CInt()
Definition: basicmod.cpp:240
Definition: berror.cpp:12
Bscript::BObjectImp * mf_SizeOf()
Definition: basicmod.cpp:558
virtual const char * typeOf() const
Definition: object.cpp:257
Bscript::BObjectImp * mf_CAsc()
Definition: basicmod.cpp:292
size_t length() const
Definition: impstr.h:68
Bscript::BObjectImp * mf_Hex()
Definition: basicmod.cpp:370
BObjectImp * getParamImp(unsigned param)
Definition: executor.cpp:266