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.

133 lines
5.4KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCETICE project - Copyright 2009 by Lucio Asnaghi.
  4. JUCETICE is based around the JUCE library - "Jules' Utility Class Extensions"
  5. Copyright 2007 by Julian Storer.
  6. ------------------------------------------------------------------------------
  7. JUCE and JUCETICE can be redistributed and/or modified under the terms of
  8. the GNU General Public License, as published by the Free Software Foundation;
  9. either version 2 of the License, or (at your option) any later version.
  10. JUCE and JUCETICE are distributed in the hope that they will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with JUCE and JUCETICE; if not, visit www.gnu.org/licenses or write to
  16. Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  17. Boston, MA 02111-1307 USA
  18. ==============================================================================
  19. */
  20. #ifndef __JUCETICE_SCRIPTABLEENGINESTRING_HEADER__
  21. #define __JUCETICE_SCRIPTABLEENGINESTRING_HEADER__
  22. #if JUCE_SUPPORT_SCRIPTING
  23. class ScriptableEngine;
  24. namespace Bindings {
  25. //==============================================================================
  26. /** Manages Strings in angel scripts
  27. @see ScriptableEngine, String
  28. */
  29. class asString
  30. {
  31. public:
  32. asString ();
  33. asString (const asString &other);
  34. asString (const char s);
  35. asString (const char* s);
  36. asString (const tchar s);
  37. asString (const tchar* s);
  38. asString (const String &s);
  39. void addRef ();
  40. void release ();
  41. asString& operator= (const asString &other);
  42. asString& operator+= (const asString &other);
  43. bool equalsIgnoreCase (const asString& other);
  44. int compare (const asString& other);
  45. int compareIgnoreCase (const asString& other);
  46. int compareLexicographically (const asString& other);
  47. bool startsWith (const asString& text);
  48. bool startsWithIgnoreCase (const asString& text);
  49. bool endsWith (const asString& text);
  50. bool endsWithIgnoreCase (const asString& text);
  51. bool contains (const asString& text);
  52. bool containsIgnoreCase (const asString& text);
  53. bool containsWholeWord (const asString& wordToLookFor);
  54. bool containsWholeWordIgnoreCase (const asString& wordToLookFor);
  55. bool containsAnyOf (const asString& charactersItMightContain);
  56. bool containsOnly (const asString& charactersItMightContain);
  57. bool matchesWildcard (const asString& wildcard, const bool ignoreCase);
  58. int indexOf (const asString& other);
  59. int indexOf (const int startIndex, const asString& textToLookFor);
  60. int indexOfIgnoreCase (const asString& textToLookFor);
  61. int indexOfIgnoreCase (const int startIndex, const asString& textToLookFor);
  62. int lastIndexOf (const asString& textToLookFor);
  63. int lastIndexOfIgnoreCase (const asString& textToLookFor);
  64. asString* substring (int startIndex, int endIndex);
  65. asString* substring (const int startIndex);
  66. asString* dropLastCharacters (const int numberToDrop);
  67. asString* fromFirstOccurrenceOf (const asString& substringToStartFrom,
  68. const bool includeSubStringInResult,
  69. const bool ignoreCase);
  70. asString* fromLastOccurrenceOf (const asString& substringToFind,
  71. const bool includeSubStringInResult,
  72. const bool ignoreCase);
  73. asString* upToFirstOccurrenceOf (const asString& substringToEndWith,
  74. const bool includeSubStringInResult,
  75. const bool ignoreCase);
  76. asString* upToLastOccurrenceOf (const asString& substringToFind,
  77. const bool includeSubStringInResult,
  78. const bool ignoreCase);
  79. asString* trim();
  80. asString* trimStart();
  81. asString* trimEnd();
  82. asString* toUpperCase();
  83. asString* toLowerCase();
  84. asString* replaceSection (int startIndex,
  85. int numCharactersToReplace,
  86. const asString& stringToInsert);
  87. asString* replace (const asString& stringToReplace,
  88. const asString& stringToInsertInstead,
  89. const bool ignoreCase = false);
  90. asString* replaceCharacter (const asString& characterToReplace,
  91. const asString& characterToInsertInstead);
  92. asString* replaceCharacters (const asString& charactersToReplace,
  93. const asString& charactersToInsertInstead);
  94. asString* retainCharacters (const asString& charactersToRetain);
  95. asString* removeCharacters (const asString& charactersToRemove);
  96. asString* initialSectionContainingOnly (const asString& charactersToRetain);
  97. asString* initialSectionNotContaining (const asString& charactersNotToRetain);
  98. asString* unquoted();
  99. asString* quoted (const asString& quoteCharacter = T('"'));
  100. String buffer;
  101. protected:
  102. ~asString();
  103. int refCount;
  104. };
  105. void RegisterObjectTypeString (ScriptableEngine* scriptEngine);
  106. } // end namespace Bindings
  107. #endif // JUCE_SUPPORT_SCRIPTING
  108. #endif // __JUCETICE_SCRIPTABLEENGINESTRING_HEADER__