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