OpenCores
URL https://opencores.org/ocsvn/lxp32/lxp32/trunk

Subversion Repositories lxp32

[/] [lxp32/] [trunk/] [tools/] [src/] [lxp32asm/] [outputwriter.h] - Diff between revs 2 and 6

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 6
Line 17... Line 17...
/*
/*
 * An abstract base class for all writers
 * An abstract base class for all writers
 */
 */
 
 
class OutputWriter {
class OutputWriter {
 
        std::size_t _size=0;
public:
public:
        virtual ~OutputWriter() {}
        virtual ~OutputWriter() {}
        virtual void write(const char *data,std::size_t n)=0;
        virtual void write(const char *data,std::size_t n);
        virtual void abort() {}
        virtual void abort() {}
        void pad(std::size_t size);
        void pad(std::size_t size);
 
        std::size_t size() const;
 
protected:
 
        virtual void writeData(const char *data,std::size_t n)=0;
};
};
 
 
/*
/*
 * Write a regular binary file
 * Write a regular binary file
 */
 */
Line 33... Line 37...
class BinaryOutputWriter : public OutputWriter {
class BinaryOutputWriter : public OutputWriter {
        std::string _filename;
        std::string _filename;
        std::ofstream _os;
        std::ofstream _os;
public:
public:
        BinaryOutputWriter(const std::string &filename);
        BinaryOutputWriter(const std::string &filename);
        virtual void write(const char *data,std::size_t n) override;
 
        virtual void abort() override;
        virtual void abort() override;
 
protected:
 
        virtual void writeData(const char *data,std::size_t n) override;
};
};
 
 
/*
/*
 * Write a text file (one word per line)
 * Write a text file (one word per line)
 */
 */
Line 52... Line 57...
        std::string _buf;
        std::string _buf;
        Format _fmt;
        Format _fmt;
public:
public:
        TextOutputWriter(const std::string &filename,Format f);
        TextOutputWriter(const std::string &filename,Format f);
        ~TextOutputWriter();
        ~TextOutputWriter();
        virtual void write(const char *data,std::size_t n) override;
 
        virtual void abort() override;
        virtual void abort() override;
 
protected:
 
        virtual void writeData(const char *data,std::size_t n) override;
};
};
 
 
#endif
#endif
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.