/* ** Utilities.h ** ** Copyright (c) 2004 ** ** Author: Yen-Ju ** ** 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 2 of the License, or ** (at your option) any later version. ** ** This program 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 General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __Utilities__ #define __Utilities__ #include #include @class Criterion; /* if newPath == nil, return default one */ NSString *MyLibraryPath(NSString *newPath); void addAvailableSubjectsIntoCriterion (Criterion *criterion); /* Attributes */ NSDictionary *attributesFromFile (NSString *absolutePath); /* decode /xxx/yyy/type */ int orderOfAttributeKey (NSString *key); NSString *categoryOfAttributeKey (NSString *key); NSString *nameOfAttributeKey (NSString *key); NSString *typeOfAttributeKey (NSString *key); NSString *keyOfAttributes (int order, NSString *category, NSString *name, NSString *type); /* Parse string into number and date */ typedef enum _RegExType { RegExStringType, RegExCalendarDateType, RegExIntegerType, RegExFloatNumberType } RegExType; typedef enum _RegExFloatNumber { RegExDotFloatNumber, // -0.99 RegExCommaFloatNumber // -0,99 } RegExFloatNumber; typedef enum _RegExDate { RegExMMDDYYYYDate, RegExDDMMYYYYDate, RegExYYYYMMDDDate } RegExDate; id objectFromRegExParsedString (NSString *string, RegExFloatNumber number, RegExDate date, RegExType *type); #endif /* __Utilities */