Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.4 KiB

  1. /*****************************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright(c) Microsoft Corp., 1987-1999 **/
  4. /*****************************************************************************/
  5. /*****************************************************************************
  6. File : textsub.hxx
  7. Title : text substitution class
  8. History :
  9. 29-Dec-1991 VibhasC Created
  10. *****************************************************************************/
  11. #ifndef __TEXTSUB_HXX__
  12. #define __TEXTSUB_HXX__
  13. #include "idict.hxx"
  14. class TEXT_BUFFER
  15. {
  16. private:
  17. char * pBuffer;
  18. char * pCurrent;
  19. public:
  20. TEXT_BUFFER( char *p )
  21. {
  22. pBuffer = pCurrent = p;
  23. }
  24. short GetChar()
  25. {
  26. return (short)(*pCurrent++);
  27. }
  28. short UnGetChar( short c )
  29. {
  30. if( pCurrent > pBuffer )
  31. {
  32. pCurrent--;
  33. return c;
  34. }
  35. else
  36. return c;
  37. }
  38. };
  39. class TEXT_SUB
  40. {
  41. private:
  42. char * pSubsText;
  43. short fBeingExpanded;
  44. public:
  45. TEXT_SUB( char *pSubs )
  46. {
  47. pSubsText = pSubs;
  48. fBeingExpanded = 0;
  49. }
  50. ~TEXT_SUB()
  51. {
  52. delete pSubsText;
  53. }
  54. char * GetSubstitutionText()
  55. {
  56. return pSubsText;
  57. }
  58. virtual
  59. class TEXT_BUFFER * Expand()
  60. {
  61. return new TEXT_BUFFER( pSubsText );
  62. }
  63. };
  64. #endif // __TEXTSUB_HXX__