2002-08-04 18:00:11 +00:00
|
|
|
/** GSWPageDefParserExt.m - <title>GSWeb: Class GSWPageDefParserExt</title>
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2002-08-04 18:00:11 +00:00
|
|
|
Copyright (C) 1999-2002 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
|
|
|
|
Date: Mar 1999
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2002-08-04 18:00:11 +00:00
|
|
|
$Revision$
|
|
|
|
$Date$
|
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
This file is part of the GNUstep Web Library.
|
|
|
|
|
2002-08-04 18:00:11 +00:00
|
|
|
<license>
|
2000-01-22 12:49:49 +00:00
|
|
|
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.
|
2002-08-04 18:00:11 +00:00
|
|
|
</license>
|
|
|
|
**/
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
static char rcsId[] = "$Id$";
|
|
|
|
|
2000-10-30 15:36:50 +00:00
|
|
|
#include <GSWeb/GSWeb.h>
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//====================================================================
|
|
|
|
@implementation GSWPageDefParser (GSWPageDefParserExt)
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(NSDictionary*)elements
|
|
|
|
{
|
|
|
|
return elements;
|
|
|
|
};
|
|
|
|
|
|
|
|
-(NSArray*)includes
|
|
|
|
{
|
|
|
|
return includes;
|
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(void)dealloc
|
|
|
|
{
|
|
|
|
// GSWLogC("Dealloc GSWPageDefParser");
|
|
|
|
// GSWLogC("Dealloc GSWPageDefParser: elements");
|
|
|
|
DESTROY(elements);
|
|
|
|
// GSWLogC("Dealloc GSWPageDefParser: includes");
|
|
|
|
DESTROY(includes);
|
|
|
|
// GSWLogC("Dealloc GSWPageDefParser: errors");
|
|
|
|
DESTROY(errors);
|
|
|
|
// GSWLogC("Dealloc GSWPageDefParser: warnings");
|
|
|
|
DESTROY(warnings);
|
|
|
|
[super dealloc];
|
|
|
|
// GSWLogC("End Dealloc GSWPageDefParser");
|
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-08-04 18:00:11 +00:00
|
|
|
-(void)reportErrorWithException:(NSException*)exception
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-08-04 18:00:11 +00:00
|
|
|
NSString* error=nil;
|
2000-01-22 12:49:49 +00:00
|
|
|
if (!errors)
|
2002-08-04 18:00:11 +00:00
|
|
|
errors=[NSMutableArray new];
|
|
|
|
error=[NSString stringWithFormat:@"Parsing Exception: %@ (Reason:%@)",
|
|
|
|
[exception description],
|
|
|
|
[exception reason]];
|
|
|
|
[errors addObject:error];
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-08-04 18:00:11 +00:00
|
|
|
-(void)reportError:(NSString*)text
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-08-04 18:00:11 +00:00
|
|
|
NSString* error=nil;
|
2000-01-22 12:49:49 +00:00
|
|
|
if (!errors)
|
2002-08-04 18:00:11 +00:00
|
|
|
errors=[NSMutableArray new];
|
|
|
|
error=[NSString stringWithFormat:@"Parsing Error: %@",
|
|
|
|
text];
|
|
|
|
[errors addObject:error];
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-08-04 18:00:11 +00:00
|
|
|
-(void)reportWarning:(NSString*)text
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-08-04 18:00:11 +00:00
|
|
|
NSString* warning=nil;
|
2000-01-22 12:49:49 +00:00
|
|
|
if (!warnings)
|
2002-08-04 18:00:11 +00:00
|
|
|
warnings=[NSMutableArray new];
|
|
|
|
warning=[NSString stringWithFormat:@"Parsing Warning: %@",
|
|
|
|
text];
|
|
|
|
[warnings addObject:warning];
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(BOOL)isError
|
|
|
|
{
|
|
|
|
return ([errors count]>0);
|
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(BOOL)isWarning
|
|
|
|
{
|
|
|
|
return ([warnings count]>0);
|
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(NSArray*)errors
|
|
|
|
{
|
|
|
|
return errors;
|
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(NSArray*)warnings
|
|
|
|
{
|
|
|
|
return warnings;
|
|
|
|
};
|
|
|
|
|
2000-03-16 16:16:49 +00:00
|
|
|
//--------------------------------------------------------------------
|
2002-08-04 18:00:11 +00:00
|
|
|
-(NSString*)unescapedString:(NSString*)aString
|
2000-03-16 16:16:49 +00:00
|
|
|
{
|
|
|
|
//TODO
|
2002-08-04 18:00:11 +00:00
|
|
|
aString=[aString stringByReplacingString:@"\\n"
|
2000-03-16 16:16:49 +00:00
|
|
|
withString:@"\n"];
|
2002-08-04 18:00:11 +00:00
|
|
|
aString=[aString stringByReplacingString:@"\\r"
|
2000-03-16 16:16:49 +00:00
|
|
|
withString:@"\r"];
|
2002-08-04 18:00:11 +00:00
|
|
|
aString=[aString stringByReplacingString:@"\\t"
|
2000-03-16 16:16:49 +00:00
|
|
|
withString:@"\t"];
|
2002-08-04 18:00:11 +00:00
|
|
|
aString=[aString stringByReplacingString:@"\\b"
|
2000-03-16 16:16:49 +00:00
|
|
|
withString:@"\b"];
|
2002-08-04 18:00:11 +00:00
|
|
|
aString=[aString stringByReplacingString:@"\\f"
|
2000-03-16 16:16:49 +00:00
|
|
|
withString:@"\f"];
|
2002-08-04 18:00:11 +00:00
|
|
|
aString=[aString stringByReplacingString:@"\\\""
|
2000-03-16 16:16:49 +00:00
|
|
|
withString:@"\""];
|
2002-08-04 18:00:11 +00:00
|
|
|
aString=[aString stringByReplacingString:@"\\\'"
|
2000-03-16 16:16:49 +00:00
|
|
|
withString:@"\'"];
|
2002-08-04 18:00:11 +00:00
|
|
|
return aString;
|
2000-03-16 16:16:49 +00:00
|
|
|
};
|
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
|