OpenSSL  1.0.1c
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
CPStringUtils.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6 
7 void CopyPStrToCStr(const unsigned char *thePStr,char *theCStr,const int maxCStrLength);
8 void CopyPStrToPStr(const unsigned char *theSrcPStr,unsigned char *theDstPStr,const int maxDstStrLength);
9 void CopyCStrToCStr(const char *theSrcCStr,char *theDstCStr,const int maxDstStrLength);
10 void CopyCStrToPStr(const char *theSrcCStr,unsigned char *theDstPStr,const int maxDstStrLength);
11 void ConcatPStrToCStr(const unsigned char *thePStr,char *theCStr,const int maxCStrLength);
12 void ConcatPStrToPStr(const unsigned char *theSrcPStr,unsigned char *theDstPStr,const int maxDstStrLength);
13 void ConcatCStrToPStr(const char *theSrcCStr,unsigned char *theDstPStr,const int maxDstStrLength);
14 void ConcatCStrToCStr(const char *theSrcCStr,char *theDstCStr,const int maxCStrLength);
15 
16 void ConcatCharToCStr(const char theChar,char *theDstCStr,const int maxCStrLength);
17 void ConcatCharToPStr(const char theChar,unsigned char *theDstPStr,const int maxPStrLength);
18 
19 int ComparePStrs(const unsigned char *theFirstPStr,const unsigned char *theSecondPStr,const Boolean ignoreCase = true);
20 int CompareCStrs(const char *theFirstCStr,const char *theSecondCStr,const Boolean ignoreCase = true);
21 int CompareCStrToPStr(const char *theCStr,const unsigned char *thePStr,const Boolean ignoreCase = true);
22 
23 Boolean CStrsAreEqual(const char *theFirstCStr,const char *theSecondCStr,const Boolean ignoreCase = true);
24 Boolean PStrsAreEqual(const unsigned char *theFirstCStr,const unsigned char *theSecondCStr,const Boolean ignoreCase = true);
25 
26 void CopyLongIntToCStr(const long theNum,char *theCStr,const int maxCStrLength,const int numDigits = -1);
27 void CopyUnsignedLongIntToCStr(const unsigned long theNum,char *theCStr,const int maxCStrLength);
28 void ConcatLongIntToCStr(const long theNum,char *theCStr,const int maxCStrLength,const int numDigits = -1);
29 void CopyCStrAndConcatLongIntToCStr(const char *theSrcCStr,const long theNum,char *theDstCStr,const int maxDstStrLength);
30 
31 void CopyLongIntToPStr(const long theNum,unsigned char *thePStr,const int maxPStrLength,const int numDigits = -1);
32 void ConcatLongIntToPStr(const long theNum,unsigned char *thePStr,const int maxPStrLength,const int numDigits = -1);
33 
34 long CStrLength(const char *theCString);
35 long PStrLength(const unsigned char *thePString);
36 
37 OSErr CopyCStrToExistingHandle(const char *theCString,Handle theHandle);
38 OSErr CopyLongIntToExistingHandle(const long inTheLongInt,Handle theHandle);
39 
40 OSErr CopyCStrToNewHandle(const char *theCString,Handle *theHandle);
41 OSErr CopyPStrToNewHandle(const unsigned char *thePString,Handle *theHandle);
42 OSErr CopyLongIntToNewHandle(const long inTheLongInt,Handle *theHandle);
43 
44 OSErr AppendCStrToHandle(const char *theCString,Handle theHandle,long *currentLength = nil,long *maxLength = nil);
45 OSErr AppendCharsToHandle(const char *theChars,const int numChars,Handle theHandle,long *currentLength = nil,long *maxLength = nil);
46 OSErr AppendPStrToHandle(const unsigned char *thePString,Handle theHandle,long *currentLength = nil);
47 OSErr AppendLongIntToHandle(const long inTheLongInt,Handle theHandle,long *currentLength = nil);
48 
49 void ZeroMem(void *theMemPtr,const unsigned long numBytes);
50 
51 char *FindCharInCStr(const char theChar,const char *theCString);
52 long FindCharOffsetInCStr(const char theChar,const char *theCString,const Boolean inIgnoreCase = false);
53 long FindCStrOffsetInCStr(const char *theCSubstring,const char *theCString,const Boolean inIgnoreCase = false);
54 
55 void CopyCSubstrToCStr(const char *theSrcCStr,const int maxCharsToCopy,char *theDstCStr,const int maxDstStrLength);
56 void CopyCSubstrToPStr(const char *theSrcCStr,const int maxCharsToCopy,unsigned char *theDstPStr,const int maxDstStrLength);
57 
58 void InsertCStrIntoCStr(const char *theSrcCStr,const int theInsertionOffset,char *theDstCStr,const int maxDstStrLength);
59 void InsertPStrIntoCStr(const unsigned char *theSrcPStr,const int theInsertionOffset,char *theDstCStr,const int maxDstStrLength);
60 OSErr InsertCStrIntoHandle(const char *theCString,Handle theHandle,const long inInsertOffset);
61 
62 void CopyCStrAndInsertCStrIntoCStr(const char *theSrcCStr,const char *theInsertCStr,char *theDstCStr,const int maxDstStrLength);
63 
64 void CopyCStrAndInsertCStrsLongIntsIntoCStr(const char *theSrcCStr,const char **theInsertCStrs,const long *theLongInts,char *theDstCStr,const int maxDstStrLength);
65 
66 void CopyCStrAndInsert1LongIntIntoCStr(const char *theSrcCStr,const long theNum,char *theDstCStr,const int maxDstStrLength);
67 void CopyCStrAndInsert2LongIntsIntoCStr(const char *theSrcCStr,const long long1,const long long2,char *theDstCStr,const int maxDstStrLength);
68 void CopyCStrAndInsert3LongIntsIntoCStr(const char *theSrcCStr,const long long1,const long long2,const long long3,char *theDstCStr,const int maxDstStrLength);
69 
70 void CopyCStrAndInsertCStrLongIntIntoCStr(const char *theSrcCStr,const char *theInsertCStr,const long theNum,char *theDstCStr,const int maxDstStrLength);
71 OSErr CopyCStrAndInsertCStrLongIntIntoHandle(const char *theSrcCStr,const char *theInsertCStr,const long theNum,Handle *theHandle);
72 
73 
74 OSErr CopyIndexedWordToCStr(char *theSrcCStr,int whichWord,char *theDstCStr,int maxDstCStrLength);
75 OSErr CopyIndexedWordToNewHandle(char *theSrcCStr,int whichWord,Handle *outTheHandle);
76 
77 OSErr CopyIndexedLineToCStr(const char *theSrcCStr,int inWhichLine,int *lineEndIndex,Boolean *gotLastLine,char *theDstCStr,const int maxDstCStrLength);
78 OSErr CopyIndexedLineToNewHandle(const char *theSrcCStr,int inWhichLine,Handle *outNewHandle);
79 
80 OSErr ExtractIntFromCStr(const char *theSrcCStr,int *outInt,Boolean skipLeadingSpaces = true);
81 OSErr ExtractIntFromPStr(const unsigned char *theSrcPStr,int *outInt,Boolean skipLeadingSpaces = true);
82 
83 
84 void ConvertCStrToUpperCase(char *theSrcCStr);
85 
86 
87 int CountOccurencesOfCharInCStr(const char inChar,const char *inSrcCStr);
88 int CountWordsInCStr(const char *inSrcCStr);
89 
90 OSErr CountDigits(const char *inCStr,int *outNumIntegerDigits,int *outNumFractDigits);
91 
92 void ExtractCStrItemFromCStr(const char *inSrcCStr,const char inItemDelimiter,const int inItemNumber,Boolean *foundItem,char *outDstCharPtr,const int inDstCharPtrMaxLength,const Boolean inTreatMultipleDelimsAsSingleDelim = false);
93 OSErr ExtractCStrItemFromCStrIntoNewHandle(const char *inSrcCStr,const char inItemDelimiter,const int inItemNumber,Boolean *foundItem,Handle *outNewHandle,const Boolean inTreatMultipleDelimsAsSingleDelim = false);
94 
95 
96 OSErr ExtractFloatFromCStr(const char *inCString,extended80 *outFloat);
97 OSErr CopyFloatToCStr(const extended80 *theFloat,char *theCStr,const int maxCStrLength,const int inMaxNumIntDigits = -1,const int inMaxNumFractDigits = -1);
98 
99 void SkipWhiteSpace(char **ioSrcCharPtr,const Boolean inStopAtEOL = false);
100 
101 
102 #ifdef __cplusplus
103 }
104 #endif