home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample SMSAM / SampleSMSAM Source / BuildingBlocks / PascalString.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-28  |  18.4 KB  |  763 lines  |  [TEXT/KAHL]

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