libsf3
Loading...
Searching...
No Matches
sf3.h
Go to the documentation of this file.
1#ifndef __SF3__
2#define __SF3__
3#include "sf3_archive.h"
4#include "sf3_audio.h"
5#include "sf3_image.h"
6#include "sf3_log.h"
7#include "sf3_model.h"
8#include "sf3_physics_model.h"
9#include "sf3_table.h"
10#include "sf3_text.h"
11#include "sf3_vector_graphic.h"
12
15SF3_EXPORT size_t sf3_size(const struct sf3_identifier *identifier){
16 switch(identifier->format_id){
18 return sf3_archive_size((struct sf3_archive *)identifier);
20 return sf3_audio_size((struct sf3_audio *)identifier);
22 return sf3_image_size((struct sf3_image *)identifier);
24 return sf3_log_size((struct sf3_log *)identifier);
26 return sf3_model_size((struct sf3_model *)identifier);
28 return sf3_physics_model_size((struct sf3_physics_model *)identifier);
30 return sf3_table_size((struct sf3_table *)identifier);
32 return sf3_text_size((struct sf3_text *)identifier);
34 return sf3_vector_graphic_size((struct sf3_vector_graphic *)identifier);
35 default:
36 return 0;
37 }
38}
39
41SF3_EXPORT char *sf3_kind(int type){
42 switch(type){
44 return "Archive";
46 return "Audio";
48 return "Image";
50 return "Log";
52 return "Model";
54 return "Physics Model";
56 return "Table";
58 return "Text";
60 return "Vector Graphic";
61 default:
62 return "Unknown";
63 }
64}
65
67SF3_EXPORT char *sf3_file_type(int type){
68 switch(type){
70 return "ar.sf3";
72 return "au.sf3";
74 return "img.sf3";
76 return "log.sf3";
78 return "mod.sf3";
80 return "phys.sf3";
82 return "tab.sf3";
84 return "txt.sf3";
86 return "vec.sf3";
87 default:
88 return "sf3";
89 }
90}
91
93SF3_EXPORT char *sf3_mime_type(int type){
94 switch(type){
96 return "application/x.sf3-archive";
98 return "audio/x.sf3";
100 return "image/x.sf3";
102 return "application/x.sf3-log";
104 return "model/x.sf3";
106 return "model/x.sf3-physics";
108 return "application/x.sf3-table";
110 return "application/x.sf3-text";
112 return "image/x.sf3-vector";
113 default:
114 return "application/x.sf3";
115 }
116}
117#endif
SF3_EXPORT char * sf3_kind(int type)
Returns a human-readable string description of the SF3 format_id.
Definition sf3.h:41
SF3_EXPORT char * sf3_file_type(int type)
Returns the standard file type suffix for the given SF3 format_id.
Definition sf3.h:67
SF3_EXPORT char * sf3_mime_type(int type)
Returns the standard media mime-type for the given SF3 format_id.
Definition sf3.h:93
#define SF3_FORMAT_ID_ARCHIVE
The format_id for an archive file.
Definition sf3_archive.h:6
SF3_EXPORT size_t sf3_archive_size(const struct sf3_archive *archive)
Computes the size of the archive file in bytes.
Definition sf3_archive.h:80
SF3_EXPORT size_t sf3_audio_size(const struct sf3_audio *audio)
Computes the size of the audio file in bytes.
Definition sf3_audio.h:93
#define SF3_FORMAT_ID_AUDIO
The format_id for an audio file.
Definition sf3_audio.h:6
#define SF3_EXPORT
Definition sf3_core.h:13
#define SF3_FORMAT_ID_IMAGE
The format_id for an image file.
Definition sf3_image.h:6
SF3_EXPORT size_t sf3_image_size(const struct sf3_image *image)
Computes the size of the image file in bytes.
Definition sf3_image.h:140
SF3_EXPORT size_t sf3_log_size(const struct sf3_log *log)
Computes the size of the log file in bytes.
Definition sf3_log.h:103
#define SF3_FORMAT_ID_LOG
The format_id for a log file.
Definition sf3_log.h:6
SF3_EXPORT size_t sf3_model_size(const struct sf3_model *model)
Computes the size of the model file in bytes.
Definition sf3_model.h:170
#define SF3_FORMAT_ID_MODEL
The format_id for a model file.
Definition sf3_model.h:6
SF3_EXPORT size_t sf3_physics_model_size(const struct sf3_physics_model *physics_model)
Computes the size of the physics model file in bytes.
#define SF3_FORMAT_ID_PHYSICS_MODEL
The format_id for a physics model file.
#define SF3_FORMAT_ID_TABLE
The format_id for a table file.
Definition sf3_table.h:6
SF3_EXPORT size_t sf3_table_size(const struct sf3_table *table)
Computes the size of the table file in bytes.
Definition sf3_table.h:164
#define SF3_FORMAT_ID_TEXT
The format_id for a text file.
Definition sf3_text.h:6
SF3_EXPORT size_t sf3_text_size(const struct sf3_text *text)
Computes the size of the text file in bytes.
Definition sf3_text.h:165
#define SF3_FORMAT_ID_VECTOR_GRAPHIC
The format_id for a vector graphic file.
SF3_EXPORT size_t sf3_vector_graphic_size(const struct sf3_vector_graphic *vector_graphic)
Computes the size of the vector graphic file in bytes.
The basic header structure of every SF3 file.
Definition sf3_core.h:70
sf3_format_id format_id
The ID of the actual file type contained within.
Definition sf3_core.h:74
Description of an extent on the canvas.