Sha256: 8163e1b370395030ec1daef639a0dee9ff687e76d4b4b42374af4989fe91f2ff

Contents?: true

Size: 1.19 KB

Versions: 8

Compression:

Stored size: 1.19 KB

Contents

//
// MessagePack for C++ FILE* buffer adaptor
//
// Copyright (C) 2013 Vladimir Volodko
//
//    Distributed under the Boost Software License, Version 1.0.
//    (See accompanying file LICENSE_1_0.txt or copy at
//    http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_FBUFFER_HPP__
#define MSGPACK_FBUFFER_HPP__

#include "msgpack/versioning.hpp"

#include <cstdio>
#include <stdexcept>

namespace msgpack {

/// @cond
MSGPACK_API_VERSION_NAMESPACE(v1) {
/// @endcond

class fbuffer {
public:
    explicit fbuffer(FILE* file) : m_file(file) { }

public:
    void write(const char* buf, unsigned int len)
    {
        if (1 != fwrite(buf, len, 1, m_file)) {
            throw std::runtime_error("fwrite() failed");
        }
    }

    FILE* file() const
    {
        return m_file;
    }

#if defined(MSGPACK_USE_CPP03)
private:
    fbuffer(const fbuffer&);
    fbuffer& operator=(const fbuffer&);
#else  // defined(MSGPACK_USE_CPP03)
    fbuffer(const fbuffer&) = delete;
    fbuffer& operator=(const fbuffer&) = delete;
#endif // defined(MSGPACK_USE_CPP03)

private:
    FILE* m_file;
};

/// @cond
}  // MSGPACK_API_VERSION_NAMESPACE(v1)
/// @endcond

}  // namespace msgpack

#endif /* msgpack/fbuffer.hpp */

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rroonga-6.0.5-x64-mingw32 vendor/local/include/msgpack/fbuffer.hpp
rroonga-6.0.5-x86-mingw32 vendor/local/include/msgpack/fbuffer.hpp
rroonga-6.0.4-x86-mingw32 vendor/local/include/msgpack/fbuffer.hpp
rroonga-6.0.4-x64-mingw32 vendor/local/include/msgpack/fbuffer.hpp
rroonga-6.0.2-x64-mingw32 vendor/local/include/msgpack/fbuffer.hpp
rroonga-6.0.2-x86-mingw32 vendor/local/include/msgpack/fbuffer.hpp
rroonga-6.0.0-x64-mingw32 vendor/local/include/msgpack/fbuffer.hpp
rroonga-6.0.0-x86-mingw32 vendor/local/include/msgpack/fbuffer.hpp