Kohi Game Engine
kpackage.h File Reference
#include "defines.h"
#include "strings/kname.h"

Go to the source code of this file.

Data Structures

struct  asset_manifest_asset
 
struct  asset_manifest_reference
 A reference to another package in an asset manifest. More...
 
struct  asset_manifest
 
struct  kpackage
 

Typedefs

typedef struct asset_manifest_asset asset_manifest_asset
 
typedef struct asset_manifest_reference asset_manifest_reference
 A reference to another package in an asset manifest. More...
 
typedef struct asset_manifest asset_manifest
 
typedef struct kpackage kpackage
 
typedef enum kpackage_result kpackage_result
 

Enumerations

enum  kpackage_result { KPACKAGE_RESULT_SUCCESS = 0 , KPACKAGE_RESULT_ASSET_GET_FAILURE , KPACKAGE_RESULT_INTERNAL_FAILURE }
 

Functions

KAPI b8 kpackage_create_from_manifest (const asset_manifest *manifest, kpackage *out_package)
 
KAPI b8 kpackage_create_from_binary (u64 size, void *bytes, kpackage *out_package)
 
KAPI void kpackage_destroy (kpackage *package)
 
KAPI kpackage_result kpackage_asset_bytes_get (const kpackage *package, kname name, u64 *out_size, const void **out_data)
 
KAPI kpackage_result kpackage_asset_text_get (const kpackage *package, kname name, u64 *out_size, const char **out_text)
 
KAPI const char * kpackage_path_for_asset (const kpackage *package, kname name)
 
KAPI const char * kpackage_source_path_for_asset (const kpackage *package, kname name)
 
KAPI b8 kpackage_asset_bytes_write (kpackage *package, kname name, u64 size, const void *bytes)
 
KAPI b8 kpackage_asset_text_write (kpackage *package, kname name, u64 size, const char *text)
 
KAPI b8 kpackage_parse_manifest_file_content (const char *path, asset_manifest *out_manifest)
 
KAPI void kpackage_manifest_destroy (asset_manifest *manifest)
 

Typedef Documentation

◆ asset_manifest

◆ asset_manifest_asset

◆ asset_manifest_reference

A reference to another package in an asset manifest.

◆ kpackage

typedef struct kpackage kpackage

◆ kpackage_result

Enumeration Type Documentation

◆ kpackage_result

Enumerator
KPACKAGE_RESULT_SUCCESS 
KPACKAGE_RESULT_ASSET_GET_FAILURE 
KPACKAGE_RESULT_INTERNAL_FAILURE 

Function Documentation

◆ kpackage_asset_bytes_get()

KAPI kpackage_result kpackage_asset_bytes_get ( const kpackage package,
kname  name,
u64 out_size,
const void **  out_data 
)

◆ kpackage_asset_bytes_write()

KAPI b8 kpackage_asset_bytes_write ( kpackage package,
kname  name,
u64  size,
const void *  bytes 
)

◆ kpackage_asset_text_get()

KAPI kpackage_result kpackage_asset_text_get ( const kpackage package,
kname  name,
u64 out_size,
const char **  out_text 
)

◆ kpackage_asset_text_write()

KAPI b8 kpackage_asset_text_write ( kpackage package,
kname  name,
u64  size,
const char *  text 
)

◆ kpackage_create_from_binary()

KAPI b8 kpackage_create_from_binary ( u64  size,
void *  bytes,
kpackage out_package 
)

◆ kpackage_create_from_manifest()

KAPI b8 kpackage_create_from_manifest ( const asset_manifest manifest,
kpackage out_package 
)

◆ kpackage_destroy()

KAPI void kpackage_destroy ( kpackage package)

◆ kpackage_manifest_destroy()

KAPI void kpackage_manifest_destroy ( asset_manifest manifest)

◆ kpackage_parse_manifest_file_content()

KAPI b8 kpackage_parse_manifest_file_content ( const char *  path,
asset_manifest out_manifest 
)

◆ kpackage_path_for_asset()

KAPI const char* kpackage_path_for_asset ( const kpackage package,
kname  name 
)

Attempts to retrieve the path string for the given asset within the provided package. NOTE: If found, returns a copy of the string (dynamically allocated) which must be freed by the caller.

Parameters
packageA constant pointer to the package to search.
nameThe name of the asset to search for.
Returns
A copy of the path string, if found. Otherwise 0/null.

◆ kpackage_source_path_for_asset()

KAPI const char* kpackage_source_path_for_asset ( const kpackage package,
kname  name 
)

Attempts to retrieve the source path string for the given asset within the provided package. NOTE: If found, returns a copy of the string (dynamically allocated) which must be freed by the caller.

Parameters
packageA constant pointer to the package to search.
nameThe name of the asset to search for.
Returns
A copy of the source path string, if found. Otherwise 0/null.