* GSWeb.framework/GSWImageInfo.h/m: New files.

* GSWeb.framework/GNUmakefile: Include new files.
	* GSWeb.framework/GSWWOCompatibility.h: Include new files.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@28179 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
ayers 2009-04-05 12:11:55 +00:00
parent aaf9e3a406
commit 28ee860614
5 changed files with 213 additions and 5 deletions

View file

@ -1,4 +1,10 @@
2008-10-24 David Ayers <ayers@fsfe.org>
2009-04-05 David Ayers <ayers@fsfe.org>
* GSWeb.framework/GSWImageInfo.h/m: New files.
* GSWeb.framework/GNUmakefile: Include new files.
* GSWeb.framework/GSWWOCompatibility.h: Include new files.
2008-10-24 David Ayers <ayers@fsfe.org>
* GSWeb.framework/GSWDisplayGroup.h (HAVE_GDL2):
Remove fallback to obsolete gnustep-db and default
@ -9,22 +15,22 @@
(NSStringWithObject): Remove special NSNull handling as
EONull must always map to NSNull anyway.
2008-08-28 David Wetzel <dave@turbocat.de>
2008-08-28 David Wetzel <dave@turbocat.de>
* bug #24006 keep-alive is not implemented.
announce close connections for now
2008-08-20 David Wetzel <dave@turbocat.de>
2008-08-20 David Wetzel <dave@turbocat.de>
* GSWeb.framework:
fixed many warnings
2008-07-14 David Wetzel <dave@turbocat.de>
2008-07-14 David Wetzel <dave@turbocat.de>
* GSWeb.framework/GSWDirectActionRequestHandler.m:
set status code in generateNullResponse, reformat, remove some logs
2008-04-20 David Wetzel <dave@turbocat.de>
2008-04-20 David Wetzel <dave@turbocat.de>
* GSWeb.framework/GSWApplication.m,
* GSWeb.framework/GSWComponentRequestHandler.m,

View file

@ -142,6 +142,7 @@ GSWHiddenField.m \
GSWHyperlink.m \
GSWImage.m \
GSWImageButton.m \
GSWImageInfo.m \
GSWJavaScript.m \
GSWNestedList.m \
GSWParam.m \
@ -256,6 +257,7 @@ GSWHiddenField.h \
GSWHyperlink.h \
GSWImage.h \
GSWImageButton.h \
GSWImageInfo.h \
GSWInput.h \
GSWJavaScript.h \
GSWKeyValueAssociation.h \

View file

@ -0,0 +1,56 @@
/** GSWImageInfo.h - <title>GSWeb: Class GSWImageInfo</title>
Copyright (C) 2009 Free Software Foundation, Inc.
Written by: David Ayers <ayers@fsfe.org>
Date: April 2009
$Revision: 26815 $
$Date: 2009-04-05 13:00:10 +0200$
This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</license>
**/
// $Id: GSWImageInfo.h 26815 2009-04-05 13:00:10Z ayers $
#ifndef _GSWImageInfo_h__
#define _GSWImageInfo_h__
@interface GSWImageInfo: NSObject
{
unsigned int _width;
unsigned int _height;
NSString * _widthString;
NSString * _heightString;
}
+ (GSWImageInfo *)imageInfoWithFile: (NSString*)filename;
+ (NSArray *)supportedExtensions;
+ (BOOL)isSupportedExtension:(NSString *)extenstion;
+ (BOOL)pathHasSupportedExtension:(NSString *)extenstion;
+ (Class)subclassForExtension:(NSString *)extenstion;
- (unsigned int)width;
- (unsigned int)height;
- (NSString*)widthString;
- (NSString*)heightString;
@end
#endif //_GSWImageInfo_h__

View file

@ -0,0 +1,140 @@
/** GSWImageInfo.m - <title>GSWeb: Class GSWImageInfo</title>
Copyright (C) 2009 Free Software Foundation, Inc.
Written by: David Ayers <ayers@fsfe.org>
Date: April 2009
$Revision: 26815 $
$Date: 2009-04-05 13:00:10 +0200$
This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</license>
**/
#include "config.h"
RCS_ID("$Id: GSWImageInfo.m 25027 2009-04-05 13:00:10Z ayers $")
#include "GSWeb.h"
@interface GSWJpegImageInfo : GSWImageInfo
-(id)initWithContentsOfFile: (NSString *)path;
@end
@interface GSWGifImageInfo : GSWImageInfo
-(id)initWithContentsOfFile: (NSString *)path;
@end
@interface GSWPngImageInfo : GSWImageInfo
-(id)initWithContentsOfFile: (NSString *)path;
@end
@implementation GSWJpegImageInfo
-(id)initWithContentsOfFile: (NSString *)path
{
NSEmitTODO();
DESTROY(self);
return self;
}
@end
@implementation GSWGifImageInfo
-(id)initWithContentsOfFile: (NSString *)path
{
NSEmitTODO();
DESTROY(self);
return self;
}
@end
@implementation GSWPngImageInfo
-(id)initWithContentsOfFile: (NSString *)path
{
NSEmitTODO();
DESTROY(self);
return self;
}
@end
@implementation GSWImageInfo
static NSArray *supportedExtensions = nil;
+ (void)initialize
{
extensionClassDict
= [[NSDictionary alloc]initWithObjectsAndKeys:
[GSWJpegImageInfo class], @"jpg",
[GSWJpegImageInfo class], @"jpeg",
[GSWGifImageInfo class], @"gif",
[GSWPngImageInfo class], @"png",
nil];
}
+ (GSWImageInfo *)imageInfoWithFile: (NSString*)filename
{
NSString *extension = [filename pathExtension];
Class cls = [self subclassForExtension: extension];
return [[cls alloc] initWithContentsOfFile: filename];
}
+ (NSArray *)supportedExtensions
{
return [extensionClassDict allKeys];
}
+ (BOOL)isSupportedExtension:(NSString *)extension
{
return [extensionClassDict objectForKey: extension] ? YES : NO;
}
+ (BOOL)pathHasSupportedExtension:(NSString *)path
{
NSString *extension = [filename pathExtension];
return [extensionClassDict objectForKey: extension] ? YES : NO;
}
+ (Class)subclassForExtension:(NSString *)extension
{
return [extensionClassDict objectForKey: extension];
}
- (unsigned int)width
{
return _width;
}
- (unsigned int)height
{
return _height;
}
- (NSString*)widthString
{
if (!_widthString)
{
_widthString = [[NSString alloc] initWithFormat:@"%u",_width];
}
return _widthString;
}
- (NSString*)heightString
{
if (!_heightString)
{
_heightString = [[NSString alloc] initWithFormat:@"%u",_height];
}
return _heightString;
}
- (void)dealloc
{
DESTROY(_widthString);
DESTROY(_heightString);
[super dealloc];
}
@end

View file

@ -90,6 +90,10 @@
#define GSWStats WOStats
#define GSWTransactionRecord WOTransactionRecord
#define GSWDefaultAdaptor WODefaultAdaptor
#define GSWImageInfo WOImageInfo
#define GSWJpegImageInfo WOJpegImageInfo
#define GSWGifImageInfo WOGifImageInfo
#define GSWPngImageInfo WOPngImageInfo
/* Dynamic Elements */