serialize() in C++ ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Papa.Legba.666@gmail.com

    serialize() in C++ ?

    I use a PHP based blog system and am considering writing some offline
    tools.

    Does anyone know of a C++ class or function which can un/serialze()
    data compatibly with PHP ?

    Thanks in advance...

  • Erwin Moller

    #2
    Re: serialize() in C++ ?

    Papa.Legba.666@ gmail.com wrote:
    [color=blue]
    > I use a PHP based blog system and am considering writing some offline
    > tools.
    >
    > Does anyone know of a C++ class or function which can un/serialze()
    > data compatibly with PHP ?
    >
    > Thanks in advance...[/color]


    Hi,

    I am quite unexperienced with C++, but can the PHP sourcefiles help you?

    Download them at www.php.net.

    unpack.
    You'll find files like this:

    ../php-5.0.4/ext/standard/tests/serialize
    ../php-5.0.4/ext/standard/var_unserialize r.re
    ../php-5.0.4/ext/standard/var_unserialize r.c
    ../php-5.0.4/ext/standard/var_unserialize r.c.orig

    They contain a lot of C-code that might be of help. :-)

    Here is a small piece.
    They all start with including other files, you maybe you have puzzle a bit
    to satify dependencies...
    Maybe not. What do I know of C?

    Regards,
    Erwin Moller

    ---------------------------

    /* $Id: var_unserialize r.c,v 1.38.2.13 2005/03/10 01:58:13 helly Exp $ */

    #include "php.h"
    #include "ext/standard/php_var.h"
    #include "php_incomplete _class.h"

    /* {{{ reference-handling for unserializer: var_* */
    #define VAR_ENTRIES_MAX 1024

    typedef struct {
    zval *data[VAR_ENTRIES_MAX];
    long used_slots;
    void *next;
    } var_entries;

    static inline void var_push(php_un serialize_data_ t *var_hashx, zval **rval)
    {

    etc
    -------------------------

    Comment

    Working...