metaphone.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef _METAPHONE_H
  2. #define _METAPHONE_H
  3. ////////////////////////////////////////////////////////////////////////////////
  4. //
  5. ////////////////////////////////////////////////////////////////////////////////
  6. #include "platform.h"
  7. #include "dmetaphone.hpp"
  8. #include "cstring.h"
  9. #include <string.h>
  10. //#include <varargs.h>
  11. //#define false FALSE
  12. //#define true TRUE
  13. namespace nsDmetaphone {
  14. #ifdef _MSC_VER
  15. //Disable warnings about cString not matching the export specification of MString,
  16. //because all methods of cString are inline, so they will be compiled into each
  17. //plugin.
  18. #pragma warning(push)
  19. #pragma warning(disable: 4251 4275)
  20. #endif
  21. class DMETAPHONE_API MString : public cString
  22. {
  23. int length = 0;
  24. int last = 0;
  25. bool alternate = false;
  26. cString primary, secondary;
  27. public:
  28. MString();
  29. MString(const char*);
  30. MString& operator =(const char *Str)
  31. {
  32. Set(Str);
  33. return(*this);
  34. }
  35. MString(const cString&);
  36. bool SlavoGermanic();
  37. bool IsVowel(int at);
  38. inline void MetaphAdd(const char* main);
  39. inline void MetaphAdd(const char main);
  40. inline void MetaphAdd(const char* main, const char* alt);
  41. bool StringAt(int start, int length, ... );
  42. void DoubleMetaphone(cString &metaph, cString &metaph2);
  43. char GetAt( int x )
  44. {
  45. return Ptr[x];
  46. }
  47. bool Find(char c)
  48. {
  49. return (strchr(Ptr, c) != NULL);
  50. }
  51. bool Find(const char * str)
  52. {
  53. return (strstr(Ptr, str) != NULL);
  54. }
  55. };
  56. #ifdef _MSC_VER
  57. #pragma warning(pop)
  58. #endif
  59. }//namespace
  60. #endif