/* common/KMInputStream.h
 *
 * Copyright (C) 2023 OpenKylin, Inc
 */

#ifndef __KMINPUTSTREAM_H__
#define __KMINPUTSTREAM_H__

#include <gio/gio.h>
#include <string>
#include <memory>

#include "KMFile.h"

/**
 * @brief : 对GFileInputStream的简单封装。打开一个文件进行读取。可用于读取文件的内容。
 */ 
class KMInputStream
{
public: 
    KMInputStream();
    KMInputStream(KMFile& file);
    KMInputStream(GInputStream* input);
    ~KMInputStream();

    KMInputStream& operator=(const KMInputStream& other);
    KMInputStream& operator=(GInputStream* input);

    operator bool() const { return d.operator bool(); }

    GInputStream* get();

private:
    class Private;
    std::shared_ptr<Private> d = nullptr;
};

#endif // !__KMINPUTSTREAM_H__

