Initial commit
This commit is contained in:
97
application/target/mimeTypes.c
Normal file
97
application/target/mimeTypes.c
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* This file is automaticaly generated, Please dont edit this file!
|
||||
*/
|
||||
#include <mimeTypes.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void mimeTypes_constructor( mimeTypes * this ) {
|
||||
|
||||
mimeTypes_add( this, "html", "text/html");
|
||||
|
||||
mimeTypes_add( this, "css", "text/css");
|
||||
|
||||
mimeTypes_add( this, "ttf", "application/x-font-ttf");
|
||||
|
||||
mimeTypes_add( this, "png", "image/png");
|
||||
|
||||
mimeTypes_add( this, "svg", "image/svg+xml");
|
||||
|
||||
}
|
||||
|
||||
void mimeTypes_add( mimeTypes * this, char * extension, char * mimeType ) {
|
||||
|
||||
struct array * extensions = this->extensions;
|
||||
|
||||
array_add( extensions, extension );
|
||||
|
||||
|
||||
struct array * mimeTypes = this->mimeTypes;
|
||||
|
||||
array_add( mimeTypes, mimeType );
|
||||
|
||||
}
|
||||
|
||||
char * mimeTypes_getByExtension( mimeTypes * this, char * extension ) {
|
||||
|
||||
struct array * extensions = this->extensions;
|
||||
|
||||
struct array * mimeTypes = this->mimeTypes;
|
||||
|
||||
int count = array_length( extensions );
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
|
||||
char * currentExtension = array_get( extensions, i );
|
||||
|
||||
if( char_operator_compare( currentExtension , extension) ) {
|
||||
|
||||
char * mimeType = array_get( mimeTypes, i );
|
||||
|
||||
return mimeType;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return "no-mimetype";
|
||||
|
||||
}
|
||||
|
||||
mimeTypes mimeTypes_new() {
|
||||
|
||||
mimeTypes instance;
|
||||
|
||||
instance.__classIndex = 17;
|
||||
|
||||
instance.extensions = array_newPointer();
|
||||
|
||||
instance.mimeTypes = array_newPointer();
|
||||
|
||||
mimeTypes_constructor( &instance);
|
||||
|
||||
return instance;
|
||||
|
||||
}
|
||||
|
||||
mimeTypes * mimeTypes_newPointer() {
|
||||
|
||||
struct mimeTypes * pointer = malloc( sizeof ( struct mimeTypes ) );
|
||||
|
||||
pointer->__classIndex = 17;
|
||||
|
||||
pointer->extensions = array_newPointer();
|
||||
|
||||
pointer->mimeTypes = array_newPointer();
|
||||
|
||||
mimeTypes_constructor( pointer );
|
||||
|
||||
return pointer;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user