Pol  Revision:cb584c9
xmlfilescrobj.cpp
Go to the documentation of this file.
1 
7 #include "xmlfilescrobj.h"
8 
9 #include <stddef.h>
10 
11 #include "../bscript/berror.h"
12 #include "../bscript/bobject.h"
13 #include "../bscript/bstruct.h"
14 #include "../bscript/executor.h"
15 #include "../bscript/impstr.h"
16 #include "../bscript/objmembers.h"
17 #include "../bscript/objmethods.h"
18 #include "../clib/stlutil.h"
19 #include "../plib/pkg.h"
20 #include "module/fileaccess.h"
21 
22 namespace Pol
23 {
24 namespace Core
25 {
26 using namespace Bscript;
27 BXMLfile::BXMLfile() : Bscript::BObjectImp( OTXMLFile ), file(), _filename( "" ) {}
28 
29 BXMLfile::BXMLfile( std::string filename )
30  : Bscript::BObjectImp( OTXMLFile ), file( filename.c_str() ), _filename( filename )
31 {
32  if ( !file.LoadFile() )
33  return;
34 }
35 
37 
38 BObjectRef BXMLfile::get_member_id( const int /*id*/ ) // id test
39 {
40  return BObjectRef( UninitObject::create() );
41  // switch(id)
42  //{
43 
44  // default: return BObjectRef(UninitObject::create());
45  //}
46 }
47 BObjectRef BXMLfile::get_member( const char* membername )
48 {
49  ObjMember* objmember = getKnownObjMember( membername );
50  if ( objmember != nullptr )
51  return this->get_member_id( objmember->id );
52  else
53  return BObjectRef( UninitObject::create() );
54 }
55 
56 Bscript::BObjectImp* BXMLfile::call_method( const char* methodname, Executor& ex )
57 {
58  ObjMethod* objmethod = getKnownObjMethod( methodname );
59  if ( objmethod != nullptr )
60  return this->call_method_id( objmethod->id, ex );
61  else
62  return nullptr;
63 }
64 
65 Bscript::BObjectImp* BXMLfile::call_method_id( const int id, Executor& ex, bool /*forcebuiltin*/ )
66 {
67  switch ( id )
68  {
69  case MTH_SETDECLARATION:
70  {
71  if ( !ex.hasParams( 3 ) )
72  return new BError( "Not enough parameters" );
73  const String* version;
74  const String* encoding;
75  const String* standalone;
76  if ( ex.getStringParam( 0, version ) && ex.getStringParam( 1, encoding ) &&
77  ex.getStringParam( 2, standalone ) )
78  {
79  TiXmlDeclaration* decl =
80  new TiXmlDeclaration( version->value(), encoding->value(), standalone->value() );
81  if ( !file.NoChildren() ) // in case its not the first method used
82  {
83  if ( file.FirstChild()->Type() == TiXmlNode::TINYXML_DECLARATION )
84  file.RemoveChild( file.FirstChild() ); // remove old declaration
85  if ( !file.NoChildren() )
86  file.InsertBeforeChild( file.FirstChild(), *decl );
87  else
88  file.LinkEndChild( decl );
89  }
90  else
91  file.LinkEndChild( decl );
92  return new BLong( 1 );
93  }
94  break;
95  }
96  case MTH_APPENDNODE:
97  {
98  if ( !ex.hasParams( 1 ) )
99  return new BError( "Not enough parameters" );
100  const String* pstr;
101  if ( ex.getStringParam( 0, pstr ) )
102  {
103  std::unique_ptr<TiXmlElement> elem( new TiXmlElement( pstr->value() ) );
104 
105  if ( ex.hasParams( 2 ) )
106  {
107  BStruct* attr = static_cast<BStruct*>( ex.getParamImp( 1, Bscript::BObjectImp::OTStruct ) );
108  if ( attr )
109  {
110  for ( BStruct::Contents::const_iterator citr = attr->contents().begin(),
111  end = attr->contents().end();
112  citr != end; ++citr )
113  {
114  const std::string& name = ( *citr ).first;
115  Bscript::BObjectImp* ref = ( *citr ).second->impptr();
116  if ( ref->isa( Bscript::BObjectImp::OTLong ) )
117  elem->SetAttribute( name, static_cast<BLong*>( ref )->value() );
118  else if ( ref->isa( Bscript::BObjectImp::OTDouble ) )
119  elem->SetDoubleAttribute( name, static_cast<Double*>( ref )->value() );
120  else
121  elem->SetAttribute( name, ref->getStringRep() );
122  }
123  }
124  }
125 
126  file.LinkEndChild( elem.release() );
127  return new BLong( 1 );
128  }
129  break;
130  }
132  {
133  if ( !ex.hasParams( 1 ) )
134  return new BError( "Not enough parameters" );
135  const String* pstr;
136  if ( ex.getStringParam( 0, pstr ) )
137  {
138  TiXmlComment* comment = new TiXmlComment( pstr->value().c_str() );
139  file.LinkEndChild( comment );
140  return new BLong( 1 );
141  }
142  break;
143  }
144  case MTH_REMOVENODE:
145  {
146  if ( !ex.hasParams( 1 ) )
147  return new BError( "Not enough parameters" );
148  Bscript::BObjectImp* imp = ex.getParamImp( 0 );
149  if ( imp->isa( Bscript::BObjectImp::OTString ) )
150  {
151  const String* pstr = Clib::explicit_cast<String*, Bscript::BObjectImp*>( imp );
152  TiXmlNode* child = file.FirstChild( pstr->value() );
153  if ( child )
154  return new BLong( file.RemoveChild( child ) ? 1 : 0 );
155  else
156  return new BError( "Failed to find node" );
157  }
158  else if ( imp->isa( Bscript::BObjectImp::OTLong ) )
159  {
160  const BLong* keyint = Clib::explicit_cast<BLong*, Bscript::BObjectImp*>( imp );
161  if ( keyint->value() != 1 )
162  return new BError( "Failed to find node" );
163  return new BLong( file.RemoveChild( file.RootElement() ) ? 1 : 0 );
164  }
165  else if ( imp->isa( Bscript::BObjectImp::OTXMLNode ) )
166  {
167  const BXmlNode* pstr = Clib::explicit_cast<BXmlNode*, Bscript::BObjectImp*>( imp );
168  TiXmlNode* node = file.ToElement();
169  if ( node != pstr->getNode()->Parent() )
170  return new BError( "Failed to find node" );
171  return new BLong( file.RemoveChild( pstr->getNode() ) ? 1 : 0 );
172  }
173  break;
174  }
175  case MTH_SAVEXML:
176  {
177  if ( !ex.hasParams( 1 ) )
178  return new BError( "Not enough parameters" );
179  const String* pstr;
180  if ( ex.getStringParam( 0, pstr ) )
181  {
182  const Plib::Package* outpkg;
183  std::string path;
184  if ( !pkgdef_split( pstr->value(), ex.prog()->pkg, &outpkg, &path ) )
185  return new BError( "Error in filename descriptor" );
186 
187  if ( path.find( ".." ) != std::string::npos )
188  return new BError( "No parent path traversal please." );
189 
190  if ( !Module::HasWriteAccess( ex.prog()->pkg, outpkg, path ) )
191  return new BError( "Access denied" );
192 
193  std::string filepath;
194  if ( outpkg == nullptr )
195  filepath = path;
196  else
197  filepath = outpkg->dir() + path;
198 
199  return new BLong( file.SaveFile( filepath ) ? 1 : 0 );
200  }
201  break;
202  }
203  case MTH_XMLTOSTRING:
204  {
205  std::string indent = "\t";
206  if ( ex.hasParams( 1 ) )
207  {
208  const String* pstr;
209  if ( ex.getStringParam( 0, pstr ) )
210  indent = pstr->value();
211  }
212  TiXmlPrinter printer;
213  printer.SetIndent( indent.c_str() );
214 
215  file.Accept( &printer );
216  return new String( printer.CStr() );
217  }
218 
219  default:
220  return nullptr;
221  }
222  return new BError( "Invalid parameter type" );
223 }
224 
226 {
227  return new BXMLfile( _filename );
228 }
229 
230 std::string BXMLfile::getStringRep() const
231 {
232  if ( file.Error() )
233  {
234  OSTRINGSTREAM os;
235  os << file.ErrorRow() << "," << file.ErrorCol() << ":" << file.ErrorDesc();
236  return OSTRINGSTREAM_STR( os );
237  }
238  return _filename;
239 }
240 
241 bool BXMLfile::isTrue() const
242 {
243  return !file.Error();
244 }
245 
247 {
248  if ( obj->isa( OTString ) )
249  {
250  const String* keystr = static_cast<const String*>( obj.impptr() );
251  TiXmlNode* node = file.FirstChild( keystr->value() );
252  if ( node )
253  return BObjectRef( new BXmlNode( node ) );
254  else
255  return BObjectRef( new BError( "Failed to find node" ) );
256  }
257  else if ( obj->isa( OTLong ) )
258  {
259  BLong& keyint = (BLong&)obj.impref();
260  TiXmlHandle handle( &file );
261  TiXmlNode* node = handle.Child( keyint.value() - 1 )
262  .ToNode(); // keep escript 1based index and change it to 0based
263  if ( node )
264  return BObjectRef( new BXmlNode( node ) );
265  else
266  return BObjectRef( new BError( "Failed to find node" ) );
267  }
268  else
269  {
270  return BObjectRef( new BError( "xml members can only be accessed by name or index" ) );
271  }
272 }
273 
274 BObjectRef BXmlNode::get_member_id( const int id ) // id test
275 {
276  switch ( id )
277  {
278  case MBR_ATTRIBUTES:
279  if ( node->ToElement() )
280  return BObjectRef( new BXmlAttribute( node ) );
281  else
282  return BObjectRef( new BError( "No attributes available." ) );
283 
284  case MBR_TYPE:
285  switch ( node->Type() )
286  {
287  case ( TiXmlNode::TINYXML_COMMENT ):
288  return BObjectRef( new String( "XMLComment" ) );
289  case ( TiXmlNode::TINYXML_DECLARATION ):
290  return BObjectRef( new String( "XMLDeclaration" ) );
291  case ( TiXmlNode::TINYXML_DOCUMENT ):
292  return BObjectRef( new String( "XMLDocument" ) );
293  case ( TiXmlNode::TINYXML_ELEMENT ):
294  return BObjectRef( new String( "XMLElement" ) );
295  case ( TiXmlNode::TINYXML_TEXT ):
296  return BObjectRef( new String( "XMLText" ) );
297  case ( TiXmlNode::TINYXML_TYPECOUNT ):
298  return BObjectRef( new String( "XMLTypeCount" ) );
299  case ( TiXmlNode::TINYXML_UNKNOWN ):
300  return BObjectRef( new String( "XMLUnknown" ) );
301  default:
302  return BObjectRef( new String( "XMLUnknown" ) );
303  }
304 
305  default:
306  return BObjectRef( UninitObject::create() );
307  }
308 }
309 BObjectRef BXmlNode::get_member( const char* membername )
310 {
311  ObjMember* objmember = getKnownObjMember( membername );
312  if ( objmember != nullptr )
313  return this->get_member_id( objmember->id );
314  else
315  return BObjectRef( UninitObject::create() );
316 }
317 
318 Bscript::BObjectImp* BXmlNode::call_method( const char* methodname, Executor& ex )
319 {
320  ObjMethod* objmethod = getKnownObjMethod( methodname );
321  if ( objmethod != nullptr )
322  return this->call_method_id( objmethod->id, ex );
323  else
324  return nullptr;
325 }
326 
327 Bscript::BObjectImp* BXmlNode::call_method_id( const int id, Executor& ex, bool /*forcebuiltin*/ )
328 {
329  switch ( id )
330  {
331  case MTH_FIRSTCHILD:
332  {
333  if ( ex.hasParams( 1 ) )
334  {
335  const String* pstr;
336  if ( ex.getStringParam( 0, pstr ) )
337  {
338  TiXmlNode* child = node->FirstChild( pstr->value() );
339  if ( child )
340  return new BXmlNode( child );
341  else
342  return new BError( "Failed to find node" );
343  }
344  return new BError( "Invalid parameter type" );
345  }
346  else
347  {
348  TiXmlNode* child = node->FirstChild();
349  if ( child )
350  return new BXmlNode( child );
351  else
352  return new BError( "Failed to find node" );
353  }
354  break;
355  }
356  case MTH_NEXTSIBLING:
357  {
358  if ( ex.hasParams( 1 ) )
359  {
360  const String* pstr;
361  if ( ex.getStringParam( 0, pstr ) )
362  {
363  TiXmlNode* sibling = node->NextSibling( pstr->value() );
364  if ( sibling )
365  return new BXmlNode( sibling );
366  else
367  return new BError( "Failed to find node" );
368  }
369  }
370  else
371  {
372  TiXmlNode* sibling = node->NextSibling();
373  if ( sibling )
374  return new BXmlNode( sibling );
375  else
376  return new BError( "Failed to find node" );
377  }
378  break;
379  }
380  case MTH_APPENDNODE:
381  {
382  if ( !ex.hasParams( 1 ) )
383  return new BError( "Not enough parameters" );
384  const String* pstr;
385  if ( ex.getStringParam( 0, pstr ) )
386  {
387  std::unique_ptr<TiXmlElement> elem( new TiXmlElement( pstr->value() ) );
388 
389  if ( ex.hasParams( 2 ) )
390  {
391  BStruct* attr = static_cast<BStruct*>( ex.getParamImp( 1, Bscript::BObjectImp::OTStruct ) );
392  if ( attr )
393  {
394  for ( BStruct::Contents::const_iterator citr = attr->contents().begin(),
395  end = attr->contents().end();
396  citr != end; ++citr )
397  {
398  const std::string& name = ( *citr ).first;
399  Bscript::BObjectImp* ref = ( *citr ).second->impptr();
400  if ( ref->isa( Bscript::BObjectImp::OTLong ) )
401  elem->SetAttribute( name, static_cast<BLong*>( ref )->value() );
402  else if ( ref->isa( Bscript::BObjectImp::OTDouble ) )
403  elem->SetDoubleAttribute( name, static_cast<Double*>( ref )->value() );
404  else
405  elem->SetAttribute( name, ref->getStringRep() );
406  }
407  }
408  }
409 
410  TiXmlElement* nodeelem = node->ToElement();
411  nodeelem->LinkEndChild( elem.release() );
412  return new BLong( 1 );
413  }
414  break;
415  }
417  {
418  if ( !ex.hasParams( 1 ) )
419  return new BError( "Not enough parameters" );
420  const String* pstr;
421  if ( ex.getStringParam( 0, pstr ) )
422  {
423  TiXmlComment* comment = new TiXmlComment( pstr->value().c_str() );
424  node->LinkEndChild( comment );
425  return new BLong( 1 );
426  }
427  break;
428  }
429  case MTH_SETATTRIBUTE:
430  {
431  if ( !ex.hasParams( 1 ) )
432  return new BError( "Not enough parameters" );
433  BStruct* attr = static_cast<BStruct*>( ex.getParamImp( 0, Bscript::BObjectImp::OTStruct ) );
434  if ( attr )
435  {
436  TiXmlElement* elem = node->ToElement();
437  for ( BStruct::Contents::const_iterator citr = attr->contents().begin(),
438  end = attr->contents().end();
439  citr != end; ++citr )
440  {
441  const std::string& name = ( *citr ).first;
442  Bscript::BObjectImp* ref = ( *citr ).second->impptr();
443  if ( ref->isa( Bscript::BObjectImp::OTLong ) )
444  elem->SetAttribute( name, static_cast<BLong*>( ref )->value() );
445  else if ( ref->isa( Bscript::BObjectImp::OTDouble ) )
446  elem->SetDoubleAttribute( name, static_cast<Double*>( ref )->value() );
447  else
448  elem->SetAttribute( name, ref->getStringRep() );
449  }
450  return new BLong( 1 );
451  }
452  break;
453  }
454  case MTH_REMOVEATTRIBUTE:
455  {
456  if ( !ex.hasParams( 1 ) )
457  return new BError( "Not enough parameters" );
458  const String* pstr;
459  if ( ex.getStringParam( 0, pstr ) )
460  {
461  TiXmlElement* elem = node->ToElement();
462  elem->RemoveAttribute( pstr->value() );
463  return new BLong( 1 );
464  }
465  break;
466  }
467  case MTH_REMOVENODE:
468  {
469  if ( !ex.hasParams( 1 ) )
470  return new BError( "Not enough parameters" );
471  Bscript::BObjectImp* imp = ex.getParamImp( 0 );
472  if ( imp->isa( Bscript::BObjectImp::OTString ) )
473  {
474  const String* pstr = Clib::explicit_cast<String*, Bscript::BObjectImp*>( imp );
475  TiXmlNode* child = node->FirstChild( pstr->value() );
476  if ( child )
477  return new BLong( node->RemoveChild( child ) ? 1 : 0 );
478  else
479  return new BError( "Failed to find node" );
480  }
481  else if ( imp->isa( Bscript::BObjectImp::OTLong ) )
482  {
483  const BLong* keyint = Clib::explicit_cast<BLong*, Bscript::BObjectImp*>( imp );
484  TiXmlHandle handle( node );
485  TiXmlNode* child = handle.Child( keyint->value() - 1 )
486  .ToNode(); // keep escript 1based index and change it to 0based
487  if ( child )
488  return new BLong( node->RemoveChild( child ) ? 1 : 0 );
489  else
490  return new BError( "Failed to find node" );
491  }
492  else if ( imp->isa( Bscript::BObjectImp::OTXMLNode ) )
493  {
494  const BXmlNode* pstr = Clib::explicit_cast<BXmlNode*, Bscript::BObjectImp*>( imp );
495  if ( node->Parent() != pstr->getNode()->Parent() )
496  return new BError( "Failed to find node" );
497  return new BLong( node->RemoveChild( pstr->getNode() ) ? 1 : 0 );
498  }
499  break;
500  }
501  case MTH_APPENDTEXT:
502  {
503  if ( !ex.hasParams( 1 ) )
504  return new BError( "Not enough parameters" );
505  const String* pstr;
506  if ( ex.getStringParam( 0, pstr ) )
507  {
508  TiXmlElement* elem = node->ToElement();
509  elem->LinkEndChild( new TiXmlText( pstr->value() ) );
510  return new BLong( 1 );
511  }
512  break;
513  }
514  case MTH_CLONENODE:
515  {
516  return copy();
517  }
518  default:
519  return nullptr;
520  }
521  return new BError( "Invalid parameter type" );
522 }
523 
525 {
526  if ( obj->isa( OTString ) )
527  {
528  const String* keystr = static_cast<const String*>( obj.impptr() );
529  TiXmlNode* child = node->FirstChild( keystr->value() );
530  if ( child )
531  return BObjectRef( new BXmlNode( child ) );
532  else
533  return BObjectRef( new BError( "Failed to find node" ) );
534  }
535  else if ( obj->isa( OTLong ) )
536  {
537  BLong& keyint = (BLong&)obj.impref();
538  TiXmlHandle handle( node );
539  TiXmlNode* child = handle.Child( keyint.value() - 1 )
540  .ToNode(); // keep escript 1based index and change it to 0based
541  if ( child )
542  return BObjectRef( new BXmlNode( child ) );
543  else
544  return BObjectRef( new BError( "Failed to find node" ) );
545  }
546  else
547  {
548  return BObjectRef( new BError( "xml members can only be accessed by name or index" ) );
549  }
550 }
551 
552 std::string BXmlNode::getStringRep() const
553 {
554  if ( node->Type() == TiXmlNode::TINYXML_TEXT )
555  return node->ToText()->Value();
556  else if ( node->Type() == TiXmlNode::TINYXML_DECLARATION )
557  {
558  TiXmlDeclaration* dec = node->ToDeclaration();
559  OSTRINGSTREAM os;
560  os << "v:" << dec->Version() << " e:" << dec->Encoding() << " s:" << dec->Standalone();
561  return OSTRINGSTREAM_STR( os );
562  }
563  return node->Value();
564 }
565 
567 {
568  ObjMethod* objmethod = getKnownObjMethod( methodname );
569  if ( objmethod != nullptr )
570  return this->call_method_id( objmethod->id, ex );
571  else
572  return nullptr;
573 }
574 
576  bool /*forcebuiltin*/ )
577 {
578  if ( !node )
579  return nullptr;
580  switch ( id )
581  {
582  case MTH_PROPNAMES:
583  {
584  std::unique_ptr<ObjArray> arr( new ObjArray );
585  TiXmlAttribute* attrib = node->FirstAttribute();
586  while ( attrib )
587  {
588  arr->addElement( new String( attrib->Name() ) );
589  attrib = attrib->Next();
590  }
591  return arr.release();
592  }
593  default:
594  return nullptr;
595  }
596 }
597 
599 {
600  if ( obj->isa( OTString ) )
601  {
602  const String* keystr = static_cast<const String*>( obj.impptr() );
603  const std::string* attrib = node->Attribute( keystr->value() );
604  if ( attrib )
605  return BObjectRef( new String( attrib->c_str() ) );
606  else
607  return BObjectRef( new BError( "Failed to find attribute" ) );
608  }
609  else
610  {
611  return BObjectRef( new BError( "xml attribute can only be accessed by name" ) );
612  }
613 }
614 
616  : // root elements
617  node( nullptr ),
618  _file( file ),
619  _init( false ),
620  m_IterVal( pIter ),
621  m_pIterVal( new BLong( 0 ) )
622 {
623  m_IterVal.get()->setimp( m_pIterVal );
624 }
625 BXMLNodeIterator::BXMLNodeIterator( TiXmlNode* _node, BObject* pIter )
626  : // child elements
627  node( _node ),
628  _file( nullptr ),
629  _init( false ),
630  m_IterVal( pIter ),
631  m_pIterVal( new BLong( 0 ) )
632 {
633  m_IterVal.get()->setimp( m_pIterVal );
634 }
635 
637 {
639  if ( node == nullptr ) // root elements (iter over BXmlFile)
640  node = _file->FirstChild();
641  else if ( _file == nullptr ) // child elements (iter over BXmlNode)
642  {
643  if ( !_init )
644  {
645  _init = true;
646  node = node->FirstChild();
647  }
648  else
649  node = node->NextSiblingElement();
650  }
651  else // root elements (iter over BXmlFile)
652  node = node->NextSibling();
653  if ( !node )
654  return nullptr;
655 
656  return new BObject( new BXmlNode( node ) );
657 }
658 
660  : node( _node ), nodeAttrib( nullptr ), m_IterVal( pIter ), m_pIterVal( new BLong( 0 ) )
661 {
662  m_IterVal.get()->setimp( m_pIterVal );
663 }
664 
666 {
668  if ( !node )
669  return nullptr;
670  if ( nodeAttrib == nullptr )
671  nodeAttrib = node->FirstAttribute();
672  else
673  nodeAttrib = nodeAttrib->Next();
674  if ( nodeAttrib )
675  {
676  std::unique_ptr<BStruct> details( new BStruct() );
677  details->addMember( nodeAttrib->Name(), new String( nodeAttrib->Value() ) );
678  return new BObject( details.release() );
679  }
680  return nullptr;
681 }
682 }
683 }
Bscript::BObjectRef m_IterVal
Definition: xmlfilescrobj.h:42
virtual Bscript::BObjectRef OperSubscript(const Bscript::BObject &obj) POL_OVERRIDE
bool HasWriteAccess(const Plib::Package *pkg, const Plib::Package *filepackage, const std::string &path)
Definition: filemod.cpp:267
virtual Bscript::BObjectImp * call_method(const char *methodname, Bscript::Executor &ex) POL_OVERRIDE
virtual std::string getStringRep() const POL_OVERRIDE
Bscript::BLong * m_pIterVal
Definition: xmlfilescrobj.h:43
virtual std::string getStringRep() const =0
const EScriptProgram * prog() const
Definition: executor.h:423
const std::string & value() const
Definition: impstr.h:67
virtual Bscript::BObjectImp * call_method_id(const int id, Bscript::Executor &ex, bool forcebuiltin=false) POL_OVERRIDE
int value() const
Definition: bobject.h:592
virtual Bscript::BObject * step() POL_OVERRIDE
bool isa(BObjectType type) const
Definition: bobject.h:353
virtual Bscript::BObjectImp * call_method(const char *methodname, Bscript::Executor &ex) POL_OVERRIDE
T * get() const
Definition: refptr.h:176
ObjMember * getKnownObjMember(const char *token)
Definition: parser.cpp:483
virtual Bscript::BObjectRef get_member_id(const int id) POL_OVERRIDE
virtual Bscript::BObjectImp * call_method(const char *methodname, Bscript::Executor &ex) POL_OVERRIDE
const Contents & contents() const
Definition: bstruct.cpp:466
#define OSTRINGSTREAM_STR(x)
Definition: stlutil.h:76
virtual Bscript::BObjectRef OperSubscript(const Bscript::BObject &obj) POL_OVERRIDE
ObjMethod * getKnownObjMethod(const char *token)
Definition: parser.cpp:666
virtual Bscript::BObjectImp * call_method_id(const int id, Bscript::Executor &ex, bool forcebuiltin=false) POL_OVERRIDE
BXMLAttributeIterator(TiXmlElement *node, Bscript::BObject *pIter)
bool pkgdef_split(const std::string &spec, const Package *inpkg, const Package **outpkg, std::string *path)
Definition: pkg.cpp:410
Bscript::BObjectRef m_IterVal
Definition: xmlfilescrobj.h:55
TiXmlDocument file
Definition: xmlfilescrobj.h:87
#define OSTRINGSTREAM
Definition: stlutil.h:75
static UninitObject * create()
Definition: bobject.h:482
virtual Bscript::BObjectRef get_member(const char *membername) POL_OVERRIDE
virtual Bscript::BObject * step() POL_OVERRIDE
virtual Bscript::BObjectImp * copy() const POL_OVERRIDE
BObjectImp * impptr()
Definition: bobject.h:428
virtual bool isTrue() const POL_OVERRIDE
virtual Bscript::BObjectRef OperSubscript(const Bscript::BObject &obj) POL_OVERRIDE
BObjectImp & impref()
Definition: bobject.h:438
Plib::Package const * pkg
Definition: eprog.h:123
virtual Bscript::BObjectImp * call_method_id(const int id, Bscript::Executor &ex, bool forcebuiltin=false) POL_OVERRIDE
virtual std::string getStringRep() const POL_OVERRIDE
const String * getStringParam(unsigned param)
Definition: executor.cpp:347
D explicit_cast(const S &s)
Definition: stlutil.h:40
std::string name
Definition: osmod.cpp:943
bool hasParams(unsigned howmany) const
Definition: executor.h:144
TiXmlNode * getNode() const
BXMLNodeIterator(TiXmlDocument *file, Bscript::BObject *pIter)
std::string _filename
Definition: xmlfilescrobj.h:88
virtual Bscript::BObjectRef get_member_id(const int id) POL_OVERRIDE
Definition: berror.cpp:12
BObjectImp * getParamImp(unsigned param)
Definition: executor.cpp:266
const std::string & dir() const
Definition: pkg.h:79
virtual Bscript::BObjectRef get_member(const char *membername) POL_OVERRIDE