home *** CD-ROM | disk | FTP | other *** search
- #ifndef FWPRISTR_H
- #define FWPRISTR_H
- //========================================================================================
- //
- // File: FWPriStr.h
- // Release Version: $ 1.0d1 $
- //
- // Creation Date: 3/25/94
- //
- // Copyright: © 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include <stddef.h>
-
- size_t FW_PrimitiveStringLength(const char * p);
- // Returns the length of string p.
-
- int FW_PrimitiveStringEqual(const char *p1, const char *p2);
- // Compares string p1 to p2. Returns 1 if equal and 0 if false.
-
- char * FW_PrimitiveStringCopy(char *destination, char *source);
- // Copies string source to string destination. Returns source.
-
- char * FW_PrimitiveStringFindCharacter(const char *source, char c);
- // Return pointer to first occurrence of c in source or NULL if not present.
-
- char FW_PrimitiveStringToUpper(char c);
- // Return character c converted to upper case.
-
- char FW_PrimitiveStringToLower(char c);
- // Return character c converted to lower case.
-
- char FW_PrimitiveStringIsSpace(char c);
- // Returns non-zero if character is space, tab, carriage return, or newline.
-
- //========================================================================================
- // FWPriStr.h inlines
- //========================================================================================
-
- inline char FW_PrimitiveStringToUpper(char c)
- {
- #ifdef FW_BUILD_MAC
- if (c >= 'a' && c <= 'z')
- return (c - 'a' + 'A');
- else
- return (c);
- #endif
-
- // Use the standard library version to take advantage of locale information
- #ifdef FW_BUILD_WIN
- return toupper(c);
- #endif
- }
-
-
- inline char FW_PrimitiveStringToLower(char c)
- {
- #ifdef FW_BUILD_MAC
- if (c >= 'A' && c <= 'Z')
- return (c + 'a' - 'A');
- else
- return (c);
- #endif
-
- // Use the standard library version to take advantage of locale information
- #ifdef FW_BUILD_WIN
- return tolower(c);
- #endif
- }
-
- inline char FW_PrimitiveStringIsSpace(char c)
- {
- #ifdef FW_BUILD_MAC
- return ((c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '\f') ? c : 0);
- #endif
-
- // Use the standard library version to take advantage of locale information
- #ifdef FW_BUILD_WIN
- return isspace(c);
- #endif
- }
- #endif