EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PyCachedCall Class Reference

#include "CachedObjectMgr.h"

Collaboration diagram for PyCachedCall:

Public Member Functions

 PyCachedCall ()
 
 ~PyCachedCall ()
 
void Dump (FILE *into, const char *pfx, bool contents_too=false)
 
bool Decode (PySubStream **ss)
 
PyCachedCallClone () const
 

Public Attributes

PyRepresult
 

Detailed Description

Definition at line 176 of file CachedObjectMgr.h.

Constructor & Destructor Documentation

PyCachedCall::PyCachedCall ( )

Definition at line 828 of file CachedObjectMgr.cpp.

Referenced by Clone().

828 : result(nullptr) {}

Here is the caller graph for this function:

PyCachedCall::~PyCachedCall ( )

Definition at line 829 of file CachedObjectMgr.cpp.

References PySafeDecRef, and result.

830 {
831  PySafeDecRef( result );
832 }
#define PySafeDecRef(op)
Definition: PyRep.h:61

Member Function Documentation

PyCachedCall * PyCachedCall::Clone ( ) const

Definition at line 834 of file CachedObjectMgr.cpp.

References PyRep::Clone(), PyCachedCall(), and result.

834  {
835  PyCachedCall *res = new PyCachedCall();
836  res->result = result->Clone();
837  return res;
838 }
virtual PyRep * Clone() const =0
Clones object.

Here is the call graph for this function:

bool PyCachedCall::Decode ( PySubStream **  ss)

Definition at line 851 of file CachedObjectMgr.cpp.

References PyDict::begin(), PyRep::Clone(), PyString::content(), PySubStream::decoded(), PySubStream::DecodeData(), PyDict::end(), if(), PyRep::IsDict(), key(), PyDecRef, PySafeDecRef, result, sLog, and PyRep::TypeString().

Referenced by CachedObjectMgr::LoadCachedCall().

852 {
853  PySubStream *ss = *in_ss; //consume
854  *in_ss = nullptr;
855 
856  PySafeDecRef( result );
857 
858  ss->DecodeData();
859  if (ss->decoded() == nullptr) {
860  sLog.Error("PyCachedCall","Unable to decode initial stream for PyCachedCall");
861  PyDecRef( ss );
862  return false;
863  }
864 
865  if (!ss->decoded()->IsDict()) {
866  sLog.Error("PyCachedCall","Cached call substream does not contain a dict: %s", ss->decoded()->TypeString());
867  PyDecRef( ss );
868  return false;
869  }
870  PyDict *po = (PyDict *) ss->decoded();
871 
872  PyDict::const_iterator cur, end;
873  cur = po->begin();
874  end = po->end();
875  for(; cur != end; cur++) {
876  if (!cur->first->IsString())
877  continue;
878  PyString *key = (PyString *) cur->first;
879  if ( key->content() == "lret" )
880  result = cur->second->Clone();
881  }
882 
883  PyDecRef( ss );
884  return (result != nullptr);
885 }
Python string.
Definition: PyRep.h:430
Python's dictionary.
Definition: PyRep.h:719
virtual PyRep * Clone() const =0
Clones object.
PyRep * decoded() const
Definition: PyRep.h:1048
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
void DecodeData() const
Definition: PyRep.cpp:1125
#define PyDecRef(op)
Definition: PyRep.h:57
if(sConfig.world.saveOnMove)
const_iterator begin() const
Definition: PyRep.h:766
bool IsDict() const
Definition: PyRep.h:110
storage_type::const_iterator const_iterator
Definition: PyRep.h:750
const std::string & content() const
Get the PyString content.
Definition: PyRep.h:458
const_iterator end() const
Definition: PyRep.h:767
#define PySafeDecRef(op)
Definition: PyRep.h:61
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type() key(value)-Send an OnRemoteMessage" ) COMMAND( setbpattr
const char * TypeString() const
Definition: PyRep.cpp:76

Here is the call graph for this function:

Here is the caller graph for this function:

void PyCachedCall::Dump ( FILE *  into,
const char *  pfx,
bool  contents_too = false 
)

Definition at line 840 of file CachedObjectMgr.cpp.

References PyRep::Dump(), and result.

841 {
842  std::string s(pfx);
843  s += " ";
844  fprintf(into, "%sCached Call: (empty right now) \n", pfx);
845  if (contents_too) {
846  fprintf(into, "%s Contents:\n", pfx);
847  result->Dump(into, s.c_str());
848  }
849 }
void Dump(FILE *into, const char *pfx) const
Dumps object to file.
Definition: PyRep.cpp:84

Here is the call graph for this function:

Member Data Documentation

PyRep* PyCachedCall::result

Definition at line 198 of file CachedObjectMgr.h.

Referenced by Clone(), Decode(), Dump(), and ~PyCachedCall().


The documentation for this class was generated from the following files: