Program Listing for File handle.h

Return to documentation for file (wyrd/handle.h)

/*
 * This file is part of wyrd.
 *
 * Author(s): Jens Finkhaeuser <jens@finkhaeuser.de>
 *
 * Copyright (c) 2023 Interpeer gUG (haftungsbeschränkt)
 *
 * SPDX-License-Identifier: GPL-3.0-only
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef WYRD_HANDLE_H
#define WYRD_HANDLE_H

#include <wyrd.h>

#include <wyrd/api.h>

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus

struct wyrd_handle;

typedef enum {
  WYRD_O_NONE         = 0x00,
  WYRD_O_READ         = 0x01,
  WYRD_O_WRITE        = 0x02,
  WYRD_O_RW           = WYRD_O_READ | WYRD_O_WRITE,
  WYRD_O_CREATE       = 0x04,
  WYRD_O_SKIP_UNKNOWN = 0x08,
} wyrd_open_flags;


WYRD_API wyrd_error_t
wyrd_open_file(struct wyrd_api * api, struct wyrd_handle ** handle,
    char const * filename, int flags);

WYRD_API wyrd_error_t
wyrd_open_resource(struct wyrd_api * api, struct wyrd_handle ** handle,
    char const * identifier, int flags);

typedef enum {
  WYRD_RO_AUTHOR      = 1,
  WYRD_RO_ALGORITHMS  = 2,
} wyrd_resource_options;


WYRD_API wyrd_error_t
wyrd_set_resource_option(struct wyrd_handle * handle,
    wyrd_resource_options option, void * value);

WYRD_API wyrd_error_t
wyrd_close(struct wyrd_handle ** handle);


#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

#endif // guard