/* StringsFile Copyright (C) 2002 Free Software Foundation, Inc. Written by: Alexander Malmberg Created: 2002 This file is part of the GNUstep Project This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. You should have received a copy of the GNU General Public License along with this program; see the file COPYINGv3. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #import "common.h" #import "Foundation/NSString.h" #import "Foundation/NSArray.h" #import "Foundation/NSFileManager.h" #import "Foundation/NSDate.h" #include "StringsFile.h" #include "StringsEntry.h" #include "SourceEntry.h" #include "make_strings.h" static NSString *parse_string(NSString **ptr) { NSString *str=*ptr; NSString *ret; int i,c; unichar ch; c=[str length]; for (i=0;i" @implementation StringsFile -(BOOL) isTranslated: (NSString *)key { return [keys_translated containsObject: key]; } -(void) addTranslated: (NSString *)key { if (![self isTranslated: key]) [keys_translated addObject: key]; } -(BOOL) isMatched: (NSString *)key { return [keys_matched containsObject: key]; } -(void) addMatched: (NSString *)key { if (![self isMatched: key]) [keys_matched addObject: key]; } - init { self=[super init]; strings=[[NSMutableArray alloc] init]; keys_translated=[[NSMutableArray alloc] init]; keys_matched=[[NSMutableArray alloc] init]; return self; } -(void) dealloc { DESTROY(global_comment); DESTROY(strings); [super dealloc]; } - initWithFile: (NSString *)filename { NSString *str; self=[self init]; str=[NSString stringWithContentsOfFile: filename]; if (!str) return self; { StringsEntry *se=nil; NSMutableArray *update_list=[[NSMutableArray alloc] init]; NSArray *lines; NSString *l; int i,c,pos; NSMutableDictionary *dummy_entries=[[NSMutableDictionary alloc] init]; NSMutableString *user_comment=[[NSMutableString alloc] init]; NSString *key,*trans; /* this is a bit yucky, but it works */ lines=[str componentsSeparatedByString: @"/*"]; c=[lines count]; for (i=0;i