home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 June: Reference Library / Dev.CD Jun 94.toast / Periodicals / develop / develop Issue 18 / develop 18 code / OSA Sample / Sources / PascalString.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-19  |  18.6 KB  |  752 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3. Created: Friday, December 12, 1990 at 5:44 PM
  4.     PascalString.h 
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.         Copyright Apple Computer, Inc.    1985-1992
  9.         All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __PASCALSTRING__
  15. #define __PASCALSTRING__
  16.  
  17. #ifndef __STRING__
  18. #include <String.h>
  19. #endif
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24.  
  25. // Forward declaration for all the CString classes.
  26.  
  27. #define kCStringID "cthq:CTLK$CString,1.0"
  28. struct CString;
  29.  
  30. #define kCStr255ID "cthq:CTLK$CStr255,1.0"
  31. struct CStr255;
  32.  
  33. #define kCStr63ID "cthq:CTLK$CStr63,1.0"
  34. struct CStr63;
  35.  
  36. #define kCStr32ID "cthq:CTLK$CStr32,1.0"
  37. struct CStr32;
  38.  
  39. #define kCStr31ID "cthq:CTLK$CStr31,1.0"
  40. struct CStr31;
  41.  
  42. typedef const unsigned char *ConstStr255Param;
  43. typedef ConstStr255Param ConstStr63Param, ConstStr32Param, ConstStr31Param,
  44.                          ConstStr27Param,ConstStr15Param;
  45.  
  46. typedef const CStr255& ConstCStr255Param;
  47. typedef const CStr63& ConstCStr63Param;
  48. typedef const CStr32& ConstCStr32Param;
  49. typedef const CStr31& ConstCStr31Param;
  50.  
  51. #ifndef __OSUTILS__
  52. #include <OSUtils.h>
  53. #endif
  54.  
  55. // typedef unsigned char Str255[256], Str63[64], Str32[33],
  56. //                      Str31[32], Str27[28], Str15[16], *StringPtr, **StringHandle;
  57.  
  58. // Some constants defining the length of each of the CString types.
  59.  
  60. const short kLengthByte = 1;
  61. const short kBaseLen = 2;
  62. const short kStr255Len = 255;
  63. const short kStr63Len = 63;
  64. const short kStr32Len = 32;
  65. const short kStr31Len = 31;
  66.  
  67. // Some external function declarations so that we don't have to include more than
  68. // the minimal set of header files.
  69.  
  70. pascal char* PLSTRSTR(const CString& str1,
  71.                       const CString& str2);        // From PaslibIntf.p
  72.  
  73.  
  74. //----------------------------------------------------------------------------------------
  75. // CString: Superclass of all Pascal string compatible string classes.
  76. //----------------------------------------------------------------------------------------
  77.  
  78. typedef struct CString *CStringPtr, **CStringHandle;
  79.  
  80. struct CString
  81. {
  82. public:
  83.     unsigned char fStr[kBaseLen];
  84.  
  85. protected:
  86.     void InsertHelper(const CString& insStr,
  87.                       short pos,
  88.                       short maxLength);
  89.     void InsertHelper(const char* insStr,
  90.                       short pos,
  91.                       short maxLength);
  92.  
  93. public:
  94.                                     CString();
  95.                                     ~CString();
  96.                                     
  97.     // Basic length method, inherited by all derived classes. Define one that returns a
  98.     // reference. Can be used as an lvalue and only can be applied to non-const Strings.
  99.  
  100.     inline unsigned char& Length()
  101.     {
  102.         return fStr[0];
  103.     }                                            // for non-const CString
  104.  
  105.  
  106.     inline unsigned char Length() const
  107.     {
  108.         return fStr[0];
  109.     }                                            // for const CString
  110.  
  111.  
  112.     inline Boolean IsEmpty()
  113.     {
  114.         return fStr[0] <= 0;
  115.     }
  116.  
  117.     inline Boolean IsEmpty() const
  118.     {
  119.         return fStr[0] <= 0;
  120.     }
  121.  
  122.     // Character selector operator.
  123.  
  124.     unsigned char& operator[](short pos);            // for non-const CString
  125.                                                     // !!! try to inline later
  126.  
  127.     inline unsigned char operator[](short pos) const
  128.     {
  129.         return fStr[pos];
  130.     }                                            // for const CString
  131.     
  132.     //------------------------------------------------------------------------------------
  133.     // CAUTION: There is a subtle difference between the (char*) and (unsigned char*)
  134.     // converstion operators. The first converts a pascal-style string to a c-style
  135.     // string. The second simply converts between two types (CString and Str55) both of
  136.     // which are pascal-style strings.
  137.     
  138.     // Create a NULL terminated c-style string from a pascal-style CString. Used in
  139.     // debugging to fprintf a CString.
  140.     
  141.     operator char*() const;
  142.     
  143.     // Used to create a toolbox type Str255 from our CString. This is simply a type
  144.     // coersion! Both CString and Str255 are expected to be pascal-style strings.
  145.     
  146.     operator unsigned char*();
  147.     
  148.     operator const unsigned char*() const;
  149.  
  150.     //------------------------------------------------------------------------------------
  151.     
  152.     // Return an ID represented as a CString to the actual ID (a long).
  153.     
  154.     operator long() const;
  155.  
  156.     // Relational operators that are inherited by all the derived CString types. Three of
  157.     // each so that literal C Strings can be conveniently used for one of the operators as
  158.     // well as two of the derive classes as operators. These are declared here but defined
  159.     // below all the CString classes because they use constructors for CStr255 and its class
  160.     // definition has not been encountered yet.
  161.  
  162.     friend Boolean operator==(const CString& s1,
  163.                                      const char* s2);
  164.     friend Boolean operator==(const char* s1,
  165.                                      const CString& s2);
  166.     friend Boolean operator==(const CString& s1,
  167.                                      const CString& s2);
  168.  
  169.     friend Boolean operator!=(const CString& s1,
  170.                                      const char* s2);
  171.     friend Boolean operator!=(const char* s1,
  172.                                      const CString& s2);
  173.     friend Boolean operator!=(const CString& s1,
  174.                                      const CString& s2);
  175.  
  176.     friend Boolean operator>(const CString& s1,
  177.                                     const char* s2);
  178.     friend Boolean operator>(const char* s1,
  179.                                     const CString& s2);
  180.     friend Boolean operator>(const CString& s1,
  181.                                     const CString& s2);
  182.  
  183.     friend Boolean operator<(const CString& s1,
  184.                                     const char* s2);
  185.     friend Boolean operator<(const char* s1,
  186.                                     const CString& s2);
  187.     friend Boolean operator<(const CString& s1,
  188.                                     const CString& s2);
  189.  
  190.     friend Boolean operator>=(const CString& s1,
  191.                                      const char* s2);
  192.     friend Boolean operator>=(const char* s1,
  193.                                      const CString& s2);
  194.     friend Boolean operator>=(const CString& s1,
  195.                                      const CString& s2);
  196.  
  197.     friend Boolean operator<=(const CString& s1,
  198.                                      const char* s2);
  199.     friend Boolean operator<=(const char* s1,
  200.                                      const CString& s2);
  201.     friend Boolean operator<=(const CString& s1,
  202.                                      const CString& s2);
  203.  
  204.     // Concatenation operator that are inherited by all the derived CString types. Three
  205.     // of each so that literal C Strings can be conveniently used for one of the operators
  206.     // as well as using any two classes derived from CString.
  207.  
  208.     friend CStr255 operator+(const CString& s1,
  209.                             const char* s2);
  210.     friend CStr255 operator+(const char* s1,
  211.                             const CString& s2);
  212.     friend CStr255 operator+(const CString& s1,
  213.                             const CString& s2);
  214.  
  215.     // Methods that mimic the Pascal builtin CString functions for Pos, Insert and Delete.
  216.     // Note that insert and copy is implemented in the derived classes.
  217.  
  218.     unsigned char Pos(const char* subStr, unsigned char startPos = 1);
  219.     unsigned char Pos(const CString& subStr, unsigned char startPos = 1);
  220.     inline void Delete(short pos, short length);
  221. };
  222.  
  223. //----------------------------------------------------------------------------------------
  224. // CStr255:
  225. //----------------------------------------------------------------------------------------
  226.  
  227. struct CStr255 : CString
  228. {
  229.  
  230.     friend struct CStr63;
  231.     friend struct CStr31;
  232.  
  233. private:
  234.     unsigned char fData[kStr255Len - 1];
  235.  
  236. public:
  237.     CStr255();
  238.     ~CStr255();
  239.     CStr255(const CStr255& str);
  240.     CStr255(const CStr63& str);
  241.     CStr255(const CStr32& str);
  242.     CStr255(const CStr31& str);
  243.     CStr255(const unsigned char* str);
  244.     CStr255(const char* str);
  245.     CStr255(const long id);
  246.  
  247.     // Insert and Copy roughly equivalent to the Pascal Insert and Copy functions.
  248.     
  249.     void Insert(const CString& str, short pos);
  250.     void Insert(const char* str, short pos);
  251.     CStr255 Copy(short pos, short length);
  252.                        
  253.     // Concatenation operator
  254.     
  255.     CStr255& operator +=(const CString& str);
  256.     CStr255& operator +=(const char* str);
  257.     CStr255& operator +=(const char ch);
  258.  
  259.     // Assignment operator
  260.  
  261.     CStr255& operator =(const CStr255& str);
  262.     CStr255& operator =(const CStr63& str);
  263.     CStr255& operator =(const CStr32& str);
  264.     CStr255& operator =(const CStr31& str);
  265.     CStr255& operator =(const unsigned char* str);
  266.     CStr255& operator =(const char aChar);
  267.     CStr255& operator =(const char* str);
  268.     
  269. };
  270.  
  271.  
  272. //----------------------------------------------------------------------------------------
  273. // CStr63:
  274. //----------------------------------------------------------------------------------------
  275.  
  276. struct CStr63 : CString
  277. {
  278.  
  279.     friend struct CStr255;
  280.     friend struct CStr31;
  281.  
  282. private:
  283.     unsigned char fData[kStr63Len - 1];
  284.  
  285. public:
  286.     CStr63();
  287.     ~CStr63();
  288.     CStr63(const CStr255& str);
  289.     CStr63(const CStr63& str);
  290.     CStr63(const CStr32& str);
  291.     CStr63(const CStr31& str);
  292.     CStr63(const unsigned char* str);
  293.     CStr63(const char* str);
  294.     CStr63(const long id);
  295.  
  296.     // Insert and Copy roughly equivalent to the Pascal Insert and Copy functions.
  297.     
  298.     void Insert(const CString& str,
  299.                        short pos);
  300.     void Insert(const char* str,
  301.                        short pos);
  302.     CStr63 Copy(short pos, short length);
  303.  
  304.     // Concatenation operator
  305.     
  306.     CStr63& operator +=(const CString& str);
  307.     CStr63& operator +=(const char* str);
  308.     CStr63& operator +=(const char ch);
  309. };
  310.  
  311.  
  312. //----------------------------------------------------------------------------------------
  313. // CStr32:
  314. //----------------------------------------------------------------------------------------
  315.  
  316. struct CStr32 : CString
  317. {
  318.  
  319.     friend struct CStr255;
  320.     friend struct CStr63;
  321.  
  322. private:
  323.     unsigned char fData[kStr32Len - 1];
  324.  
  325. public:
  326.     CStr32();
  327.     ~CStr32();
  328.     inline CStr32(unsigned char length)
  329.     {
  330.         fStr[0] = length;
  331.     }
  332.  
  333.  
  334.     CStr32(const CStr255& str);
  335.     CStr32(const CStr63& str);
  336.     CStr32(const CStr32& str);
  337.     CStr32(const CStr31& str);
  338.     CStr32(const unsigned char* str);
  339.     CStr32(const char* str);
  340.     CStr32(const long id);
  341.  
  342.  
  343.     // Insert and Copy roughly equivalent to the Pascal Insert and Copy functions.
  344.     
  345.     void Insert(const CString& str,
  346.                        short pos);
  347.     void Insert(const char* str,
  348.                        short pos);
  349.     CStr32 Copy(short pos, short length);
  350.  
  351.     // Concatenation operator
  352.     
  353.     CStr32& operator +=(const CString& str);
  354.     CStr32& operator +=(const char* str);
  355.     CStr32& operator +=(const char ch);
  356. };
  357.  
  358.  
  359. //----------------------------------------------------------------------------------------
  360. // CStr31:
  361. //----------------------------------------------------------------------------------------
  362.  
  363. struct CStr31 : CString
  364. {
  365.  
  366.     friend struct CStr255;
  367.     friend struct CStr63;
  368.     friend struct CStr32;
  369.  
  370. private:
  371.     unsigned char fData[kStr31Len - 1];
  372.  
  373. public:
  374.     ~CStr31();
  375.     CStr31();
  376.     inline CStr31(unsigned char length)
  377.     {
  378.         fStr[0] = length;
  379.     }
  380.  
  381.  
  382.     CStr31(const CStr255& str);
  383.     CStr31(const CStr63& str);
  384.     CStr31(const CStr32& str);
  385.     CStr31(const CStr31& str);
  386.     CStr31(const unsigned char* str);
  387.     CStr31(const char* str);
  388.     CStr31(const long id);
  389.  
  390.     // Insert and Copy roughly equivalent to the Pascal Insert and Copy functions.
  391.     
  392.     void Insert(const CString& str,
  393.                        short pos);
  394.     void Insert(const char* str,
  395.                        short pos);
  396.     CStr31 Copy(short pos, short length);
  397.  
  398.     // Concatenation operator
  399.     
  400.     CStr31& operator +=(const CString& str);
  401.     CStr31& operator +=(const char* str);
  402.     CStr31& operator +=(const char ch);
  403. };
  404.  
  405.  
  406. //----------------------------------------------------------------------------------------
  407. // CString inline function definitions
  408. //----------------------------------------------------------------------------------------
  409.  
  410. inline CString::operator unsigned char*()
  411. {
  412.     return (unsigned char *) this;
  413. }
  414.  
  415. inline void CString::Delete(short pos, short length)
  416. {
  417.     if ((pos > 0) && (length > 0) && (pos <= Length()))    // should also check that pos <= kMaxLength
  418.     {
  419.         if (pos + length > Length())
  420.             fStr[0] = pos - 1;
  421.         else
  422.         {
  423.             memcpy(&fStr[pos], &fStr[pos + length], Length() - (pos + length) + kLengthByte);
  424.             fStr[0] -= length;
  425.         }
  426.     }
  427. }
  428.  
  429.  
  430. //----------------------------------------------------------------------------------------
  431. // CStr255 inline function definitions
  432. //----------------------------------------------------------------------------------------
  433. inline CStr255::CStr255(const CStr255& str)
  434. {
  435.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  436. }
  437.  
  438. inline CStr255::CStr255(const CStr63& str)
  439. {
  440.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  441. }
  442.  
  443. inline CStr255::CStr255(const CStr32& str)
  444. {
  445.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  446. }
  447.  
  448. inline CStr255::CStr255(const CStr31& str)
  449. {
  450.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  451. }
  452.  
  453. inline CStr255::CStr255(const unsigned char* str)
  454. {
  455.     memcpy(fStr, str, kStr255Len + kLengthByte);
  456. }
  457.  
  458. inline CStr255& CStr255::operator = (const CStr255& str)
  459. {
  460.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  461.     
  462.     return *this;
  463. }
  464.  
  465. inline CStr255& CStr255::operator = (const CStr63& str)
  466. {
  467.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  468.     
  469.     return *this;
  470. }
  471.  
  472. inline CStr255& CStr255::operator = (const CStr32& str)
  473. {
  474.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  475.     
  476.     return *this;
  477. }
  478.  
  479. inline CStr255& CStr255::operator = (const CStr31& str)
  480. {
  481.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  482.     
  483.     return *this;
  484. }
  485.  
  486. inline CStr255& CStr255::operator = (const unsigned char* str)
  487. {
  488.     memcpy(fStr, str, kStr255Len + kLengthByte);
  489.     
  490.     return *this;
  491. }
  492.  
  493. inline CStr255& CStr255::operator = (const char aChar)
  494. {
  495.     if (aChar == '\0')                        // passing in an NULL char
  496.         Length() = 0;
  497.     else
  498.     {
  499.         Length() = 1;                        // CString gets length of 1
  500.         fStr[1] = aChar;                    // assign in the character
  501.     }
  502.     
  503.     return *this;
  504. }
  505.  
  506. inline void CStr255::Insert(const CString& str, short pos)
  507. {
  508.     InsertHelper(str, pos, kStr255Len);
  509. }
  510.  
  511. inline void CStr255::Insert(const char* str, short pos)
  512. {
  513.     InsertHelper(str, pos, kStr255Len);
  514. }
  515.  
  516.  
  517. //----------------------------------------------------------------------------------------
  518. // CStr63 inline function definitions
  519. //----------------------------------------------------------------------------------------
  520.  
  521. inline CStr63::CStr63(const CStr255& str)
  522. {
  523.     // Truncate the CStr255 to 63 bytes if necessary.
  524.  
  525.     Length() = str.Length() > kStr63Len ? kStr63Len : str.Length();
  526.     memcpy(fStr, str.fStr, Length() + kLengthByte);
  527. }
  528.  
  529. inline CStr63::CStr63(const CStr63& str)
  530. {
  531.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  532. }
  533.  
  534. inline CStr63::CStr63(const CStr32& str)
  535. {
  536.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  537. }
  538.  
  539. inline CStr63::CStr63(const CStr31& str)
  540. {
  541.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  542. }
  543.  
  544. inline CStr63::CStr63(const unsigned char* str)
  545. {
  546.     memcpy(fStr, str, kStr63Len + kLengthByte);
  547. }
  548.  
  549. inline void CStr63::Insert(const CString& str, short pos)
  550. {
  551.     InsertHelper(str, pos, kStr63Len);
  552. }
  553.  
  554. inline void CStr63::Insert(const char* str, short pos)
  555. {
  556.     InsertHelper(str, pos, kStr63Len);
  557. }
  558.  
  559.  
  560. //----------------------------------------------------------------------------------------
  561. // CStr32 inline function definitions
  562. //----------------------------------------------------------------------------------------
  563.  
  564. inline CStr32::CStr32(const CStr255& str)
  565. {
  566.     // Truncate the CStr255 to 32 bytes if necessary.
  567.  
  568.     Length() = str.Length() > kStr32Len ? kStr32Len : str.Length();
  569.     memcpy(fStr, str.fStr, Length() + kLengthByte);
  570. }
  571.  
  572. inline CStr32::CStr32(const CStr63& str)
  573. {
  574.     // Truncate the CStr63 to 32 bytes if necessary.
  575.  
  576.     Length() = str.Length() > kStr32Len ? kStr32Len : str.Length();
  577.     memcpy(fStr, str.fStr, Length() + kLengthByte);
  578. }
  579.  
  580. inline CStr32::CStr32(const CStr32& str)
  581. {
  582.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  583. }
  584.  
  585. inline CStr32::CStr32(const CStr31& str)
  586. {
  587.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  588. }
  589.  
  590. inline CStr32::CStr32(const unsigned char* str)
  591. {
  592.     memcpy(fStr, str, kStr31Len + kLengthByte);
  593. }
  594.  
  595. inline void CStr32::Insert(const CString& str, short pos)
  596. {
  597.     InsertHelper(str, pos, kStr32Len);
  598. }
  599.  
  600. inline void CStr32::Insert(const char* str, short pos)
  601. {
  602.     InsertHelper(str, pos, kStr32Len);
  603. }
  604.  
  605.  
  606. //----------------------------------------------------------------------------------------
  607. // CStr31 inline function definitions
  608. //----------------------------------------------------------------------------------------
  609.  
  610. inline CStr31::CStr31(const CStr255& str)
  611. {
  612.     // Truncate the CStr255 to 31 bytes if necessary.
  613.  
  614.     Length() = str.Length() > kStr31Len ? kStr31Len : str.Length();
  615.     memcpy(fStr, str.fStr, Length() + kLengthByte);
  616. }
  617.  
  618. inline CStr31::CStr31(const CStr63& str)
  619. {
  620.     // Truncate the CStr63 to 31 bytes if necessary.
  621.  
  622.     Length() = str.Length() > kStr31Len ? kStr31Len : str.Length();
  623.     memcpy(fStr, str.fStr, Length() + kLengthByte);
  624. }
  625.  
  626. inline CStr31::CStr31(const CStr32& str)
  627. {
  628.     // Truncate the CStr32 to 31 bytes if necessary.
  629.  
  630.     Length() = str.Length() > kStr31Len ? kStr31Len : str.Length();
  631.     memcpy(fStr, str.fStr, Length() + kLengthByte);
  632. }
  633.  
  634. inline CStr31::CStr31(const CStr31& str)
  635. {
  636.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  637. }
  638.  
  639. inline CStr31::CStr31(const unsigned char* str)
  640. {
  641.     memcpy(fStr, str, kStr31Len + kLengthByte);
  642. }
  643.  
  644. inline void CStr31::Insert(const CString& str, short pos)
  645. {
  646.     InsertHelper(str, pos, kStr31Len);
  647. }
  648.  
  649. inline void CStr31::Insert(const char* str, short pos)
  650. {
  651.     InsertHelper(str, pos, kStr31Len);
  652. }
  653.  
  654.  
  655. //----------------------------------------------------------------------------------------
  656. // Inline friend function definitions for relational string operators.
  657. //----------------------------------------------------------------------------------------
  658.  
  659. inline Boolean operator==(const CString& s1, const char* s2)
  660. {
  661.     return RelString(s1, CStr255(s2), false, true) == 0;
  662. }
  663.  
  664. inline Boolean operator==(const char* s1, const CString& s2)
  665. {
  666.     return RelString(CStr255(s1), s2, false, true) == 0;
  667. }
  668.  
  669. inline Boolean operator==(const CString& s1, const CString& s2)
  670. {
  671.     return RelString(s1, s2, false, true) == 0;
  672. }
  673.  
  674. inline Boolean operator!=(const CString& s1, const char* s2)
  675. {
  676.     return RelString(s1, CStr255(s2), false, true) != 0;
  677. }
  678.  
  679. inline Boolean operator!=(const char* s1, const CString& s2)
  680. {
  681.     return RelString(CStr255(s1), s2, false, true) != 0;
  682. }
  683.  
  684. inline Boolean operator!=(const CString& s1, const CString& s2)
  685. {
  686.     return RelString(s1, s2, false, true) != 0;
  687. }
  688.  
  689. inline Boolean operator>(const CString& s1, const char* s2)
  690. {
  691.     return RelString(s1, CStr255(s2), false, true) > 0;
  692. }
  693.  
  694. inline Boolean operator>(const char* s1, const CString& s2)
  695. {
  696.     return RelString(CStr255(s1), s2, false, true) > 0;
  697. }
  698.  
  699. inline Boolean operator>(const CString& s1, const CString& s2)
  700. {
  701.     return RelString(s1, s2, false, true) > 0;
  702. }
  703.  
  704. inline Boolean operator<(const CString& s1, const char* s2)
  705. {
  706.     return RelString(s1, CStr255(s2), false, true) < 0;
  707. }
  708.  
  709. inline Boolean operator<(const char* s1, const CString& s2)
  710. {
  711.     return RelString(CStr255(s1), s2, false, true) < 0;
  712. }
  713.  
  714. inline Boolean operator<(const CString& s1, const CString& s2)
  715. {
  716.     return RelString(s1, s2, false, true) < 0;
  717. }
  718.  
  719. inline Boolean operator>=(const CString& s1, const char* s2)
  720. {
  721.     return RelString(s1, CStr255(s2), false, true) >= 0;
  722. }
  723.  
  724. inline Boolean operator>=(const char* s1, const CString& s2)
  725. {
  726.     return RelString(CStr255(s1), s2, false, true) >= 0;
  727. }
  728.  
  729. inline Boolean operator>=(const CString& s1, const CString& s2)
  730. {
  731.     return RelString(s1, s2, false, true) >= 0;
  732. }
  733.  
  734. inline Boolean operator<=(const CString& s1, const char* s2)
  735. {
  736.     return RelString(s1, CStr255(s2), false, true) <= 0;
  737. }
  738.  
  739. inline Boolean operator<=(const char* s1, const CString& s2)
  740. {
  741.     return RelString(CStr255(s1), s2, false, true) <= 0;
  742. }
  743.  
  744. inline Boolean operator<=(const CString& s1, const CString& s2)
  745. {
  746.     return RelString(s1, s2, false, true) <= 0;
  747. }
  748.  
  749.  
  750. #endif
  751.  
  752.