Author Topic: Reverse Engineering C++  (Read 1101 times)

Si Perry

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Reverse Engineering C++
« on: December 18, 2001, 06:42:31 am »
I'm trying to reverse engineer the following code. (Appologies for the length  :-/)

This presents a couple of problems:
  • typedefs - these appear in the generated class as attributes with no name, but type "typedef"
  • virtual XMLDataSource::XMLOPEN_MODE getCurrentOpenMode() = 0;  // returns the open mode type

    This line gets converted to an attribute named XMLOPEN_MODE with a type of XMLDataSource


Does anyone have any suggestions on how I can resolve these issues?

The typedefs are also refered to in sub-classes of this class, and so I would like to resolve the issue in such a way that subclasses will also work correctly.

Code: [Select]
class XMLPROCESSOR_EXPORT XMLDataSource
{
public:
   // the mode in which the stream can be opened
     typedef enum { XML_CLOSED, XML_READ, XML_READBINARY, XML_WRITE, XML_WRITEBINARY, XML_APPEND } XMLOPEN_MODE;
   // The stream type
   typedef enum { XML_SOURCE, XML_SINK, XML_UNSPECIFIED } XMLSTREAM_TYPE;

   // The Mode
   // pegg_m 03-Jan-2001 Added UTF8 mode (For JASDEC/Meridian interface)
   typedef enum {MODE_ASCII, MODE_WCHAR, MODE_UTF8} XMLCHARMODE;

 
   XMLDataSource(XMLCHARMODE mode = MODE_ASCII) : m_Mode(mode) {};
   virtual ~XMLDataSource() {};

   //Data source specific interfaces - All derived data source/sink classes must override these

     virtual bool CanReadData(void)=0;      //New method to allow EOF checking on different data sources
     virtual bool CanWriteData(void)=0;      //New method to allow io checking on different data sinks
     virtual size_t ReadFromDataSource(char *P_Destination, size_t P_NumRequested )=0;
     virtual size_t WriteToDataSink(const char *P_SourceBuffer, size_t P_NumToSend )=0;
     virtual const NovaString GetDataSourceIdentifier(void)=0; //Gets the name of file, or IP/PORT of client etc
   virtual XMLDataSource::XMLOPEN_MODE getCurrentOpenMode() = 0;  // returns the open mode type
     virtual bool open() = 0;
     virtual bool close() = 0;

   // NovaString version of the popular ascii method
   virtual size_t WriteToDataSink(const NovaString &) = 0;


   // legacy code - reference all these to the System Id
   // which could be a path/file name, URI (http:/ftp: etc) or Host Name:Port name string
   // in fact anything which the derrived class can use to identify the data source
   const NovaString getDocName() { return m_strDocName;}
   void setDocName(const NovaString &strName) { m_strDocName = strName; };
   void setSystemId(const NovaString& strSystemId) { m_SystemId = strSystemId; if(m_strDocName == "") m_strDocName = strSystemId; };
   NovaString & getSystemId() { return m_SystemId; }
     
protected:
   NovaString m_SystemId;      // System Identifier - could be filename, TCP host - URI anything
     XMLSTREAM_TYPE m_StreamType; //Input Stream/ output stream
   NovaString m_strDocName;    // name of the document (SystemId OR Root Element Name)

   XMLCHARMODE m_Mode;         // the character mode - ascii or wchar_t

};

sparks

  • EA Administrator
  • EA User
  • *****
  • Posts: 577
  • Karma: +0/-0
    • View Profile
Re: Reverse Engineering C++
« Reply #1 on: December 19, 2001, 02:52:22 am »
Hi,

Typedefs are not handled correctly at the moment - we will add some code to ignore the typedef line in the short term to prevent too many erros on reversing. This will be in the next build. In the longer term, we will be adding support for enums and typedefs early in the new year. The error on the scope resoultion operator '::' we will look into as well. Hope this helps - check back next week for the interim fix and early in January for the other.

Geoff Sparks