// Prescribble reader


#include "prescribble.hpp"
#include <vector>
#include <string>
#include <strstream>


#ifndef USE_EXPAT
#define USE_EXPAT 0
#endif

/**
 * reads in notes from file
 */

class PrescribbleReader {
protected:
    PresNoteConfig &m_config;
    PrescribbleNoteListener *m_pListener;

public:
    typedef std::vector<PrescribbleNote*> NotesVector;

    PrescribbleReader( PresNoteConfig &a_config,
                       PrescribbleNoteListener *a_pListener);

    bool loadInto( const char *filename, NotesVector &a_notes );

};


class PrescribbleXMLReader : public PrescribbleReader {
protected:
    bool m_appending;
    NotesVector *m_pNotes;
    std::string m_strData;
public:
    PrescribbleXMLReader(PresNoteConfig &a_config, PrescribbleNoteListener *a_pListener);

    bool loadInto( const char *filename, NotesVector &a_notes );

    void processStringData();

//    void 
protected:
    static void start_cb(void *userData, 
                         const char *name, const char **atts);
    static void data_cb(void *userData, const char *data, int len);
    static void end_cb(void *userData, const char *name);

};
