| @@ -179,9 +179,9 @@ void MainHostWindow::changeListenerCallback (ChangeBroadcaster*) | |||
| const StringArray MainHostWindow::getMenuBarNames() | |||
| { | |||
| const tchar* const names[] = { T("File"), T("Plugins"), T("Options"), 0 }; | |||
| const char* const names[] = { "File", "Plugins", "Options", 0 }; | |||
| return StringArray ((const tchar**) names); | |||
| return StringArray (names); | |||
| } | |||
| const PopupMenu MainHostWindow::getMenuForIndex (int topLevelMenuIndex, const String& /*menuName*/) | |||
| @@ -191,54 +191,54 @@ public: | |||
| case showRendering: | |||
| result.setInfo ("Graphics Rendering", "Shows the graphics demo", demosCategory, 0); | |||
| result.setTicked (currentDemoId == showRendering); | |||
| result.addDefaultKeypress (T('1'), ModifierKeys::commandModifier); | |||
| result.addDefaultKeypress ('1', ModifierKeys::commandModifier); | |||
| break; | |||
| case showFontsAndText: | |||
| result.setInfo ("Fonts and Text", "Shows the fonts & text demo", demosCategory, 0); | |||
| result.setTicked (currentDemoId == showFontsAndText); | |||
| result.addDefaultKeypress (T('2'), ModifierKeys::commandModifier); | |||
| result.addDefaultKeypress ('2', ModifierKeys::commandModifier); | |||
| break; | |||
| case showWidgets: | |||
| result.setInfo ("Widgets", "Shows the widgets demo", demosCategory, 0); | |||
| result.setTicked (currentDemoId == showWidgets); | |||
| result.addDefaultKeypress (T('3'), ModifierKeys::commandModifier); | |||
| result.addDefaultKeypress ('3', ModifierKeys::commandModifier); | |||
| break; | |||
| case showThreading: | |||
| result.setInfo ("Multithreading", "Shows the threading demo", demosCategory, 0); | |||
| result.setTicked (currentDemoId == showThreading); | |||
| result.addDefaultKeypress (T('4'), ModifierKeys::commandModifier); | |||
| result.addDefaultKeypress ('4', ModifierKeys::commandModifier); | |||
| break; | |||
| case showTreeView: | |||
| result.setInfo ("Treeviews", "Shows the treeviews demo", demosCategory, 0); | |||
| result.setTicked (currentDemoId == showTreeView); | |||
| result.addDefaultKeypress (T('5'), ModifierKeys::commandModifier); | |||
| result.addDefaultKeypress ('5', ModifierKeys::commandModifier); | |||
| break; | |||
| case showTable: | |||
| result.setInfo ("Table Components", "Shows the table component demo", demosCategory, 0); | |||
| result.setTicked (currentDemoId == showTable); | |||
| result.addDefaultKeypress (T('6'), ModifierKeys::commandModifier); | |||
| result.addDefaultKeypress ('6', ModifierKeys::commandModifier); | |||
| break; | |||
| case showAudio: | |||
| result.setInfo ("Audio", "Shows the audio demo", demosCategory, 0); | |||
| result.setTicked (currentDemoId == showAudio); | |||
| result.addDefaultKeypress (T('7'), ModifierKeys::commandModifier); | |||
| result.addDefaultKeypress ('7', ModifierKeys::commandModifier); | |||
| break; | |||
| case showDragAndDrop: | |||
| result.setInfo ("Drag-and-drop", "Shows the drag & drop demo", demosCategory, 0); | |||
| result.setTicked (currentDemoId == showDragAndDrop); | |||
| result.addDefaultKeypress (T('8'), ModifierKeys::commandModifier); | |||
| result.addDefaultKeypress ('8', ModifierKeys::commandModifier); | |||
| break; | |||
| case showOpenGL: | |||
| result.setInfo ("OpenGL", "Shows the OpenGL demo", demosCategory, 0); | |||
| result.addDefaultKeypress (T('9'), ModifierKeys::commandModifier); | |||
| result.addDefaultKeypress ('9', ModifierKeys::commandModifier); | |||
| result.setTicked (currentDemoId == showOpenGL); | |||
| #if ! JUCE_OPENGL | |||
| result.setActive (false); | |||
| @@ -247,7 +247,7 @@ public: | |||
| case showQuicktime: | |||
| result.setInfo ("Quicktime", "Shows the Quicktime demo", demosCategory, 0); | |||
| result.addDefaultKeypress (T('b'), ModifierKeys::commandModifier); | |||
| result.addDefaultKeypress ('b', ModifierKeys::commandModifier); | |||
| result.setTicked (currentDemoId == showQuicktime); | |||
| #if ! (JUCE_QUICKTIME && ! JUCE_LINUX) | |||
| result.setActive (false); | |||
| @@ -256,7 +256,7 @@ public: | |||
| case showCamera: | |||
| result.setInfo ("Camera Capture", "Shows the camera demo", demosCategory, 0); | |||
| result.addDefaultKeypress (T('c'), ModifierKeys::commandModifier); | |||
| result.addDefaultKeypress ('c', ModifierKeys::commandModifier); | |||
| result.setTicked (currentDemoId == showCamera); | |||
| #if ! JUCE_USE_CAMERA | |||
| result.setActive (false); | |||
| @@ -265,7 +265,7 @@ public: | |||
| case showWebBrowser: | |||
| result.setInfo ("Web Browser", "Shows the web browser demo", demosCategory, 0); | |||
| result.addDefaultKeypress (T('i'), ModifierKeys::commandModifier); | |||
| result.addDefaultKeypress ('i', ModifierKeys::commandModifier); | |||
| result.setTicked (currentDemoId == showWebBrowser); | |||
| #if (! JUCE_WEB_BROWSER) || JUCE_LINUX | |||
| result.setActive (false); | |||
| @@ -274,13 +274,13 @@ public: | |||
| case showCodeEditor: | |||
| result.setInfo ("Code Editor", "Shows the code editor demo", demosCategory, 0); | |||
| result.addDefaultKeypress (T('e'), ModifierKeys::commandModifier); | |||
| result.addDefaultKeypress ('e', ModifierKeys::commandModifier); | |||
| result.setTicked (currentDemoId == showCodeEditor); | |||
| break; | |||
| case showInterprocessComms: | |||
| result.setInfo ("Interprocess Comms", "Shows the interprocess communications demo", demosCategory, 0); | |||
| result.addDefaultKeypress (T('0'), ModifierKeys::commandModifier); | |||
| result.addDefaultKeypress ('0', ModifierKeys::commandModifier); | |||
| result.setTicked (currentDemoId == showInterprocessComms); | |||
| break; | |||
| @@ -152,7 +152,6 @@ | |||
| BufferSecurityCheck="true" | |||
| RuntimeTypeInfo="true" | |||
| UsePrecompiledHeader="0" | |||
| PrecompiledHeaderThrough="jucer_Headers.h" | |||
| AssemblerListingLocation=".\Debug/" | |||
| ObjectFile=".\Debug/" | |||
| ProgramDataBaseFileName=".\Debug/" | |||
| @@ -204,7 +203,7 @@ | |||
| Name="VCAppVerifierTool" | |||
| /> | |||
| <Tool | |||
| Name="VCWebDeploymentTool" /> <Tool Name="VCPostBuildEventTool" | |||
| Name="VCPostBuildEventTool" | |||
| /> | |||
| </Configuration> | |||
| </Configurations> | |||
| @@ -243,7 +242,7 @@ | |||
| > | |||
| <Tool | |||
| Name="VCCLCompilerTool" | |||
| UsePrecompiledHeader="1" | |||
| UsePrecompiledHeader="0" | |||
| /> | |||
| </FileConfiguration> | |||
| </File> | |||
| @@ -56,7 +56,7 @@ public: | |||
| ImageCache::setCacheTimeout (30 * 1000); | |||
| if (commandLine.trim().isNotEmpty() | |||
| && ! commandLine.trim().startsWithChar (T('-'))) | |||
| && ! commandLine.trim().startsWithChar ('-')) | |||
| anotherInstanceStarted (commandLine); | |||
| } | |||
| @@ -84,12 +84,12 @@ public: | |||
| //============================================================================== | |||
| const String getApplicationName() | |||
| { | |||
| return T("The Jucer"); | |||
| return "The Jucer"; | |||
| } | |||
| const String getApplicationVersion() | |||
| { | |||
| return String (JUCER_MAJOR_VERSION) + T(".") + String (JUCER_MINOR_VERSION); | |||
| return String (JUCER_MAJOR_VERSION) + "." + String (JUCER_MINOR_VERSION); | |||
| } | |||
| bool moreThanOneInstanceAllowed() | |||
| @@ -159,7 +159,7 @@ public: | |||
| callback << "else "; | |||
| const String memberVariableName (code.document->getComponentLayout()->getComponentMemberVariableName (component)); | |||
| const String userCodeComment (T("UserButtonCode_") + memberVariableName); | |||
| const String userCodeComment ("UserButtonCode_" + memberVariableName); | |||
| callback | |||
| << "if (buttonThatWasClicked == " << memberVariableName | |||
| @@ -149,7 +149,7 @@ public: | |||
| callback << "else "; | |||
| const String memberVariableName (code.document->getComponentLayout()->getComponentMemberVariableName (component)); | |||
| const String userCodeComment (T("UserComboBoxCode_") + memberVariableName); | |||
| const String userCodeComment ("UserComboBoxCode_" + memberVariableName); | |||
| callback | |||
| << "if (comboBoxThatHasChanged == " << memberVariableName | |||
| @@ -567,7 +567,7 @@ void ComponentTypeHandler::fillInCreationCode (GeneratedCode& code, Component* c | |||
| StringArray lines; | |||
| lines.addLines (params); | |||
| params = lines.joinIntoString (T("\n") + String::repeatedString (T(" "), s.length() + 2)); | |||
| params = lines.joinIntoString ("\n" + String::repeatedString (" ", s.length() + 2)); | |||
| s << " (" << params << "));\n"; | |||
| } | |||
| @@ -102,7 +102,7 @@ public: | |||
| } | |||
| s << getColourIntialisationCode (component, memberVariableName) | |||
| << T('\n'); | |||
| << '\n'; | |||
| code.constructorCode += s; | |||
| } | |||
| @@ -100,7 +100,7 @@ public: | |||
| ButtonHandler::fillInCreationCode (code, component, memberVariableName); | |||
| code.constructorCode << getColourIntialisationCode (component, memberVariableName) | |||
| << T('\n'); | |||
| << '\n'; | |||
| } | |||
| juce_UseDebuggingNewOperator | |||
| @@ -138,7 +138,7 @@ public: | |||
| String s; | |||
| s << getColourIntialisationCode (component, memberVariableName) | |||
| << T('\n'); | |||
| << '\n'; | |||
| const String indent (String::repeatedString (T(" "), memberVariableName.length() + 13)); | |||
| @@ -184,7 +184,7 @@ private: | |||
| { | |||
| setJucerComponentFile (document, component, | |||
| newFile.getRelativePathFrom (document.getFile().getParentDirectory()) | |||
| .replaceCharacter (T('\\'), T('/'))); | |||
| .replaceCharacter ('\\', '/')); | |||
| } | |||
| const File getFile() const | |||
| @@ -143,7 +143,7 @@ public: | |||
| if (needsCallback (component)) | |||
| s << memberVariableName << "->addListener (this);\n"; | |||
| s << T('\n'); | |||
| s << '\n'; | |||
| code.constructorCode += s; | |||
| } | |||
| @@ -163,7 +163,7 @@ public: | |||
| callback << "else "; | |||
| const String memberVariableName (code.document->getComponentLayout()->getComponentMemberVariableName (component)); | |||
| const String userCodeComment (T("UserLabelCode_") + memberVariableName); | |||
| const String userCodeComment ("UserLabelCode_" + memberVariableName); | |||
| callback | |||
| << "if (labelThatHasChanged == " << memberVariableName | |||
| @@ -125,7 +125,7 @@ public: | |||
| if (s->getSkewFactor() != 1.0) | |||
| r << memberVariableName << "->setSkewFactor (" << s->getSkewFactor() << ");\n"; | |||
| r << T('\n'); | |||
| r << '\n'; | |||
| code.constructorCode += r; | |||
| } | |||
| @@ -144,7 +144,7 @@ public: | |||
| callback << "else "; | |||
| const String memberVariableName (code.document->getComponentLayout()->getComponentMemberVariableName (component)); | |||
| const String userCodeComment (T("UserSliderCode_") + memberVariableName); | |||
| const String userCodeComment ("UserSliderCode_" + memberVariableName); | |||
| callback | |||
| << "if (sliderThatWasMoved == " << memberVariableName | |||
| @@ -150,7 +150,7 @@ public: | |||
| properties.add (new TabMoveProperty (t, document, i, t->getNumTabs())); | |||
| panel.addSection (T("Tab ") + String (i), properties); | |||
| panel.addSection ("Tab " + String (i), properties); | |||
| } | |||
| } | |||
| @@ -161,13 +161,13 @@ public: | |||
| switch (t->getOrientation()) | |||
| { | |||
| case TabbedButtonBar::TabsAtTop: | |||
| return T("TabbedButtonBar::TabsAtTop"); | |||
| return "TabbedButtonBar::TabsAtTop"; | |||
| case TabbedButtonBar::TabsAtBottom: | |||
| return T("TabbedButtonBar::TabsAtBottom"); | |||
| return "TabbedButtonBar::TabsAtBottom"; | |||
| case TabbedButtonBar::TabsAtLeft: | |||
| return T("TabbedButtonBar::TabsAtLeft"); | |||
| return "TabbedButtonBar::TabsAtLeft"; | |||
| case TabbedButtonBar::TabsAtRight: | |||
| return T("TabbedButtonBar::TabsAtRight"); | |||
| return "TabbedButtonBar::TabsAtRight"; | |||
| default: | |||
| jassertfalse | |||
| break; | |||
| @@ -197,7 +197,7 @@ public: | |||
| if (doc != 0) | |||
| { | |||
| code.includeFilesCPP.add (getTabJucerFile (t, i).replace (T(".cpp"), T(".h"))); | |||
| code.includeFilesCPP.add (getTabJucerFile (t, i).replace (".cpp", ".h")); | |||
| contentClassName = doc->getClassName(); | |||
| delete doc; | |||
| @@ -239,16 +239,16 @@ public: | |||
| //============================================================================== | |||
| static void addNewTab (TabbedComponent* tc, const int insertIndex = -1) | |||
| { | |||
| tc->addTab (T("Tab ") + String (tc->getNumTabs()), Colours::lightgrey, | |||
| tc->addTab ("Tab " + String (tc->getNumTabs()), Colours::lightgrey, | |||
| new TabDemoContentComp(), true, insertIndex); | |||
| } | |||
| //============================================================================== | |||
| static XmlElement* getTabState (TabbedComponent* tc, int tabIndex) | |||
| { | |||
| XmlElement* xml = new XmlElement (T("TAB")); | |||
| xml->setAttribute (T("name"), tc->getTabNames() [tabIndex]); | |||
| setColourXml (*xml, T("colour"), tc->getTabBackgroundColour (tabIndex)); | |||
| XmlElement* xml = new XmlElement ("TAB"); | |||
| xml->setAttribute ("name", tc->getTabNames() [tabIndex]); | |||
| setColourXml (*xml, "colour", tc->getTabBackgroundColour (tabIndex)); | |||
| TabDemoContentComp* const tdc = dynamic_cast <TabDemoContentComp*> (tc->getTabContentComponent (tabIndex)); | |||
| jassert (tdc != 0); | |||
| @@ -266,8 +266,8 @@ public: | |||
| static void restoreTabState (TabbedComponent* tc, int tabIndex, const XmlElement& xml) | |||
| { | |||
| tc->setTabName (tabIndex, xml.getStringAttribute (T("name"), T("Tab"))); | |||
| tc->setTabBackgroundColour (tabIndex, getColourXml (xml, T("colour"), Colours::lightgrey)); | |||
| tc->setTabName (tabIndex, xml.getStringAttribute ("name", "Tab")); | |||
| tc->setTabBackgroundColour (tabIndex, getColourXml (xml, "colour", Colours::lightgrey)); | |||
| TabDemoContentComp* const tdc = dynamic_cast <TabDemoContentComp*> (tc->getTabContentComponent (tabIndex)); | |||
| jassert (tdc != 0); | |||
| @@ -524,13 +524,13 @@ private: | |||
| : ComponentChoiceProperty <TabbedComponent> (T("initial tab"), comp, document) | |||
| { | |||
| for (int i = 0; i < comp->getNumTabs(); ++i) | |||
| choices.add (T("Tab ") + String (i) + T(": \"") + comp->getTabNames() [i] + T("\"")); | |||
| choices.add ("Tab " + String (i) + ": \"" + comp->getTabNames() [i] + "\""); | |||
| } | |||
| void setIndex (int newIndex) | |||
| { | |||
| document.perform (new InitialTabChangeAction (component, *document.getComponentLayout(), newIndex), | |||
| T("Change initial tab")); | |||
| "Change initial tab"); | |||
| } | |||
| int getIndex() const | |||
| @@ -711,8 +711,8 @@ private: | |||
| PopupMenu m; | |||
| for (int i = 0; i < component->getNumTabs(); ++i) | |||
| m.addItem (i + 1, T("Delete tab ") + String (i) | |||
| + T(": \"") + names[i] + T("\"")); | |||
| m.addItem (i + 1, "Delete tab " + String (i) | |||
| + ": \"" + names[i] + "\""); | |||
| const int r = m.showAt (this); | |||
| @@ -993,7 +993,7 @@ private: | |||
| { | |||
| document.perform (new JucerCompFileChangeAction (component, *document.getComponentLayout(), tabIndex, | |||
| newFile.getRelativePathFrom (document.getFile().getParentDirectory()) | |||
| .replaceCharacter (T('\\'), T('/'))), | |||
| .replaceCharacter ('\\', '/')), | |||
| T("Change tab component file")); | |||
| } | |||
| @@ -88,7 +88,7 @@ public: | |||
| String s; | |||
| s << getColourIntialisationCode (component, memberVariableName) | |||
| << T('\n'); | |||
| << '\n'; | |||
| code.constructorCode += s; | |||
| } | |||
| @@ -143,7 +143,7 @@ private: | |||
| : name (name_) | |||
| { | |||
| for (int i = 0; i < numItems; ++i) | |||
| addSubItem (new DemoTreeViewItem (T("Demo sub-node ") + String (i), numItems - 1)); | |||
| addSubItem (new DemoTreeViewItem ("Demo sub-node " + String (i), numItems - 1)); | |||
| } | |||
| ~DemoTreeViewItem() | |||
| @@ -154,7 +154,7 @@ public: | |||
| { | |||
| code.includeFilesCPP.add (doc->getFile().withFileExtension (T("h")) | |||
| .getRelativePathFrom (code.document->getFile().getParentDirectory()) | |||
| .replaceCharacter (T('\\'), T('/'))); | |||
| .replaceCharacter ('\\', '/')); | |||
| className = doc->getClassName(); | |||
| delete doc; | |||
| @@ -518,7 +518,7 @@ private: | |||
| { | |||
| document.perform (new JucerCompFileChangeAction (component, *document.getComponentLayout(), | |||
| newFile.getRelativePathFrom (document.getFile().getParentDirectory()) | |||
| .replaceCharacter (T('\\'), T('/')) | |||
| .replaceCharacter ('\\', '/') | |||
| ), | |||
| T("Change Jucer component file")); | |||
| } | |||
| @@ -63,11 +63,11 @@ ButtonDocument::~ButtonDocument() | |||
| delete paintRoutines [i]; | |||
| } | |||
| static const tchar* const stateNames[] = | |||
| static const char* const stateNames[] = | |||
| { | |||
| T("normal"), T("over"), T("down"), | |||
| T("normal on"), T("over on"), T("down on"), | |||
| T("common background") | |||
| "normal", "over", "down", | |||
| "normal on", "over on", "down on", | |||
| "common background" | |||
| }; | |||
| int stateNameToIndex (const String& name) | |||
| @@ -243,21 +243,21 @@ void BinaryResources::loadFromCpp (const File& cppFileLocation, const String& cp | |||
| .fromFirstOccurrenceOf (T("{"), false, false)); | |||
| MemoryOutputStream out; | |||
| const tchar* t = (const tchar*) dataString; | |||
| const juce_wchar* t = (const juce_wchar*) dataString; | |||
| int n = 0; | |||
| while (*t != 0) | |||
| { | |||
| const tchar c = *t++; | |||
| const juce_wchar c = *t++; | |||
| if (c >= T('0') && c <= T('9')) | |||
| n = n * 10 + (c - T('0')); | |||
| else if (c == T(',')) | |||
| if (c >= '0' && c <= '9') | |||
| n = n * 10 + (c - '0'); | |||
| else if (c == ',') | |||
| { | |||
| out.writeByte ((char) n); | |||
| n = 0; | |||
| } | |||
| else if (c == T('}')) | |||
| else if (c == '}') | |||
| break; | |||
| } | |||
| @@ -299,7 +299,7 @@ void BinaryResources::fillInGeneratedCode (GeneratedCode& code) const | |||
| << ", \"" | |||
| << File (resources[i]->originalFilename) | |||
| .getRelativePathFrom (code.document->getFile()) | |||
| .replaceCharacter (T('\\'), T('/')) | |||
| .replaceCharacter ('\\', '/') | |||
| << "\"\n"; | |||
| String line1; | |||
| @@ -238,7 +238,7 @@ void ComponentLayout::componentToFront (Component* comp, const bool undoable) | |||
| if (comp != 0 && components.contains (comp)) | |||
| { | |||
| if (undoable) | |||
| perform (new FrontBackCompAction (comp, *this, -1), T("Move components to front")); | |||
| perform (new FrontBackCompAction (comp, *this, -1), "Move components to front"); | |||
| else | |||
| moveComponentZOrder (components.indexOf (comp), -1); | |||
| } | |||
| @@ -249,7 +249,7 @@ void ComponentLayout::componentToBack (Component* comp, const bool undoable) | |||
| if (comp != 0 && components.contains (comp)) | |||
| { | |||
| if (undoable) | |||
| perform (new FrontBackCompAction (comp, *this, 0), T("Move components to back")); | |||
| perform (new FrontBackCompAction (comp, *this, 0), "Move components to back"); | |||
| else | |||
| moveComponentZOrder (components.indexOf (comp), 0); | |||
| } | |||
| @@ -257,7 +257,7 @@ void ComponentLayout::componentToBack (Component* comp, const bool undoable) | |||
| //============================================================================== | |||
| const tchar* const ComponentLayout::clipboardXmlTag = T("COMPONENTS"); | |||
| const char* const ComponentLayout::clipboardXmlTag = "COMPONENTS"; | |||
| void ComponentLayout::copySelectedToClipboard() | |||
| { | |||
| @@ -447,7 +447,7 @@ Component* ComponentLayout::findComponentWithId (const int64 componentId) const | |||
| } | |||
| //============================================================================== | |||
| static const tchar* const dimensionSuffixes[] = { T("X"), T("Y"), T("W"), T("H") }; | |||
| static const char* const dimensionSuffixes[] = { "X", "Y", "W", "H" }; | |||
| Component* ComponentLayout::getComponentRelativePosTarget (Component* comp, int whichDimension) const | |||
| { | |||
| @@ -472,8 +472,7 @@ Component* ComponentLayout::getComponentRelativePosTarget (Component* comp, int | |||
| } | |||
| else | |||
| { | |||
| return findComponentWithId (comp->getProperties() [String (T("relativeTo")) | |||
| + dimensionSuffixes [whichDimension]] | |||
| return findComponentWithId (comp->getProperties() [String ("relativeTo") + dimensionSuffixes [whichDimension]] | |||
| .toString().getHexValue64()); | |||
| } | |||
| } | |||
| @@ -560,8 +559,8 @@ PopupMenu ComponentLayout::getRelativeTargetMenu (Component* comp, int whichDime | |||
| if (c != comp) | |||
| { | |||
| m.addItem (menuIdBase + i + 1, | |||
| T("Relative to ") + getComponentMemberVariableName (c) | |||
| + T(" (class: ") + ComponentTypeHandler::getHandlerFor (*c)->getClassName (c) + T(")"), | |||
| "Relative to " + getComponentMemberVariableName (c) | |||
| + " (class: " + ComponentTypeHandler::getHandlerFor (*c)->getClassName (c) + ")", | |||
| ! dependsOnComponentForRelativePos (c, comp), | |||
| current == c); | |||
| } | |||
| @@ -87,7 +87,7 @@ public: | |||
| //============================================================================== | |||
| SelectedItemSet <Component*>& getSelectedSet() { return selected; } | |||
| static const tchar* const clipboardXmlTag; | |||
| static const char* const clipboardXmlTag; | |||
| void copySelectedToClipboard(); | |||
| void paste(); | |||
| void deleteSelected(); | |||
| @@ -51,11 +51,11 @@ String& GeneratedCode::getCallbackCode (const String& requiredParentClass, | |||
| { | |||
| String parentClass (requiredParentClass); | |||
| if (parentClass.isNotEmpty() | |||
| && ! (parentClass.startsWith (T("public ")) | |||
| || parentClass.startsWith (T("private ")) | |||
| || parentClass.startsWith (T("protected ")))) | |||
| && ! (parentClass.startsWith ("public ") | |||
| || parentClass.startsWith ("private ") | |||
| || parentClass.startsWith ("protected "))) | |||
| { | |||
| parentClass = T("public ") + parentClass; | |||
| parentClass = "public " + parentClass; | |||
| } | |||
| for (int i = callbacks.size(); --i >= 0;) | |||
| @@ -91,7 +91,7 @@ void GeneratedCode::removeCallback (const String& returnType, const String& prot | |||
| void GeneratedCode::addImageResourceLoader (const String& imageMemberName, const String& resourceName) | |||
| { | |||
| const String initialiser (imageMemberName + T(" (0)")); | |||
| const String initialiser (imageMemberName + " (0)"); | |||
| if (! initialisers.contains (initialiser, false)) | |||
| { | |||
| @@ -144,8 +144,8 @@ const String GeneratedCode::getCallbackDefinitions() const | |||
| { | |||
| CallbackMethod* const cm = callbacks.getUnchecked(i); | |||
| const String userCodeBlockName (T("User") | |||
| + makeValidCppIdentifier (cm->prototype.upToFirstOccurrenceOf (T("("), false, false), | |||
| const String userCodeBlockName ("User" | |||
| + makeValidCppIdentifier (cm->prototype.upToFirstOccurrenceOf ("(", false, false), | |||
| true, true, false).trim()); | |||
| if (userCodeBlockName.isNotEmpty() && cm->hasPrePostUserSections) | |||
| @@ -180,13 +180,13 @@ const String GeneratedCode::getClassDeclaration() const | |||
| parentClassLines.removeEmptyStrings(); | |||
| parentClassLines.removeDuplicates (false); | |||
| if (parentClassLines.contains (T("public Button"), false)) | |||
| parentClassLines.removeString (("public Component"), false); | |||
| if (parentClassLines.contains ("public Button", false)) | |||
| parentClassLines.removeString ("public Component", false); | |||
| String r (T("class ")); | |||
| r << className << T(" : "); | |||
| String r ("class "); | |||
| r << className << " : "; | |||
| r += parentClassLines.joinIntoString (T(",\n") + String::repeatedString (T(" "), r.length())); | |||
| r += parentClassLines.joinIntoString (",\n" + String::repeatedString (" ", r.length())); | |||
| return r; | |||
| } | |||
| @@ -213,7 +213,7 @@ const String GeneratedCode::getInitialiserList() const | |||
| { | |||
| String init (inits[i]); | |||
| while (init.endsWithChar (T(','))) | |||
| while (init.endsWithChar (',')) | |||
| init = init.dropLastCharacters (1); | |||
| s << init; | |||
| @@ -246,7 +246,7 @@ static void replaceTemplate (String& text, const String& itemName, const String& | |||
| { | |||
| for (;;) | |||
| { | |||
| const int index = text.indexOf (T("%%") + itemName + T("%%")); | |||
| const int index = text.indexOf ("%%" + itemName + "%%"); | |||
| if (index < 0) | |||
| break; | |||
| @@ -255,7 +255,7 @@ static void replaceTemplate (String& text, const String& itemName, const String& | |||
| for (int i = index; --i >= 0;) | |||
| { | |||
| if (text[i] == T('\n')) | |||
| if (text[i] == '\n') | |||
| break; | |||
| ++indentLevel; | |||
| @@ -269,12 +269,12 @@ static void replaceTemplate (String& text, const String& itemName, const String& | |||
| //============================================================================== | |||
| static bool getUserSection (const StringArray& lines, const String& tag, StringArray& resultLines) | |||
| { | |||
| const int start = indexOfLineStartingWith (lines, T("//[") + tag + T("]"), 0); | |||
| const int start = indexOfLineStartingWith (lines, "//[" + tag + "]", 0); | |||
| if (start < 0) | |||
| return false; | |||
| const int end = indexOfLineStartingWith (lines, T("//[/") + tag + T("]"), start + 1); | |||
| const int end = indexOfLineStartingWith (lines, "//[/" + tag + "]", start + 1); | |||
| for (int i = start + 1; i < end; ++i) | |||
| resultLines.add (lines [i]); | |||
| @@ -290,17 +290,17 @@ static void copyAcrossUserSections (String& dest, const String& src) | |||
| for (int i = 0; i < dstLines.size(); ++i) | |||
| { | |||
| if (dstLines[i].trimStart().startsWith (T("//["))) | |||
| if (dstLines[i].trimStart().startsWith ("//[")) | |||
| { | |||
| String tag (dstLines[i].trimStart().substring (3)); | |||
| tag = tag.upToFirstOccurrenceOf (T("]"), false, false); | |||
| tag = tag.upToFirstOccurrenceOf ("]", false, false); | |||
| jassert (! tag.startsWithChar (T('/'))); | |||
| jassert (! tag.startsWithChar ('/')); | |||
| if (! tag.startsWithChar (T('/'))) | |||
| if (! tag.startsWithChar ('/')) | |||
| { | |||
| const int endLine = indexOfLineStartingWith (dstLines, | |||
| T("//[/") + tag + T("]"), | |||
| "//[/" + tag + "]", | |||
| i + 1); | |||
| if (endLine > i) | |||
| @@ -329,7 +329,7 @@ static void copyAcrossUserSections (String& dest, const String& src) | |||
| dstLines.set (i, dstLines[i].trimEnd()); | |||
| } | |||
| dest = dstLines.joinIntoString (T("\n")) + T("\n"); | |||
| dest = dstLines.joinIntoString ("\n") + "\n"; | |||
| } | |||
| //============================================================================== | |||
| @@ -340,8 +340,8 @@ void GeneratedCode::applyToCode (String& code, | |||
| { | |||
| // header guard.. | |||
| String headerGuard ("__JUCER_HEADER_"); | |||
| headerGuard << className.toUpperCase().retainCharacters (T("ABCDEFGHIJKLMNOPQRSTUVWXYZ")) | |||
| << "_" << fileNameRoot.toUpperCase().retainCharacters (T("ABCDEFGHIJKLMNOPQRSTUVWXYZ")) | |||
| headerGuard << className.toUpperCase().retainCharacters ("ABCDEFGHIJKLMNOPQRSTUVWXYZ") | |||
| << "_" << fileNameRoot.toUpperCase().retainCharacters ("ABCDEFGHIJKLMNOPQRSTUVWXYZ") | |||
| << "_" << String::toHexString (Random::getSystemRandom().nextInt()).toUpperCase() | |||
| << "__"; | |||
| replaceTemplate (code, "headerGuard", headerGuard); | |||
| @@ -28,16 +28,16 @@ | |||
| #include "jucer_ObjectTypes.h" | |||
| #include "../ui/jucer_TestComponent.h" | |||
| const tchar* const defaultClassName = T("NewJucerComponent"); | |||
| const tchar* const defaultParentClasses = T("public Component"); | |||
| const char* const defaultClassName = "NewJucerComponent"; | |||
| const char* const defaultParentClasses = "public Component"; | |||
| static const int timerInterval = 150; | |||
| //============================================================================== | |||
| JucerDocument::JucerDocument() | |||
| : FileBasedDocument (T(".cpp"), T("*.cpp"), | |||
| T("Open a Jucer C++ file..."), | |||
| T("Save as a Jucer C++ file...")), | |||
| : FileBasedDocument (".cpp", "*.cpp", | |||
| "Open a Jucer C++ file...", | |||
| "Save as a Jucer C++ file..."), | |||
| className (defaultClassName), | |||
| parentClasses (defaultParentClasses), | |||
| fixedSize (false), | |||
| @@ -325,7 +325,7 @@ void JucerDocument::addExtraClassProperties (PropertyPanel* panel) | |||
| } | |||
| //============================================================================== | |||
| const tchar* const JucerDocument::jucerCompXmlTag = T("JUCER_COMPONENT"); | |||
| const char* const JucerDocument::jucerCompXmlTag = "JUCER_COMPONENT"; | |||
| XmlElement* JucerDocument::createXml() const | |||
| { | |||
| @@ -376,21 +376,21 @@ bool JucerDocument::loadFromXml (const XmlElement& xml) | |||
| initialWidth = xml.getIntAttribute (T("initialWidth"), 300); | |||
| initialHeight = xml.getIntAttribute (T("initialHeight"), 200); | |||
| snapGridPixels = xml.getIntAttribute (T("snapPixels"), snapGridPixels); | |||
| snapActive = xml.getBoolAttribute (T("snapActive"), snapActive); | |||
| snapShown = xml.getBoolAttribute (T("snapShown"), snapShown); | |||
| snapGridPixels = xml.getIntAttribute ("snapPixels", snapGridPixels); | |||
| snapActive = xml.getBoolAttribute ("snapActive", snapActive); | |||
| snapShown = xml.getBoolAttribute ("snapShown", snapShown); | |||
| componentOverlayOpacity = (float) xml.getDoubleAttribute (T("overlayOpacity"), 0.0); | |||
| componentOverlayOpacity = (float) xml.getDoubleAttribute ("overlayOpacity", 0.0); | |||
| activeExtraMethods.clear(); | |||
| XmlElement* const methods = xml.getChildByName T("METHODS"); | |||
| XmlElement* const methods = xml.getChildByName ("METHODS"); | |||
| if (methods != 0) | |||
| { | |||
| forEachXmlChildElementWithTagName (*methods, e, T("METHOD")) | |||
| forEachXmlChildElementWithTagName (*methods, e, "METHOD") | |||
| { | |||
| activeExtraMethods.addIfNotAlreadyThere (e->getStringAttribute (T("name"))); | |||
| activeExtraMethods.addIfNotAlreadyThere (e->getStringAttribute ("name")); | |||
| } | |||
| } | |||
| @@ -433,8 +433,8 @@ const String JucerDocument::loadDocument (const File& file) | |||
| const String JucerDocument::saveDocument (const File& file) | |||
| { | |||
| const File cppFile (file.withFileExtension (T(".cpp"))); | |||
| const File hFile (file.withFileExtension (T(".h"))); | |||
| const File cppFile (file.withFileExtension (".cpp")); | |||
| const File hFile (file.withFileExtension (".h")); | |||
| String templateH, templateCpp; | |||
| @@ -498,13 +498,13 @@ void JucerDocument::fillInGeneratedCode (GeneratedCode& code) const | |||
| code.initialisers.addLines (variableInitialisers); | |||
| if (! componentName.isEmpty()) | |||
| code.parentClassInitialiser = T("Component (") + quotedString (code.componentName) + T(")"); | |||
| code.parentClassInitialiser = "Component (" + quotedString (code.componentName) + ")"; | |||
| // call these now, just to make sure they're the first two methods in the list. | |||
| code.getCallbackCode (String::empty, T("void"), T("paint (Graphics& g)"), false) | |||
| code.getCallbackCode (String::empty, "void", "paint (Graphics& g)", false) | |||
| << "//[UserPrePaint] Add your own custom painting code here..\n//[/UserPrePaint]\n\n"; | |||
| code.getCallbackCode (String::empty, T("void"), T("resized()"), false); | |||
| code.getCallbackCode (String::empty, "void", "resized()", false); | |||
| if (getComponentLayout() != 0) | |||
| getComponentLayout()->fillInGeneratedCode (code); | |||
| @@ -551,8 +551,8 @@ void JucerDocument::fillInGeneratedCode (GeneratedCode& code) const | |||
| << "] -- Add your code here...\n" | |||
| << initialContents[i]; | |||
| if (initialContents[i].isNotEmpty() && ! initialContents[i].endsWithChar (T('\n'))) | |||
| s << T('\n'); | |||
| if (initialContents[i].isNotEmpty() && ! initialContents[i].endsWithChar ('\n')) | |||
| s << '\n'; | |||
| s << "//[/" | |||
| << userCommentTag | |||
| @@ -585,8 +585,8 @@ bool JucerDocument::findTemplateFiles (String& templateH, String& templateCpp) c | |||
| templateH = hTemplate.loadFileAsString(); | |||
| templateCpp = cppTemplate.loadFileAsString(); | |||
| const String jucerVersionString (T("Jucer version: ") + String (JUCER_MAJOR_VERSION) | |||
| + T(".") + String (JUCER_MINOR_VERSION)); | |||
| const String jucerVersionString ("Jucer version: " + String (JUCER_MAJOR_VERSION) | |||
| + "." + String (JUCER_MINOR_VERSION)); | |||
| // This checks the template files to see if they're the ones that shipped with this | |||
| // version of the jucer. If it fails, you're probably using the wrong ones. | |||
| @@ -626,7 +626,7 @@ static const String fixNewLines (const String& s) | |||
| while (lines.size() > 0 && lines [lines.size() - 1].trim().isEmpty()) | |||
| lines.remove (lines.size() - 1); | |||
| return lines.joinIntoString (T("\r\n")) + T("\r\n"); | |||
| return lines.joinIntoString ("\r\n") + "\r\n"; | |||
| } | |||
| bool JucerDocument::writeCodeFiles (const File& headerFile, | |||
| @@ -124,7 +124,7 @@ public: | |||
| float getComponentOverlayOpacity() const throw() { return componentOverlayOpacity; } | |||
| //============================================================================== | |||
| static const tchar* const jucerCompXmlTag; | |||
| static const char* const jucerCompXmlTag; | |||
| /** Creates the document's metadata xml section. | |||
| @@ -58,14 +58,14 @@ namespace ObjectTypes | |||
| { | |||
| //============================================================================== | |||
| static const tchar* const documentNames[] = | |||
| static const char* const documentNames[] = | |||
| { | |||
| T("Component"), | |||
| T("Button"), | |||
| "Component", | |||
| "Button", | |||
| 0 | |||
| }; | |||
| const tchar** const documentTypeNames = (const tchar**) documentNames; | |||
| const char** const documentTypeNames = (const char**) documentNames; | |||
| const int numDocumentTypes = numElementsInArray (documentNames) - 1; | |||
| JucerDocument* createNewDocument (const int index) | |||
| @@ -142,18 +142,18 @@ JucerDocument* loadDocumentFromFile (const File& f, const bool showErrorMessage) | |||
| } | |||
| //============================================================================== | |||
| static const tchar* const elementNames[] = | |||
| static const char* const elementNames[] = | |||
| { | |||
| T("Rectangle"), | |||
| T("Rounded Rectangle"), | |||
| T("Ellipse"), | |||
| T("Path"), | |||
| T("Image"), | |||
| T("Text"), | |||
| "Rectangle", | |||
| "Rounded Rectangle", | |||
| "Ellipse", | |||
| "Path", | |||
| "Image", | |||
| "Text", | |||
| 0 | |||
| }; | |||
| const tchar** const elementTypeNames = (const tchar**) elementNames; | |||
| const char** const elementTypeNames = (const char**) elementNames; | |||
| const int numElementTypes = (sizeof (elementNames) / sizeof (elementNames[0])) - 1; | |||
| PaintElement* createNewElement (const int index, PaintRoutine* owner) | |||
| @@ -42,7 +42,7 @@ namespace ObjectTypes | |||
| /** | |||
| Documents. | |||
| */ | |||
| extern const tchar** const documentTypeNames; | |||
| extern const char** const documentTypeNames; | |||
| extern const int numDocumentTypes; | |||
| JucerDocument* createNewDocument (const int index); | |||
| @@ -59,7 +59,7 @@ namespace ObjectTypes | |||
| /** | |||
| Elements. | |||
| */ | |||
| extern const tchar** const elementTypeNames; | |||
| extern const char** const elementTypeNames; | |||
| extern const int numElementTypes; | |||
| PaintElement* createNewElement (const int index, PaintRoutine* owner); | |||
| @@ -146,7 +146,7 @@ PaintElement* PaintRoutine::addElementFromXml (const XmlElement& xml, const int | |||
| if (undoable) | |||
| { | |||
| AddXmlElementAction* action = new AddXmlElementAction (*this, new XmlElement (xml)); | |||
| perform (action, T("Add new element")); | |||
| perform (action, "Add new element"); | |||
| return elements [action->indexAdded]; | |||
| } | |||
| @@ -291,7 +291,7 @@ void PaintRoutine::elementToFront (PaintElement* element, const bool undoable) | |||
| if (element != 0 && elements.contains (element)) | |||
| { | |||
| if (undoable) | |||
| perform (new FrontOrBackElementAction (element, -1), T("Move elements to front")); | |||
| perform (new FrontOrBackElementAction (element, -1), "Move elements to front"); | |||
| else | |||
| moveElementZOrder (elements.indexOf (element), -1); | |||
| } | |||
| @@ -302,14 +302,14 @@ void PaintRoutine::elementToBack (PaintElement* element, const bool undoable) | |||
| if (element != 0 && elements.contains (element)) | |||
| { | |||
| if (undoable) | |||
| perform (new FrontOrBackElementAction (element, 0), T("Move elements to back")); | |||
| perform (new FrontOrBackElementAction (element, 0), "Move elements to back"); | |||
| else | |||
| moveElementZOrder (elements.indexOf (element), 0); | |||
| } | |||
| } | |||
| //============================================================================== | |||
| const tchar* const PaintRoutine::clipboardXmlTag = T("PAINTELEMENTS"); | |||
| const char* const PaintRoutine::clipboardXmlTag = "PAINTELEMENTS"; | |||
| void PaintRoutine::copySelectedToClipboard() | |||
| { | |||
| @@ -585,7 +585,7 @@ void PaintRoutine::dropImageAt (const File& f, int x, int y) | |||
| } | |||
| //============================================================================== | |||
| const tchar* PaintRoutine::xmlTagName = T("BACKGROUND"); | |||
| const char* PaintRoutine::xmlTagName = "BACKGROUND"; | |||
| XmlElement* PaintRoutine::createXml() const | |||
| { | |||
| @@ -74,7 +74,7 @@ public: | |||
| SelectedItemSet <PaintElement*>& getSelectedElements() throw() { return selectedElements; } | |||
| SelectedItemSet <PathPoint*>& getSelectedPoints() throw() { return selectedPoints; } | |||
| static const tchar* const clipboardXmlTag; | |||
| static const char* const clipboardXmlTag; | |||
| void copySelectedToClipboard(); | |||
| void paste(); | |||
| void deleteSelected(); | |||
| @@ -97,7 +97,7 @@ public: | |||
| JucerDocument* getDocument() const throw() { return document; } | |||
| //============================================================================== | |||
| static const tchar* xmlTagName; | |||
| static const char* xmlTagName; | |||
| XmlElement* createXml() const; | |||
| bool loadFromXml (const XmlElement& xml); | |||
| @@ -99,7 +99,7 @@ public: | |||
| } | |||
| } | |||
| static const tchar* getTagName() throw() { return T("ELLIPSE"); } | |||
| static const char* getTagName() throw() { return "ELLIPSE"; } | |||
| XmlElement* createXml() const | |||
| { | |||
| @@ -193,7 +193,7 @@ public: | |||
| subElements.getUnchecked(i)->fillInGeneratedCode (code, paintMethodCode); | |||
| } | |||
| static const tchar* getTagName() throw() { return T("GROUP"); } | |||
| static const char* getTagName() throw() { return "GROUP"; } | |||
| XmlElement* createXml() const | |||
| { | |||
| @@ -153,7 +153,7 @@ public: | |||
| { | |||
| if (resourceName.isNotEmpty()) | |||
| { | |||
| const String imageVariable (T("drawable") + String (code.getUniqueSuffix())); | |||
| const String imageVariable (L"drawable" + String (code.getUniqueSuffix())); | |||
| code.privateMemberDeclarations | |||
| << "Drawable* " << imageVariable << ";\n"; | |||
| @@ -299,7 +299,7 @@ public: | |||
| double getOpacity() const throw() { return opacity; } | |||
| //============================================================================== | |||
| static const tchar* getTagName() throw() { return T("IMAGE"); } | |||
| static const char* getTagName() throw() { return "IMAGE"; } | |||
| void resetToImageSize() | |||
| { | |||
| @@ -380,7 +380,7 @@ void PaintElementPath::fillInGeneratedCode (GeneratedCode& code, String& paintMe | |||
| if (fillType.isInvisible() && (strokeType.isInvisible() || ! isStrokePresent)) | |||
| return; | |||
| const String pathVariable (T("internalPath") + String (code.getUniqueSuffix())); | |||
| const String pathVariable ("internalPath" + String (code.getUniqueSuffix())); | |||
| const ComponentLayout* layout = code.document->getComponentLayout(); | |||
| @@ -1196,14 +1196,14 @@ class PathPointTypeProperty : public ChoicePropertyComponent, | |||
| public: | |||
| PathPointTypeProperty (PaintElementPath* const owner_, | |||
| const int index_) | |||
| : ChoicePropertyComponent (T("point type")), | |||
| : ChoicePropertyComponent ("point type"), | |||
| owner (owner_), | |||
| index (index_) | |||
| { | |||
| choices.add (T("Start of sub-path")); | |||
| choices.add (T("Line")); | |||
| choices.add (T("Quadratic")); | |||
| choices.add (T("Cubic")); | |||
| choices.add ("Start of sub-path"); | |||
| choices.add ("Line"); | |||
| choices.add ("Quadratic"); | |||
| choices.add ("Cubic"); | |||
| owner->getDocument()->addChangeListener (this); | |||
| } | |||
| @@ -1330,14 +1330,14 @@ class PathPointClosedProperty : public ChoicePropertyComponent, | |||
| { | |||
| public: | |||
| PathPointClosedProperty (PaintElementPath* const owner_, const int index_) | |||
| : ChoicePropertyComponent (T("openness")), | |||
| : ChoicePropertyComponent ("openness"), | |||
| owner (owner_), | |||
| index (index_) | |||
| { | |||
| owner->getDocument()->addChangeListener (this); | |||
| choices.add (T("Subpath is closed")); | |||
| choices.add (T("Subpath is open-ended")); | |||
| choices.add ("Subpath is closed"); | |||
| choices.add ("Subpath is open-ended"); | |||
| } | |||
| ~PathPointClosedProperty() | |||
| @@ -1370,7 +1370,7 @@ class AddNewPointProperty : public ButtonPropertyComponent | |||
| { | |||
| public: | |||
| AddNewPointProperty (PaintElementPath* const owner_, const int index_) | |||
| : ButtonPropertyComponent (T("new point"), false), | |||
| : ButtonPropertyComponent ("new point", false), | |||
| owner (owner_), | |||
| index (index_) | |||
| { | |||
| @@ -1383,7 +1383,7 @@ public: | |||
| owner->addPoint (index, true); | |||
| } | |||
| const String getButtonText() const { return T("Add new point"); } | |||
| const String getButtonText() const { return "Add new point"; } | |||
| private: | |||
| PaintElementPath* const owner; | |||
| @@ -1492,7 +1492,7 @@ void PathPoint::changePointType (const Path::Iterator::PathElementType newType, | |||
| if (undoable) | |||
| { | |||
| owner->perform (new ChangePointAction (this, withChangedPointType (newType, parentArea)), | |||
| T("Change path point type")); | |||
| "Change path point type"); | |||
| } | |||
| else | |||
| { | |||
| @@ -1510,8 +1510,8 @@ void PathPoint::getEditableProperties (Array <PropertyComponent*>& properties) | |||
| switch (type) | |||
| { | |||
| case Path::Iterator::startNewSubPath: | |||
| properties.add (new PathPointPositionProperty (owner, index, 0, T("x"), PositionPropertyBase::componentX)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 0, T("y"), PositionPropertyBase::componentY)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 0, "x", PositionPropertyBase::componentX)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 0, "y", PositionPropertyBase::componentY)); | |||
| properties.add (new PathPointClosedProperty (owner, index)); | |||
| properties.add (new AddNewPointProperty (owner, index)); | |||
| @@ -1519,28 +1519,28 @@ void PathPoint::getEditableProperties (Array <PropertyComponent*>& properties) | |||
| case Path::Iterator::lineTo: | |||
| properties.add (new PathPointTypeProperty (owner, index)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 0, T("x"), PositionPropertyBase::componentX)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 0, T("y"), PositionPropertyBase::componentY)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 0, "x", PositionPropertyBase::componentX)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 0, "y", PositionPropertyBase::componentY)); | |||
| properties.add (new AddNewPointProperty (owner, index)); | |||
| break; | |||
| case Path::Iterator::quadraticTo: | |||
| properties.add (new PathPointTypeProperty (owner, index)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 0, T("control pt x"), PositionPropertyBase::componentX)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 0, T("control pt y"), PositionPropertyBase::componentY)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 1, T("x"), PositionPropertyBase::componentX)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 1, T("y"), PositionPropertyBase::componentY)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 0, "control pt x", PositionPropertyBase::componentX)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 0, "control pt y", PositionPropertyBase::componentY)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 1, "x", PositionPropertyBase::componentX)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 1, "y", PositionPropertyBase::componentY)); | |||
| properties.add (new AddNewPointProperty (owner, index)); | |||
| break; | |||
| case Path::Iterator::cubicTo: | |||
| properties.add (new PathPointTypeProperty (owner, index)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 0, T("control pt1 x"), PositionPropertyBase::componentX)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 0, T("control pt1 y"), PositionPropertyBase::componentY)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 1, T("control pt2 x"), PositionPropertyBase::componentX)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 1, T("control pt2 y"), PositionPropertyBase::componentY)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 2, T("x"), PositionPropertyBase::componentX)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 2, T("y"), PositionPropertyBase::componentY)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 0, "control pt1 x", PositionPropertyBase::componentX)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 0, "control pt1 y", PositionPropertyBase::componentY)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 1, "control pt2 x", PositionPropertyBase::componentX)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 1, "control pt2 y", PositionPropertyBase::componentY)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 2, "x", PositionPropertyBase::componentX)); | |||
| properties.add (new PathPointPositionProperty (owner, index, 2, "y", PositionPropertyBase::componentY)); | |||
| properties.add (new AddNewPointProperty (owner, index)); | |||
| break; | |||
| @@ -116,7 +116,7 @@ public: | |||
| void fillInGeneratedCode (GeneratedCode& code, String& paintMethodCode); | |||
| //============================================================================== | |||
| static const tchar* getTagName() throw() { return T("PATH"); } | |||
| static const char* getTagName() throw() { return "PATH"; } | |||
| XmlElement* createXml() const; | |||
| bool loadFromXml (const XmlElement& xml); | |||
| @@ -37,7 +37,7 @@ class PaintElementRectangle : public ColouredElement | |||
| public: | |||
| //============================================================================== | |||
| PaintElementRectangle (PaintRoutine* owner) | |||
| : ColouredElement (owner, T("Rectangle"), true, false) | |||
| : ColouredElement (owner, "Rectangle", true, false) | |||
| { | |||
| } | |||
| @@ -107,7 +107,7 @@ public: | |||
| } | |||
| } | |||
| static const tchar* getTagName() throw() { return T("RECT"); } | |||
| static const char* getTagName() throw() { return "RECT"; } | |||
| XmlElement* createXml() const | |||
| { | |||
| @@ -154,7 +154,7 @@ private: | |||
| { | |||
| public: | |||
| ShapeToPathProperty (PaintElementRectangle* const element_) | |||
| : ButtonPropertyComponent (T("path"), false), | |||
| : ButtonPropertyComponent ("path", false), | |||
| element (element_) | |||
| { | |||
| } | |||
| @@ -166,7 +166,7 @@ private: | |||
| const String getButtonText() const | |||
| { | |||
| return T("convert to a path"); | |||
| return "convert to a path"; | |||
| } | |||
| private: | |||
| @@ -156,7 +156,7 @@ public: | |||
| } | |||
| } | |||
| static const tchar* getTagName() throw() { return T("ROUNDRECT"); } | |||
| static const char* getTagName() throw() { return "ROUNDRECT"; } | |||
| XmlElement* createXml() const | |||
| { | |||
| @@ -105,19 +105,19 @@ public: | |||
| } | |||
| } | |||
| static const tchar* getTagName() throw() { return T("TEXT"); } | |||
| static const char* getTagName() throw() { return "TEXT"; } | |||
| XmlElement* createXml() const | |||
| { | |||
| XmlElement* e = new XmlElement (getTagName()); | |||
| position.applyToXml (*e); | |||
| addColourAttributes (e); | |||
| e->setAttribute (T("text"), text); | |||
| e->setAttribute (T("fontname"), typefaceName); | |||
| e->setAttribute (T("fontsize"), roundToInt (font.getHeight() * 100.0) / 100.0); | |||
| e->setAttribute (T("bold"), font.isBold()); | |||
| e->setAttribute (T("italic"), font.isItalic()); | |||
| e->setAttribute (T("justification"), justification.getFlags()); | |||
| e->setAttribute ("text", text); | |||
| e->setAttribute ("fontname", typefaceName); | |||
| e->setAttribute ("fontsize", roundToInt (font.getHeight() * 100.0) / 100.0); | |||
| e->setAttribute ("bold", font.isBold()); | |||
| e->setAttribute ("italic", font.isItalic()); | |||
| e->setAttribute ("justification", justification.getFlags()); | |||
| return e; | |||
| } | |||
| @@ -129,12 +129,12 @@ public: | |||
| position.restoreFromXml (xml, position); | |||
| loadColourAttributes (xml); | |||
| text = xml.getStringAttribute (T("text"), T("Hello World")); | |||
| typefaceName = xml.getStringAttribute (T("fontname"), FontPropertyComponent::defaultFont); | |||
| font.setHeight ((float) xml.getDoubleAttribute (T("fontsize"), 15.0)); | |||
| font.setBold (xml.getBoolAttribute (T("bold"), false)); | |||
| font.setItalic (xml.getBoolAttribute (T("italic"), false)); | |||
| justification = Justification (xml.getIntAttribute (T("justification"), Justification::centred)); | |||
| text = xml.getStringAttribute ("text", "Hello World"); | |||
| typefaceName = xml.getStringAttribute ("fontname", FontPropertyComponent::defaultFont); | |||
| font.setHeight ((float) xml.getDoubleAttribute ("fontsize", 15.0)); | |||
| font.setBold (xml.getBoolAttribute ("bold", false)); | |||
| font.setItalic (xml.getBoolAttribute ("italic", false)); | |||
| justification = Justification (xml.getIntAttribute ("justification", Justification::centred)); | |||
| return true; | |||
| } | |||
| @@ -183,7 +183,7 @@ public: | |||
| if (undoable) | |||
| { | |||
| perform (new SetTextAction (this, t), | |||
| T("Change text element text")); | |||
| "Change text element text"); | |||
| } | |||
| else | |||
| { | |||
| @@ -231,7 +231,7 @@ public: | |||
| if (undoable) | |||
| { | |||
| perform (new SetFontAction (this, newFont), | |||
| T("Change text element font")); | |||
| "Change text element font"); | |||
| } | |||
| else | |||
| { | |||
| @@ -275,7 +275,7 @@ public: | |||
| if (undoable) | |||
| { | |||
| perform (new SetTypefaceAction (this, newFontName), | |||
| T("Change text element typeface")); | |||
| "Change text element typeface"); | |||
| } | |||
| else | |||
| { | |||
| @@ -324,7 +324,7 @@ public: | |||
| if (undoable) | |||
| { | |||
| perform (new SetJustifyAction (this, j), | |||
| T("Change text element justification")); | |||
| "Change text element justification"); | |||
| } | |||
| else | |||
| { | |||
| @@ -373,7 +373,7 @@ private: | |||
| { | |||
| public: | |||
| TextProperty (PaintElementText* const element_) | |||
| : TextPropertyComponent (T("text"), 2048, false), | |||
| : TextPropertyComponent ("text", 2048, false), | |||
| element (element_) | |||
| { | |||
| element->getDocument()->addChangeListener (this); | |||
| @@ -399,7 +399,7 @@ private: | |||
| { | |||
| public: | |||
| FontNameProperty (PaintElementText* const element_) | |||
| : FontPropertyComponent (T("font")), | |||
| : FontPropertyComponent ("font"), | |||
| element (element_) | |||
| { | |||
| element->getDocument()->addChangeListener (this); | |||
| @@ -425,15 +425,15 @@ private: | |||
| { | |||
| public: | |||
| FontStyleProperty (PaintElementText* const element_) | |||
| : ChoicePropertyComponent (T("style")), | |||
| : ChoicePropertyComponent ("style"), | |||
| element (element_) | |||
| { | |||
| element->getDocument()->addChangeListener (this); | |||
| choices.add (T("normal")); | |||
| choices.add (T("bold")); | |||
| choices.add (T("italic")); | |||
| choices.add (T("bold + italic")); | |||
| choices.add ("normal"); | |||
| choices.add ("bold"); | |||
| choices.add ("italic"); | |||
| choices.add ("bold + italic"); | |||
| } | |||
| ~FontStyleProperty() | |||
| @@ -475,7 +475,7 @@ private: | |||
| { | |||
| public: | |||
| FontSizeProperty (PaintElementText* const element_) | |||
| : SliderPropertyComponent (T("size"), 1.0, 250.0, 0.1, 0.3), | |||
| : SliderPropertyComponent ("size", 1.0, 250.0, 0.1, 0.3), | |||
| element (element_) | |||
| { | |||
| element->getDocument()->addChangeListener (this); | |||
| @@ -513,7 +513,7 @@ private: | |||
| { | |||
| public: | |||
| TextJustificationProperty (PaintElementText* const element_) | |||
| : JustificationProperty (T("layout"), false), | |||
| : JustificationProperty ("layout", false), | |||
| element (element_) | |||
| { | |||
| element->getDocument()->addChangeListener (this); | |||
| @@ -545,7 +545,7 @@ private: | |||
| { | |||
| public: | |||
| TextToPathProperty (PaintElementText* const element_) | |||
| : ButtonPropertyComponent (T("path"), false), | |||
| : ButtonPropertyComponent ("path", false), | |||
| element (element_) | |||
| { | |||
| } | |||
| @@ -557,7 +557,7 @@ private: | |||
| const String getButtonText() const | |||
| { | |||
| return T("convert text to a path"); | |||
| return "convert text to a path"; | |||
| } | |||
| private: | |||
| @@ -39,21 +39,21 @@ public: | |||
| { | |||
| if (onlyHorizontalOptions) | |||
| { | |||
| choices.add (T("centre")); | |||
| choices.add (T("left")); | |||
| choices.add (T("right")); | |||
| choices.add ("centre"); | |||
| choices.add ("left"); | |||
| choices.add ("right"); | |||
| } | |||
| else | |||
| { | |||
| choices.add (T("centred")); | |||
| choices.add (T("centred left")); | |||
| choices.add (T("centred right")); | |||
| choices.add (T("centred top")); | |||
| choices.add (T("centred bottom")); | |||
| choices.add (T("top left")); | |||
| choices.add (T("top right")); | |||
| choices.add (T("bottom left")); | |||
| choices.add (T("bottom right")); | |||
| choices.add ("centred"); | |||
| choices.add ("centred left"); | |||
| choices.add ("centred right"); | |||
| choices.add ("centred top"); | |||
| choices.add ("centred bottom"); | |||
| choices.add ("top left"); | |||
| choices.add ("top right"); | |||
| choices.add ("bottom left"); | |||
| choices.add ("bottom right"); | |||
| } | |||
| } | |||
| @@ -82,28 +82,28 @@ public: | |||
| { | |||
| case componentX: | |||
| if (p.getPositionModeX() == PositionedRectangle::proportionOfParentSize) | |||
| s << valueToString (p.getX() * 100.0) << T('%'); | |||
| s << valueToString (p.getX() * 100.0) << '%'; | |||
| else | |||
| s << valueToString (p.getX()); | |||
| break; | |||
| case componentY: | |||
| if (p.getPositionModeY() == PositionedRectangle::proportionOfParentSize) | |||
| s << valueToString (p.getY() * 100.0) << T('%'); | |||
| s << valueToString (p.getY() * 100.0) << '%'; | |||
| else | |||
| s << valueToString (p.getY()); | |||
| break; | |||
| case componentWidth: | |||
| if (p.getWidthMode() == PositionedRectangle::proportionalSize) | |||
| s << valueToString (p.getWidth() * 100.0) << T('%'); | |||
| s << valueToString (p.getWidth() * 100.0) << '%'; | |||
| else | |||
| s << valueToString (p.getWidth()); | |||
| break; | |||
| case componentHeight: | |||
| if (p.getHeightMode() == PositionedRectangle::proportionalSize) | |||
| s << valueToString (p.getHeight() * 100.0) << T('%'); | |||
| s << valueToString (p.getHeight() * 100.0) << '%'; | |||
| else | |||
| s << valueToString (p.getHeight()); | |||
| break; | |||
| @@ -237,16 +237,16 @@ public: | |||
| { | |||
| const PositionedRectangle::SizeMode sizeMode = (dimension == componentWidth) ? sizeW : sizeH; | |||
| m.addItem (20, (dimension == componentWidth) ? T("Absolute width") | |||
| : T("Absolute height"), | |||
| m.addItem (20, (dimension == componentWidth) ? "Absolute width" | |||
| : "Absolute height", | |||
| true, sizeMode == PositionedRectangle::absoluteSize); | |||
| m.addItem (21, ((dimension == componentWidth) ? T("Percentage of width of ") | |||
| : T("Percentage of height of ")) + relCompName, | |||
| m.addItem (21, ((dimension == componentWidth) ? "Percentage of width of " | |||
| : "Percentage of height of ") + relCompName, | |||
| true, sizeMode == PositionedRectangle::proportionalSize); | |||
| m.addItem (22, ((dimension == componentWidth) ? T("Subtracted from width of ") | |||
| : T("Subtracted from height of ")) + relCompName, | |||
| m.addItem (22, ((dimension == componentWidth) ? "Subtracted from width of " | |||
| : "Subtracted from height of ") + relCompName, | |||
| true, sizeMode == PositionedRectangle::parentSizeMinusAbsolute); | |||
| } | |||
| @@ -254,7 +254,7 @@ public: | |||
| if (allowRelativeOptions && layout != 0) | |||
| { | |||
| m.addSeparator(); | |||
| m.addSubMenu (T("Relative to"), layout->getRelativeTargetMenu (component, (int) dimension)); | |||
| m.addSubMenu ("Relative to", layout->getRelativeTargetMenu (component, (int) dimension)); | |||
| } | |||
| const int menuResult = m.showAt (button); | |||
| @@ -70,7 +70,7 @@ namespace CommandIDs | |||
| namespace CommandCategories | |||
| { | |||
| static const tchar* const general = T("General"); | |||
| static const tchar* const editing = T("Editing"); | |||
| static const tchar* const view = T("View"); | |||
| static const char* const general = "General"; | |||
| static const char* const editing = "Editing"; | |||
| static const char* const view = "View"; | |||
| } | |||
| @@ -354,14 +354,14 @@ bool ComponentLayoutEditor::keyPressed (const KeyPress& key) | |||
| bool ComponentLayoutEditor::isInterestedInFileDrag (const StringArray& filenames) | |||
| { | |||
| const File f (filenames [0]); | |||
| return f.hasFileExtension (T(".cpp")); | |||
| return f.hasFileExtension (".cpp"); | |||
| } | |||
| void ComponentLayoutEditor::filesDropped (const StringArray& filenames, int x, int y) | |||
| { | |||
| const File f (filenames [0]); | |||
| if (f.hasFileExtension (T(".cpp"))) | |||
| if (f.hasFileExtension (".cpp")) | |||
| { | |||
| JucerDocument* doc = ObjectTypes::loadDocumentFromFile (f, false); | |||
| @@ -170,7 +170,7 @@ void ComponentOverlayComponent::resizeStart() | |||
| else | |||
| originalAspectRatio = 1.0; | |||
| layout.getDocument()->getUndoManager().beginNewTransaction (T("Resize components")); | |||
| layout.getDocument()->getUndoManager().beginNewTransaction ("Resize components"); | |||
| } | |||
| void ComponentOverlayComponent::resizeEnd() | |||
| @@ -763,8 +763,8 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| { | |||
| const int index = commandID - CommandIDs::newComponentBase; | |||
| result.setInfo (T("New ") + ObjectTypes::componentTypeHandlers [index]->getTypeName(), | |||
| T("Creates a new ") + ObjectTypes::componentTypeHandlers [index]->getTypeName(), | |||
| result.setInfo ("New " + ObjectTypes::componentTypeHandlers [index]->getTypeName(), | |||
| "Creates a new " + ObjectTypes::componentTypeHandlers [index]->getTypeName(), | |||
| CommandCategories::editing, 0); | |||
| return; | |||
| } | |||
| @@ -774,8 +774,8 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| { | |||
| const int index = commandID - CommandIDs::newElementBase; | |||
| result.setInfo (String (T("New ")) + ObjectTypes::elementTypeNames [index], | |||
| String (T("Adds a new ")) + ObjectTypes::elementTypeNames [index], | |||
| result.setInfo (String ("New ") + ObjectTypes::elementTypeNames [index], | |||
| String ("Adds a new ") + ObjectTypes::elementTypeNames [index], | |||
| CommandCategories::editing, 0); | |||
| result.setActive (currentPaintRoutine != 0); | |||
| @@ -795,7 +795,7 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| T("Saves the current component."), | |||
| CommandCategories::general, 0); | |||
| result.defaultKeypresses.add (KeyPress (T('s'), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('s', cmd, 0)); | |||
| break; | |||
| @@ -803,7 +803,7 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| result.setInfo (T("Save As..."), | |||
| T("Saves the current component to a specified file."), | |||
| CommandCategories::general, 0); | |||
| result.defaultKeypresses.add (KeyPress (T('s'), cmd | shift, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('s', cmd | shift, 0)); | |||
| break; | |||
| case CommandIDs::undo: | |||
| @@ -811,7 +811,7 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| T("Undoes the last operation."), | |||
| CommandCategories::editing, 0); | |||
| result.setActive (document->getUndoManager().canUndo()); | |||
| result.defaultKeypresses.add (KeyPress (T('z'), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('z', cmd, 0)); | |||
| break; | |||
| case CommandIDs::redo: | |||
| @@ -819,8 +819,8 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| T("Redoes the last operation."), | |||
| CommandCategories::editing, 0); | |||
| result.setActive (document->getUndoManager().canRedo()); | |||
| result.defaultKeypresses.add (KeyPress (T('z'), cmd | shift, 0)); | |||
| result.defaultKeypresses.add (KeyPress (T('y'), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('z', cmd | shift, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('y', cmd, 0)); | |||
| break; | |||
| case CommandIDs::toFront: | |||
| @@ -828,7 +828,7 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| T("Brings the currently selected component to the front."), | |||
| CommandCategories::editing, 0); | |||
| result.setActive (isSomethingSelected()); | |||
| result.defaultKeypresses.add (KeyPress (T('f'), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('f', cmd, 0)); | |||
| break; | |||
| case CommandIDs::toBack: | |||
| @@ -836,7 +836,7 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| T("Sends the currently selected component to the back."), | |||
| CommandCategories::editing, 0); | |||
| result.setActive (isSomethingSelected()); | |||
| result.defaultKeypresses.add (KeyPress (T('b'), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('b', cmd, 0)); | |||
| break; | |||
| case CommandIDs::group: | |||
| @@ -845,7 +845,7 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| CommandCategories::editing, 0); | |||
| result.setActive (currentPaintRoutine != 0 | |||
| && currentPaintRoutine->getSelectedElements().getNumSelected() > 1); | |||
| result.defaultKeypresses.add (KeyPress (T('k'), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('k', cmd, 0)); | |||
| break; | |||
| case CommandIDs::ungroup: | |||
| @@ -855,14 +855,14 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| result.setActive (currentPaintRoutine != 0 | |||
| && currentPaintRoutine->getSelectedElements().getNumSelected() == 1 | |||
| && currentPaintRoutine->getSelectedElements().getSelectedItem (0)->getTypeName() == T("Group")); | |||
| result.defaultKeypresses.add (KeyPress (T('k'), cmd | shift, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('k', cmd | shift, 0)); | |||
| break; | |||
| case CommandIDs::test: | |||
| result.setInfo (T("Test component..."), | |||
| T("Runs the current component interactively."), | |||
| CommandCategories::view, 0); | |||
| result.defaultKeypresses.add (KeyPress (T('t'), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('t', cmd, 0)); | |||
| break; | |||
| case CommandIDs::enableSnapToGrid: | |||
| @@ -870,7 +870,7 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| T("Toggles whether components' positions are aligned to a grid."), | |||
| CommandCategories::view, 0); | |||
| result.setTicked (document->isSnapActive (false)); | |||
| result.defaultKeypresses.add (KeyPress (T('g'), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('g', cmd, 0)); | |||
| break; | |||
| case CommandIDs::showGrid: | |||
| @@ -878,7 +878,7 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| T("Toggles whether the snapping grid is displayed on-screen."), | |||
| CommandCategories::view, 0); | |||
| result.setTicked (document->isSnapShown()); | |||
| result.defaultKeypresses.add (KeyPress (T('g'), cmd | shift, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('g', cmd | shift, 0)); | |||
| break; | |||
| case CommandIDs::editCompLayout: | |||
| @@ -887,7 +887,7 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| CommandCategories::view, 0); | |||
| result.setActive (tabbedComponent != 0); | |||
| result.setTicked (currentLayout != 0); | |||
| result.defaultKeypresses.add (KeyPress (T('n'), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('n', cmd, 0)); | |||
| break; | |||
| case CommandIDs::editCompGraphics: | |||
| @@ -896,7 +896,7 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| CommandCategories::view, 0); | |||
| result.setActive (tabbedComponent != 0); | |||
| result.setTicked (currentPaintRoutine != 0); | |||
| result.defaultKeypresses.add (KeyPress (T('m'), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('m', cmd, 0)); | |||
| break; | |||
| case CommandIDs::bringBackLostItems: | |||
| @@ -904,7 +904,7 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| T("Moves any items that are lost beyond the edges of the screen back to the centre."), | |||
| CommandCategories::editing, 0); | |||
| result.setActive (currentPaintRoutine != 0 || currentLayout != 0); | |||
| result.defaultKeypresses.add (KeyPress (T('m'), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('m', cmd, 0)); | |||
| break; | |||
| case CommandIDs::zoomIn: | |||
| @@ -912,7 +912,7 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| T("Zooms in on the current component."), | |||
| CommandCategories::editing, 0); | |||
| result.setActive (currentPaintRoutine != 0 || currentLayout != 0); | |||
| result.defaultKeypresses.add (KeyPress (T(']'), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress (']', cmd, 0)); | |||
| break; | |||
| case CommandIDs::zoomOut: | |||
| @@ -920,7 +920,7 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| T("Zooms out on the current component."), | |||
| CommandCategories::editing, 0); | |||
| result.setActive (currentPaintRoutine != 0 || currentLayout != 0); | |||
| result.defaultKeypresses.add (KeyPress (T('['), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('[', cmd, 0)); | |||
| break; | |||
| case CommandIDs::zoomNormal: | |||
| @@ -928,7 +928,7 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| T("Restores the zoom level to normal."), | |||
| CommandCategories::editing, 0); | |||
| result.setActive (currentPaintRoutine != 0 || currentLayout != 0); | |||
| result.defaultKeypresses.add (KeyPress (T('1'), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('1', cmd, 0)); | |||
| break; | |||
| case CommandIDs::spaceBarDrag: | |||
| @@ -962,7 +962,7 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| num = 3; | |||
| } | |||
| result.defaultKeypresses.add (KeyPress (T('2') + num, cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('2' + num, cmd, 0)); | |||
| int currentAmount = 0; | |||
| if (document->getComponentOverlayOpacity() > 0.9f) | |||
| @@ -987,7 +987,7 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| T("Copies the currently selected components to the clipboard and deletes them."), | |||
| CommandCategories::editing, 0); | |||
| result.setActive (isSomethingSelected()); | |||
| result.defaultKeypresses.add (KeyPress (T('x'), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('x', cmd, 0)); | |||
| break; | |||
| case StandardApplicationCommandIDs::copy: | |||
| @@ -995,7 +995,7 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| T("Copies the currently selected components to the clipboard."), | |||
| CommandCategories::editing, 0); | |||
| result.setActive (isSomethingSelected()); | |||
| result.defaultKeypresses.add (KeyPress (T('c'), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('c', cmd, 0)); | |||
| break; | |||
| case StandardApplicationCommandIDs::paste: | |||
| @@ -1003,7 +1003,7 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| result.setInfo (T("Paste"), | |||
| T("Pastes any components from the clipboard."), | |||
| CommandCategories::editing, 0); | |||
| result.defaultKeypresses.add (KeyPress (T('v'), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('v', cmd, 0)); | |||
| bool canPaste = false; | |||
| XmlDocument clip (SystemClipboard::getTextFromClipboard()); | |||
| @@ -1038,7 +1038,7 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| T("Selects all of whatever item is currently selected."), | |||
| CommandCategories::editing, 0); | |||
| result.setActive (currentPaintRoutine != 0 || currentLayout != 0); | |||
| result.defaultKeypresses.add (KeyPress (T('a'), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('a', cmd, 0)); | |||
| break; | |||
| case StandardApplicationCommandIDs::deselectAll: | |||
| @@ -1046,7 +1046,7 @@ void JucerDocumentHolder::getCommandInfo (const CommandID commandID, Application | |||
| T("Deselects whatever is currently selected."), | |||
| CommandCategories::editing, 0); | |||
| result.setActive (currentPaintRoutine != 0 || currentLayout != 0); | |||
| result.defaultKeypresses.add (KeyPress (T('d'), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('d', cmd, 0)); | |||
| break; | |||
| default: | |||
| @@ -201,7 +201,7 @@ bool MainWindow::isInterestedInFileDrag (const StringArray& filenames) | |||
| { | |||
| const File f (filenames[i]); | |||
| if (f.hasFileExtension (T(".cpp"))) | |||
| if (f.hasFileExtension (".cpp")) | |||
| return true; | |||
| } | |||
| @@ -214,7 +214,7 @@ void MainWindow::filesDropped (const StringArray& filenames, int mouseX, int mou | |||
| { | |||
| const File f (filenames[i]); | |||
| if (f.hasFileExtension (T(".cpp")) && openFile (f)) | |||
| if (f.hasFileExtension (".cpp") && openFile (f)) | |||
| break; | |||
| } | |||
| } | |||
| @@ -230,9 +230,9 @@ void MainWindow::activeWindowStatusChanged() | |||
| //============================================================================== | |||
| const StringArray MainWindow::getMenuBarNames() | |||
| { | |||
| const tchar* const names[] = { T("File"), T("Edit"), T("View"), 0 }; | |||
| const char* const names[] = { "File", "Edit", "View", 0 }; | |||
| return StringArray ((const tchar**) names); | |||
| return StringArray (names); | |||
| } | |||
| const PopupMenu MainWindow::getMenuForIndex (int topLevelMenuIndex, | |||
| @@ -311,11 +311,11 @@ const PopupMenu MainWindow::getMenuForIndex (int topLevelMenuIndex, | |||
| menu.addCommandItem (commandManager, CommandIDs::test); | |||
| PopupMenu lookAndFeels; | |||
| lookAndFeels.addItem (201, T("Default"), true, (typeid (LookAndFeel) == typeid (LookAndFeel::getDefaultLookAndFeel())) != 0); | |||
| lookAndFeels.addItem (200, T("Old School"), true, (typeid (OldSchoolLookAndFeel) == typeid (LookAndFeel::getDefaultLookAndFeel())) != 0); | |||
| lookAndFeels.addItem (201, "Default", true, (typeid (LookAndFeel) == typeid (LookAndFeel::getDefaultLookAndFeel())) != 0); | |||
| lookAndFeels.addItem (200, "Old School", true, (typeid (OldSchoolLookAndFeel) == typeid (LookAndFeel::getDefaultLookAndFeel())) != 0); | |||
| menu.addSeparator(); | |||
| menu.addSubMenu (T("Look and Feel"), lookAndFeels); | |||
| menu.addSubMenu ("Look and Feel", lookAndFeels); | |||
| menu.addSeparator(); | |||
| menu.addCommandItem (commandManager, CommandIDs::showGrid); | |||
| @@ -325,9 +325,9 @@ const PopupMenu MainWindow::getMenuForIndex (int topLevelMenuIndex, | |||
| PopupMenu m; | |||
| for (int i = 0; i < numElementsInArray (snapSizes); ++i) | |||
| m.addItem (300 + i, String (snapSizes[i]) + T(" pixels"), true, snapSizes[i] == currentSnapSize); | |||
| m.addItem (300 + i, String (snapSizes[i]) + " pixels", true, snapSizes[i] == currentSnapSize); | |||
| menu.addSubMenu (T("Grid size"), m, getActiveDocument() != 0); | |||
| menu.addSubMenu ("Grid size", m, getActiveDocument() != 0); | |||
| menu.addSeparator(); | |||
| menu.addCommandItem (commandManager, CommandIDs::zoomIn); | |||
| @@ -340,7 +340,7 @@ const PopupMenu MainWindow::getMenuForIndex (int topLevelMenuIndex, | |||
| overlays.addCommandItem (commandManager, CommandIDs::compOverlay33); | |||
| overlays.addCommandItem (commandManager, CommandIDs::compOverlay66); | |||
| overlays.addCommandItem (commandManager, CommandIDs::compOverlay100); | |||
| menu.addSubMenu (T("Component Overlay"), overlays, | |||
| menu.addSubMenu ("Component Overlay", overlays, | |||
| getActiveDocument() != 0 && getActiveDocument()->getComponentLayout() != 0); | |||
| menu.addSeparator(); | |||
| @@ -409,8 +409,8 @@ void MainWindow::getCommandInfo (const CommandID commandID, ApplicationCommandIn | |||
| { | |||
| const int index = commandID - CommandIDs::newDocumentBase; | |||
| result.setInfo (T("New ") + String (ObjectTypes::documentTypeNames [index]), | |||
| T("Creates a new ") + String (ObjectTypes::documentTypeNames[index]), | |||
| result.setInfo ("New " + String (ObjectTypes::documentTypeNames [index]), | |||
| "Creates a new " + String (ObjectTypes::documentTypeNames[index]), | |||
| CommandCategories::general, 0); | |||
| return; | |||
| @@ -421,22 +421,22 @@ void MainWindow::getCommandInfo (const CommandID commandID, ApplicationCommandIn | |||
| switch (commandID) | |||
| { | |||
| case CommandIDs::open: | |||
| result.setInfo (T("Open..."), | |||
| T("Opens a Jucer .cpp component file for editing."), | |||
| result.setInfo ("Open...", | |||
| "Opens a Jucer .cpp component file for editing.", | |||
| CommandCategories::general, 0); | |||
| result.defaultKeypresses.add (KeyPress (T('o'), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('o', cmd, 0)); | |||
| break; | |||
| case CommandIDs::showPrefs: | |||
| result.setInfo (T("Preferences..."), | |||
| T("Shows the preferences panel."), | |||
| result.setInfo ("Preferences...", | |||
| "Shows the preferences panel.", | |||
| CommandCategories::general, 0); | |||
| result.defaultKeypresses.add (KeyPress (T(','), cmd, 0)); | |||
| result.defaultKeypresses.add (KeyPress (',', cmd, 0)); | |||
| break; | |||
| case CommandIDs::useTabbedWindows: | |||
| result.setInfo (T("Use tabs to show windows"), | |||
| T("Flips between a tabbed component and separate windows"), | |||
| result.setInfo ("Use tabs to show windows", | |||
| "Flips between a tabbed component and separate windows", | |||
| CommandCategories::general, 0); | |||
| result.setTicked (multiDocHolder->getLayoutMode() == MultiDocumentPanel::MaximisedWindowsWithTabs); | |||
| break; | |||
| @@ -36,7 +36,7 @@ class ComponentBackgroundColourProperty : public ColourPropertyComponent, | |||
| public: | |||
| ComponentBackgroundColourProperty (JucerDocument& document_, | |||
| PaintRoutine& routine_) | |||
| : ColourPropertyComponent (T("background"), false), | |||
| : ColourPropertyComponent ("background", false), | |||
| document (document_), | |||
| routine (routine_) | |||
| { | |||
| @@ -120,7 +120,7 @@ public: | |||
| Array <PropertyComponent*> props; | |||
| props.add (new ComponentBackgroundColourProperty (*document, paintRoutine)); | |||
| propsPanel->addSection (T("Class Properties"), props); | |||
| propsPanel->addSection ("Class Properties", props); | |||
| } | |||
| if (state != 0) | |||
| @@ -151,7 +151,7 @@ public: | |||
| Array <PropertyComponent*> props; | |||
| point->getEditableProperties (props); | |||
| propsPanel->addSection (T("Path segment"), props); | |||
| propsPanel->addSection ("Path segment", props); | |||
| } | |||
| } | |||
| } | |||
| @@ -115,9 +115,9 @@ public: | |||
| //============================================================================== | |||
| static const tchar* miscPage = T("Misc"); | |||
| static const tchar* keysPage = T("Keys"); | |||
| static const tchar* aboutPage = T("About"); | |||
| static const char* miscPage = "Misc"; | |||
| static const char* keysPage = "Keys"; | |||
| static const char* aboutPage = "About"; | |||
| class PrefsTabComp : public PreferencesPanel | |||
| { | |||
| @@ -84,21 +84,21 @@ private: | |||
| ResourceEditorPanel::ResourceEditorPanel (JucerDocument& document_) | |||
| : document (document_) | |||
| { | |||
| addAndMakeVisible (addButton = new TextButton (T("Add new resource..."))); | |||
| addAndMakeVisible (addButton = new TextButton ("Add new resource...")); | |||
| addButton->addListener (this); | |||
| addAndMakeVisible (reloadAllButton = new TextButton (T("Reload all resources"))); | |||
| addAndMakeVisible (reloadAllButton = new TextButton ("Reload all resources")); | |||
| reloadAllButton->addListener (this); | |||
| addAndMakeVisible (delButton = new TextButton (T("Delete selected resources"))); | |||
| addAndMakeVisible (delButton = new TextButton ("Delete selected resources")); | |||
| delButton->addListener (this); | |||
| delButton->setEnabled (false); | |||
| addAndMakeVisible (listBox = new TableListBox (String::empty, this)); | |||
| listBox->getHeader().addColumn (T("name"), 1, 150, 80, 400); | |||
| listBox->getHeader().addColumn (T("original file"), 2, 350, 80, 800); | |||
| listBox->getHeader().addColumn (T("size"), 3, 100, 40, 150); | |||
| listBox->getHeader().addColumn (T("reload"), 4, 100, 100, 100, TableHeaderComponent::notResizableOrSortable); | |||
| listBox->getHeader().addColumn ("name", 1, 150, 80, 400); | |||
| listBox->getHeader().addColumn ("original file", 2, 350, 80, 800); | |||
| listBox->getHeader().addColumn ("size", 3, 100, 40, 150); | |||
| listBox->getHeader().addColumn ("reload", 4, 100, 100, 100, TableHeaderComponent::notResizableOrSortable); | |||
| listBox->getHeader().setStretchToFitActive (true); | |||
| listBox->setColour (ListBox::outlineColourId, Colours::darkgrey); | |||
| @@ -256,8 +256,8 @@ void ResourceEditorPanel::buttonClicked (Button* b) | |||
| if (b == addButton) | |||
| { | |||
| document.getResources() | |||
| .browseForResource (T("Select a file to add as a resource"), | |||
| T("*"), | |||
| .browseForResource ("Select a file to add as a resource", | |||
| "*", | |||
| File::nonexistent, | |||
| String::empty); | |||
| } | |||
| @@ -38,39 +38,39 @@ const String replaceCEscapeChars (const String& s) | |||
| for (int i = 0; i < len; ++i) | |||
| { | |||
| const tchar c = s[i]; | |||
| const juce_wchar c = s[i]; | |||
| switch (c) | |||
| { | |||
| case '\t': | |||
| r << T("\\t"); | |||
| r << "\\t"; | |||
| lastWasHexEscapeCode = false; | |||
| break; | |||
| case '\r': | |||
| r << T("\\r"); | |||
| r << "\\r"; | |||
| lastWasHexEscapeCode = false; | |||
| break; | |||
| case '\n': | |||
| r << T("\\n"); | |||
| r << "\\n"; | |||
| lastWasHexEscapeCode = false; | |||
| break; | |||
| case '\\': | |||
| r << T("\\\\"); | |||
| r << "\\\\"; | |||
| lastWasHexEscapeCode = false; | |||
| break; | |||
| case '\'': | |||
| r << T("\\\'"); | |||
| r << "\\\'"; | |||
| lastWasHexEscapeCode = false; | |||
| break; | |||
| case '\"': | |||
| r << T("\\\""); | |||
| r << "\\\""; | |||
| lastWasHexEscapeCode = false; | |||
| break; | |||
| default: | |||
| if (c < 128 && | |||
| ! (lastWasHexEscapeCode | |||
| && String (T("0123456789abcdefABCDEF")).containsChar (c))) // (have to avoid following a hex escape sequence with a valid hex digit) | |||
| && String ("0123456789abcdefABCDEF").containsChar (c))) // (have to avoid following a hex escape sequence with a valid hex digit) | |||
| { | |||
| r << c; | |||
| lastWasHexEscapeCode = false; | |||
| @@ -78,7 +78,7 @@ const String replaceCEscapeChars (const String& s) | |||
| else | |||
| { | |||
| lastWasHexEscapeCode = true; | |||
| r << T("\\x") << String::toHexString ((int) c); | |||
| r << "\\x" << String::toHexString ((int) c); | |||
| } | |||
| break; | |||
| @@ -91,9 +91,9 @@ const String replaceCEscapeChars (const String& s) | |||
| const String quotedString (const String& s) | |||
| { | |||
| if (s.isEmpty()) | |||
| return T("String::empty"); | |||
| return "String::empty"; | |||
| const int embeddedIndex = s.indexOfIgnoreCase (T("%%")); | |||
| const int embeddedIndex = s.indexOfIgnoreCase ("%%"); | |||
| if (embeddedIndex >= 0) | |||
| { | |||
| @@ -101,7 +101,7 @@ const String quotedString (const String& s) | |||
| String s2 (s.substring (embeddedIndex + 2)); | |||
| String code; | |||
| const int closeIndex = s2.indexOf (T("%%")); | |||
| const int closeIndex = s2.indexOf ("%%"); | |||
| if (closeIndex > 0) | |||
| { | |||
| @@ -114,41 +114,41 @@ const String quotedString (const String& s) | |||
| String result; | |||
| if (s1.isNotEmpty()) | |||
| result << quotedString (s1) << T(" + "); | |||
| result << quotedString (s1) << " + "; | |||
| result << code; | |||
| if (s2.isNotEmpty()) | |||
| result << T(" + ") << quotedString (s2); | |||
| result << " + " << quotedString (s2); | |||
| return result; | |||
| } | |||
| } | |||
| return T("T(\"") + replaceCEscapeChars (s) + T("\")"); | |||
| return "T(\"" + replaceCEscapeChars (s) + "\")"; | |||
| } | |||
| const String replaceStringTranslations (String s, JucerDocument* document) | |||
| { | |||
| s = s.replace (T("%%getName()%%"), document->getComponentName()); | |||
| s = s.replace (T("%%getButtonText()%%"), document->getComponentName()); | |||
| s = s.replace ("%%getName()%%", document->getComponentName()); | |||
| s = s.replace ("%%getButtonText()%%", document->getComponentName()); | |||
| return s; | |||
| } | |||
| const String castToFloat (const String& expression) | |||
| { | |||
| if (expression.containsOnly (T("0123456789.f"))) | |||
| if (expression.containsOnly ("0123456789.f")) | |||
| { | |||
| String s (expression.getFloatValue()); | |||
| if (s.containsChar (T('.'))) | |||
| return s + T("f"); | |||
| if (s.containsChar ('.')) | |||
| return s + "f"; | |||
| return s + T(".0f"); | |||
| return s + ".0f"; | |||
| } | |||
| return T("(float) (") + expression + T(")"); | |||
| return "(float) (" + expression + ")"; | |||
| } | |||
| const String indentCode (const String& code, const int numSpaces) | |||
| @@ -156,7 +156,7 @@ const String indentCode (const String& code, const int numSpaces) | |||
| if (numSpaces == 0) | |||
| return code; | |||
| const String space (String::repeatedString (T(" "), numSpaces)); | |||
| const String space (String::repeatedString (" ", numSpaces)); | |||
| StringArray lines; | |||
| lines.addLines (code); | |||
| @@ -170,7 +170,7 @@ const String indentCode (const String& code, const int numSpaces) | |||
| lines.set (i, s); | |||
| } | |||
| return lines.joinIntoString (T("\n")); | |||
| return lines.joinIntoString ("\n"); | |||
| } | |||
| //============================================================================== | |||
| @@ -180,9 +180,9 @@ const String makeValidCppIdentifier (String s, | |||
| const bool allowTemplates) | |||
| { | |||
| if (removeColons) | |||
| s = s.replaceCharacters (T(".,;:/@"), T("______")); | |||
| s = s.replaceCharacters (".,;:/@", "______"); | |||
| else | |||
| s = s.replaceCharacters (T(".,;/@"), T("_____")); | |||
| s = s.replaceCharacters (".,;/@", "_____"); | |||
| int i; | |||
| for (i = s.length(); --i > 0;) | |||
| @@ -192,12 +192,12 @@ const String makeValidCppIdentifier (String s, | |||
| && ! CharacterFunctions::isUpperCase (s[i - 1])) | |||
| s = s.substring (0, i) + T(" ") + s.substring (i); | |||
| String allowedChars (T("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_ 0123456789")); | |||
| String allowedChars ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_ 0123456789"); | |||
| if (allowTemplates) | |||
| allowedChars += T("<>"); | |||
| allowedChars += "<>"; | |||
| if (! removeColons) | |||
| allowedChars += T(":"); | |||
| allowedChars += ":"; | |||
| StringArray words; | |||
| words.addTokens (s.retainCharacters (allowedChars), false); | |||
| @@ -221,21 +221,21 @@ const String makeValidCppIdentifier (String s, | |||
| n = T("_") + n; | |||
| // make sure it's not a reserved c++ keyword.. | |||
| static const tchar* const reservedWords[] = | |||
| static const char* const reservedWords[] = | |||
| { | |||
| T("auto"), T("const"), T("double"), T("float"), T("int"), T("short"), T("struct"), | |||
| T("return"), T("static"), T("union"), T("while"), T("asm"), T("dynamic_cast"), | |||
| T("unsigned"), T("break"), T("continue"), T("else"), T("for"), T("long"), T("signed"), | |||
| T("switch"), T("void"), T("case"), T("default"), T("enum"), T("goto"), T("register"), | |||
| T("sizeof"), T("typedef"), T("volatile"), T("char"), T("do"), T("extern"), T("if"), | |||
| T("namespace"), T("reinterpret_cast"), T("try"), T("bool"), T("explicit"), T("new"), | |||
| T("static_cast"), T("typeid"), T("catch"), T("false"), T("operator"), T("template"), | |||
| T("typename"), T("class"), T("friend"), T("private"), T("this"), T("using"), T("const_cast"), | |||
| T("inline"), T("public"), T("throw"), T("virtual"), T("delete"), T("mutable"), T("protected"), | |||
| T("true"), T("wchar_t"), T("and"), T("bitand"), T("compl"), T("not_eq"), T("or_eq"), | |||
| T("xor_eq"), T("and_eq"), T("bitor"), T("not"), T("or"), T("xor"), T("cin"), T("endl"), | |||
| T("INT_MIN"), T("iomanip"), T("main"), T("npos"), T("std"), T("cout"), T("include"), | |||
| T("INT_MAX"), T("iostream"), T("MAX_RAND"), T("NULL"), T("string") | |||
| "auto", "const", "double", "float", "int", "short", "struct", | |||
| "return", "static", "union", "while", "asm", "dynamic_cast", | |||
| "unsigned", "break", "continue", "else", "for", "long", "signed", | |||
| "switch", "void", "case", "default", "enum", "goto", "register", | |||
| "sizeof", "typedef", "volatile", "char", "do", "extern", "if", | |||
| "namespace", "reinterpret_cast", "try", "bool", "explicit", "new", | |||
| "static_cast", "typeid", "catch", "false", "operator", "template", | |||
| "typename", "class", "friend", "private", "this", "using", "const_cast", | |||
| "inline", "public", "throw", "virtual", "delete", "mutable", "protected", | |||
| "true", "wchar_t", "and", "bitand", "compl", "not_eq", "or_eq", | |||
| "xor_eq", "and_eq", "bitor", "not", "or", "xor", "cin", "endl", | |||
| "INT_MIN", "iomanip", "main", "npos", "std", "cout", "include", | |||
| "INT_MAX", "iostream", "MAX_RAND", "NULL", "string" | |||
| }; | |||
| for (i = 0; i < numElementsInArray (reservedWords); ++i) | |||
| @@ -266,7 +266,7 @@ const String valueToFloat (const double v) | |||
| { | |||
| String s ((double) (float) v, 4); | |||
| if (s.containsChar (T('.'))) | |||
| if (s.containsChar ('.')) | |||
| s << 'f'; | |||
| else | |||
| s << ".0f"; | |||
| @@ -276,7 +276,7 @@ const String valueToFloat (const double v) | |||
| const String boolToString (const bool b) | |||
| { | |||
| return b ? T("true") : T("false"); | |||
| return b ? "true" : "false"; | |||
| } | |||
| //============================================================================== | |||
| @@ -307,17 +307,17 @@ const String colourToCode (const Colour& col) | |||
| for (int i = 0; i < numElementsInArray (colourNames) - 1; ++i) | |||
| if (col == colours[i]) | |||
| return T("Colours::") + String (colourNames[i]); | |||
| return "Colours::" + String (colourNames[i]); | |||
| return T("Colour (0x") + colourToHex (col) + T(')'); | |||
| return "Colour (0x" + colourToHex (col) + ")"; | |||
| } | |||
| void setColourXml (XmlElement& xml, const tchar* const attName, const Colour& colour) | |||
| void setColourXml (XmlElement& xml, const char* const attName, const Colour& colour) | |||
| { | |||
| xml.setAttribute (attName, colourToHex (colour)); | |||
| } | |||
| const Colour getColourXml (const XmlElement& xml, const tchar* const attName, const Colour& defaultColour) | |||
| const Colour getColourXml (const XmlElement& xml, const char* const attName, const Colour& defaultColour) | |||
| { | |||
| return Colour (xml.getStringAttribute (attName, colourToHex (defaultColour)).getHexValue32()); | |||
| } | |||
| @@ -563,7 +563,7 @@ const String justificationToCode (const Justification& justification) | |||
| break; | |||
| } | |||
| return T("Justification (") + String (justification.getFlags()) + T(")"); | |||
| return "Justification (" + String (justification.getFlags()) + ")"; | |||
| } | |||
| //============================================================================== | |||
| @@ -737,24 +737,24 @@ void RelativePositionedRectangle::updateFrom (double newX, double newY, double n | |||
| void RelativePositionedRectangle::applyToXml (XmlElement& e) const | |||
| { | |||
| e.setAttribute (T("pos"), rect.toString()); | |||
| e.setAttribute ("pos", rect.toString()); | |||
| if (relativeToX != 0) | |||
| e.setAttribute (T("posRelativeX"), String::toHexString (relativeToX)); | |||
| e.setAttribute ("posRelativeX", String::toHexString (relativeToX)); | |||
| if (relativeToY != 0) | |||
| e.setAttribute (T("posRelativeY"), String::toHexString (relativeToY)); | |||
| e.setAttribute ("posRelativeY", String::toHexString (relativeToY)); | |||
| if (relativeToW != 0) | |||
| e.setAttribute (T("posRelativeW"), String::toHexString (relativeToW)); | |||
| e.setAttribute ("posRelativeW", String::toHexString (relativeToW)); | |||
| if (relativeToH != 0) | |||
| e.setAttribute (T("posRelativeH"), String::toHexString (relativeToH)); | |||
| e.setAttribute ("posRelativeH", String::toHexString (relativeToH)); | |||
| } | |||
| void RelativePositionedRectangle::restoreFromXml (const XmlElement& e, | |||
| const RelativePositionedRectangle& defaultPos) | |||
| { | |||
| rect = PositionedRectangle (e.getStringAttribute (T("pos"), defaultPos.rect.toString())); | |||
| relativeToX = e.getStringAttribute (T("posRelativeX"), String::toHexString (defaultPos.relativeToX)).getHexValue64(); | |||
| relativeToY = e.getStringAttribute (T("posRelativeY"), String::toHexString (defaultPos.relativeToY)).getHexValue64(); | |||
| relativeToW = e.getStringAttribute (T("posRelativeW"), String::toHexString (defaultPos.relativeToW)).getHexValue64(); | |||
| relativeToH = e.getStringAttribute (T("posRelativeH"), String::toHexString (defaultPos.relativeToH)).getHexValue64(); | |||
| rect = PositionedRectangle (e.getStringAttribute ("pos", defaultPos.rect.toString())); | |||
| relativeToX = e.getStringAttribute ("posRelativeX", String::toHexString (defaultPos.relativeToX)).getHexValue64(); | |||
| relativeToY = e.getStringAttribute ("posRelativeY", String::toHexString (defaultPos.relativeToY)).getHexValue64(); | |||
| relativeToW = e.getStringAttribute ("posRelativeW", String::toHexString (defaultPos.relativeToW)).getHexValue64(); | |||
| relativeToH = e.getStringAttribute ("posRelativeH", String::toHexString (defaultPos.relativeToH)).getHexValue64(); | |||
| } | |||
| @@ -637,8 +637,8 @@ int indexOfLineStartingWith (const StringArray& lines, const String& text, int s | |||
| const String colourToHex (const Colour& col); | |||
| const String colourToCode (const Colour& col); | |||
| void setColourXml (XmlElement& xml, const tchar* const attName, const Colour& colour); | |||
| const Colour getColourXml (const XmlElement& xml, const tchar* const attName, const Colour& defaultColour); | |||
| void setColourXml (XmlElement& xml, const char* const attName, const Colour& colour); | |||
| const Colour getColourXml (const XmlElement& xml, const char* const attName, const Colour& defaultColour); | |||
| //============================================================================== | |||
| const String positionToString (const RelativePositionedRectangle& pos); | |||
| @@ -283,7 +283,7 @@ public: | |||
| vorbis_comment_init (&vc); | |||
| if (JUCEApplication::getInstance() != 0) | |||
| vorbis_comment_add_tag (&vc, "ENCODER", const_cast <char*> (JUCEApplication::getInstance()->getApplicationName().toUTF8())); | |||
| vorbis_comment_add_tag (&vc, "ENCODER", const_cast <char*> (JUCEApplication::getInstance()->getApplicationName().toUTF8().getAddress())); | |||
| vorbis_analysis_init (&vd, &vi); | |||
| vorbis_block_init (&vd, &vb); | |||
| @@ -35,7 +35,10 @@ | |||
| #define STRICT | |||
| #include <windows.h> | |||
| #include <float.h> | |||
| #pragma warning (disable : 4312 4355 1899) | |||
| #pragma warning (disable : 4312 4355) | |||
| #ifdef __INTEL_COMPILER | |||
| #pragma warning (disable : 1899) | |||
| #endif | |||
| #elif JUCE_LINUX | |||
| #include <float.h> | |||
| #include <sys/time.h> | |||
| @@ -2321,7 +2324,7 @@ VstIntPtr VSTPluginInstance::handleCallback (VstInt32 opcode, VstInt32 index, Vs | |||
| #if JUCE_MAC | |||
| return (VstIntPtr) (void*) &module->parentDirFSSpec; | |||
| #else | |||
| return (VstIntPtr) (pointer_sized_uint) module->fullParentDirectoryPathName.toUTF8(); | |||
| return (VstIntPtr) (pointer_sized_uint) module->fullParentDirectoryPathName.toUTF8().getAddress(); | |||
| #endif | |||
| case audioMasterGetAutomationState: | |||
| @@ -33,7 +33,7 @@ | |||
| */ | |||
| #define JUCE_MAJOR_VERSION 1 | |||
| #define JUCE_MINOR_VERSION 53 | |||
| #define JUCE_BUILDNUMBER 18 | |||
| #define JUCE_BUILDNUMBER 20 | |||
| /** Current Juce version number. | |||
| @@ -103,7 +103,7 @@ namespace CppTokeniser | |||
| int i = 0; | |||
| while (k[i] != 0) | |||
| { | |||
| if (k[i][0] == token[0] && CharPointer_UTF8 (k[i]).compare (CharPointer_UTF32 (token)) == 0) | |||
| if (k[i][0] == (char) token[0] && CharPointer_UTF8 (k[i]).compare (CharPointer_UTF32 (token)) == 0) | |||
| return true; | |||
| ++i; | |||
| @@ -389,7 +389,7 @@ const String URL::removeEscapeChars (const String& s) | |||
| // We need to operate on the string as raw UTF8 chars, and then recombine them into unicode | |||
| // after all the replacements have been made, so that multi-byte chars are handled. | |||
| Array<char> utf8 (result.toUTF8(), result.getNumBytesAsUTF8()); | |||
| Array<char> utf8 (result.toUTF8().getAddress(), result.getNumBytesAsUTF8()); | |||
| for (int i = 0; i < utf8.size(); ++i) | |||
| { | |||
| @@ -414,7 +414,7 @@ const String URL::addEscapeChars (const String& s, const bool isParameter) | |||
| const CharPointer_UTF8 legalChars (isParameter ? "_-.*!'()" | |||
| : ",$_-.*!'()"); | |||
| Array<char> utf8 (s.toUTF8(), s.getNumBytesAsUTF8()); | |||
| Array<char> utf8 (s.toUTF8().getAddress(), s.getNumBytesAsUTF8()); | |||
| for (int i = 0; i < utf8.size(); ++i) | |||
| { | |||
| @@ -807,7 +807,7 @@ public: | |||
| void setTitle (const String& title) | |||
| { | |||
| XTextProperty nameProperty; | |||
| char* strings[] = { const_cast <char*> (title.toUTF8()) }; | |||
| char* strings[] = { const_cast <char*> (title.toUTF8().getAddress()) }; | |||
| ScopedXLock xlock; | |||
| if (XStringListToTextProperty (strings, 1, &nameProperty)) | |||
| @@ -444,7 +444,7 @@ void File::revealToUser() const | |||
| #if ! JUCE_IOS | |||
| bool PlatformUtilities::makeFSRefFromPath (FSRef* destFSRef, const String& path) | |||
| { | |||
| return FSPathMakeRef ((const UInt8*) path.toUTF8(), destFSRef, 0) == noErr; | |||
| return FSPathMakeRef (reinterpret_cast <const UInt8*> (path.toUTF8().getAddress()), destFSRef, 0) == noErr; | |||
| } | |||
| const String PlatformUtilities::makePathFromFSRef (FSRef* file) | |||
| @@ -102,34 +102,25 @@ const String PlatformUtilities::convertToPrecomposedUnicode (const String& s) | |||
| if (CreateUnicodeToTextInfo (&map, &conversionInfo) == noErr) | |||
| { | |||
| const int len = s.length(); | |||
| const int bytesNeeded = CharPointer_UTF16::getBytesRequiredFor (s.getCharPointer()); | |||
| HeapBlock <UniChar> tempIn, tempOut; | |||
| tempIn.calloc (len + 2); | |||
| tempOut.calloc (len + 2); | |||
| for (int i = 0; i <= len; ++i) | |||
| tempIn[i] = s[i]; | |||
| HeapBlock <char> tempOut; | |||
| tempOut.calloc (bytesNeeded + 4); | |||
| ByteCount bytesRead = 0; | |||
| ByteCount outputBufferSize = 0; | |||
| if (ConvertFromUnicodeToText (conversionInfo, | |||
| len * sizeof (UniChar), tempIn, | |||
| bytesNeeded, (ConstUniCharArrayPtr) s.toUTF16().getAddress(), | |||
| kUnicodeDefaultDirectionMask, | |||
| 0, 0, 0, 0, | |||
| len * sizeof (UniChar), &bytesRead, | |||
| bytesNeeded, &bytesRead, | |||
| &outputBufferSize, tempOut) == noErr) | |||
| { | |||
| result.preallocateStorage (bytesRead / sizeof (UniChar) + 2); | |||
| juce_wchar* t = result; | |||
| unsigned int i; | |||
| for (i = 0; i < bytesRead / sizeof (UniChar); ++i) | |||
| t[i] = (juce_wchar) tempOut[i]; | |||
| t[i] = 0; | |||
| CharPointer_UTF32 dest (static_cast <juce_wchar*> (result)); | |||
| dest.writeAll (CharPointer_UTF16 ((CharPointer_UTF16::CharType*) tempOut.getData())); | |||
| } | |||
| DisposeUnicodeToTextInfo (&conversionInfo); | |||
| @@ -44,13 +44,13 @@ DynamicLibraryLoader::~DynamicLibraryLoader() | |||
| bool DynamicLibraryLoader::load (const String& name) | |||
| { | |||
| FreeLibrary ((HMODULE) libHandle); | |||
| libHandle = name.isNotEmpty() ? LoadLibrary (name) : 0; | |||
| libHandle = name.isNotEmpty() ? LoadLibrary (name.toUTF16()) : 0; | |||
| return libHandle != 0; | |||
| } | |||
| void* DynamicLibraryLoader::findProcAddress (const String& functionName) | |||
| { | |||
| return (void*) GetProcAddress ((HMODULE) libHandle, functionName.toCString()); // (void* cast is required for mingw) | |||
| return (void*) GetProcAddress ((HMODULE) libHandle, functionName.toUTF8()); // (void* cast is required for mingw) | |||
| } | |||
| #endif | |||
| @@ -56,7 +56,7 @@ namespace FileChooserHelpers | |||
| FileChooserCallbackInfo* info = (FileChooserCallbackInfo*) lpData; | |||
| if (msg == BFFM_INITIALIZED) | |||
| SendMessage (hWnd, BFFM_SETSELECTIONW, TRUE, (LPARAM) static_cast <const WCHAR*> (info->initialPath)); | |||
| SendMessage (hWnd, BFFM_SETSELECTIONW, TRUE, (LPARAM) info->initialPath.toUTF16().getAddress()); | |||
| else if (msg == BFFM_VALIDATEFAILEDW) | |||
| info->returnedString = (LPCWSTR) lParam; | |||
| else if (msg == BFFM_VALIDATEFAILEDA) | |||
| @@ -174,7 +174,7 @@ void FileChooser::showPlatformDialog (Array<File>& results, const String& title, | |||
| } | |||
| else | |||
| { | |||
| currentFileOrDirectory.getFileName().copyToUnicode (files, charsAvailableForResult); | |||
| currentFileOrDirectory.getFileName().copyToUTF16 (files, charsAvailableForResult * sizeof (WCHAR)); | |||
| info.initialPath = currentFileOrDirectory.getParentDirectory().getFullPathName(); | |||
| } | |||
| @@ -185,7 +185,7 @@ void FileChooser::showPlatformDialog (Array<File>& results, const String& title, | |||
| bi.hwndOwner = (HWND) parentWindow.getWindowHandle(); | |||
| bi.pszDisplayName = files; | |||
| bi.lpszTitle = title; | |||
| bi.lpszTitle = title.toUTF16(); | |||
| bi.lParam = (LPARAM) &info; | |||
| bi.lpfn = browseCallbackProc; | |||
| #ifdef BIF_USENEWUI | |||
| @@ -230,10 +230,11 @@ void FileChooser::showPlatformDialog (Array<File>& results, const String& title, | |||
| info.customComponent->enterModalState(); | |||
| } | |||
| WCHAR filters [1024]; | |||
| zerostruct (filters); | |||
| filter.copyToUnicode (filters, 1024); | |||
| filter.copyToUnicode (filters + filter.length() + 1, 1022 - filter.length()); | |||
| const int filterSpace = 2048; | |||
| HeapBlock<char> filters; | |||
| filters.calloc (filterSpace * 2); | |||
| const int bytesWritten = filter.copyToUTF16 (reinterpret_cast <WCHAR*> (filters.getData()), filterSpace); | |||
| filter.copyToUTF16 (reinterpret_cast <WCHAR*> (filters + bytesWritten), filterSpace); | |||
| OPENFILENAMEW of; | |||
| zerostruct (of); | |||
| @@ -244,12 +245,12 @@ void FileChooser::showPlatformDialog (Array<File>& results, const String& title, | |||
| of.lStructSize = sizeof (of); | |||
| #endif | |||
| of.hwndOwner = (HWND) parentWindow.getWindowHandle(); | |||
| of.lpstrFilter = filters; | |||
| of.lpstrFilter = reinterpret_cast <WCHAR*> (filters.getData()); | |||
| of.nFilterIndex = 1; | |||
| of.lpstrFile = files; | |||
| of.nMaxFile = charsAvailableForResult; | |||
| of.lpstrInitialDir = info.initialPath; | |||
| of.lpstrTitle = title; | |||
| of.lpstrInitialDir = info.initialPath.toUTF16(); | |||
| of.lpstrTitle = title.toUTF16(); | |||
| of.Flags = flags; | |||
| of.lCustData = (LPARAM) &info; | |||
| @@ -56,14 +56,12 @@ namespace WindowsFileHelpers | |||
| reinterpret_cast<ULARGE_INTEGER*> (ft)->QuadPart = time * 10000 + literal64bit (116444736000000000); | |||
| } | |||
| const String getDriveFromPath (const String& path) | |||
| const String getDriveFromPath (String path) | |||
| { | |||
| const int length = path.length(); | |||
| HeapBlock <WCHAR> stringCopy (length + 1); | |||
| path.copyToUnicode (stringCopy, length); | |||
| WCHAR* p = const_cast <WCHAR*> (path.toUTF16().getAddress()); | |||
| if (PathStripToRoot (stringCopy)) | |||
| return String (stringCopy); | |||
| if (PathStripToRoot (p)) | |||
| return String ((const WCHAR*) p); | |||
| return path; | |||
| } | |||
| @@ -72,7 +70,7 @@ namespace WindowsFileHelpers | |||
| { | |||
| ULARGE_INTEGER spc, tot, totFree; | |||
| if (GetDiskFreeSpaceEx (getDriveFromPath (path), &spc, &tot, &totFree)) | |||
| if (GetDiskFreeSpaceEx (getDriveFromPath (path).toUTF16(), &spc, &tot, &totFree)) | |||
| return total ? (int64) tot.QuadPart | |||
| : (int64) spc.QuadPart; | |||
| @@ -81,7 +79,7 @@ namespace WindowsFileHelpers | |||
| unsigned int getWindowsDriveType (const String& path) | |||
| { | |||
| return GetDriveType (getDriveFromPath (path)); | |||
| return GetDriveType (getDriveFromPath (path).toUTF16()); | |||
| } | |||
| const File getSpecialFolderPath (int type) | |||
| @@ -104,25 +102,25 @@ const String File::separatorString ("\\"); | |||
| bool File::exists() const | |||
| { | |||
| return fullPath.isNotEmpty() | |||
| && GetFileAttributes (fullPath) != INVALID_FILE_ATTRIBUTES; | |||
| && GetFileAttributes (fullPath.toUTF16()) != INVALID_FILE_ATTRIBUTES; | |||
| } | |||
| bool File::existsAsFile() const | |||
| { | |||
| return fullPath.isNotEmpty() | |||
| && (GetFileAttributes (fullPath) & FILE_ATTRIBUTE_DIRECTORY) == 0; | |||
| && (GetFileAttributes (fullPath.toUTF16()) & FILE_ATTRIBUTE_DIRECTORY) == 0; | |||
| } | |||
| bool File::isDirectory() const | |||
| { | |||
| const DWORD attr = GetFileAttributes (fullPath); | |||
| const DWORD attr = GetFileAttributes (fullPath.toUTF16()); | |||
| return ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) && (attr != INVALID_FILE_ATTRIBUTES); | |||
| } | |||
| bool File::hasWriteAccess() const | |||
| { | |||
| if (exists()) | |||
| return (GetFileAttributes (fullPath) & FILE_ATTRIBUTE_READONLY) == 0; | |||
| return (GetFileAttributes (fullPath.toUTF16()) & FILE_ATTRIBUTE_READONLY) == 0; | |||
| // on windows, it seems that even read-only directories can still be written into, | |||
| // so checking the parent directory's permissions would return the wrong result.. | |||
| @@ -131,7 +129,7 @@ bool File::hasWriteAccess() const | |||
| bool File::setFileReadOnlyInternal (const bool shouldBeReadOnly) const | |||
| { | |||
| DWORD attr = GetFileAttributes (fullPath); | |||
| DWORD attr = GetFileAttributes (fullPath.toUTF16()); | |||
| if (attr == INVALID_FILE_ATTRIBUTES) | |||
| return false; | |||
| @@ -144,12 +142,12 @@ bool File::setFileReadOnlyInternal (const bool shouldBeReadOnly) const | |||
| else | |||
| attr &= ~FILE_ATTRIBUTE_READONLY; | |||
| return SetFileAttributes (fullPath, attr) != FALSE; | |||
| return SetFileAttributes (fullPath.toUTF16(), attr) != FALSE; | |||
| } | |||
| bool File::isHidden() const | |||
| { | |||
| return (GetFileAttributes (getFullPathName()) & FILE_ATTRIBUTE_HIDDEN) != 0; | |||
| return (GetFileAttributes (getFullPathName().toUTF16()) & FILE_ATTRIBUTE_HIDDEN) != 0; | |||
| } | |||
| //============================================================================== | |||
| @@ -158,9 +156,9 @@ bool File::deleteFile() const | |||
| if (! exists()) | |||
| return true; | |||
| else if (isDirectory()) | |||
| return RemoveDirectory (fullPath) != 0; | |||
| return RemoveDirectory (fullPath.toUTF16()) != 0; | |||
| else | |||
| return DeleteFile (fullPath) != 0; | |||
| return DeleteFile (fullPath.toUTF16()) != 0; | |||
| } | |||
| bool File::moveToTrash() const | |||
| @@ -173,7 +171,7 @@ bool File::moveToTrash() const | |||
| // The string we pass in must be double null terminated.. | |||
| String doubleNullTermPath (getFullPathName() + " "); | |||
| TCHAR* const p = const_cast <TCHAR*> (static_cast <const TCHAR*> (doubleNullTermPath)); | |||
| WCHAR* const p = const_cast <WCHAR*> (doubleNullTermPath.toUTF16().getAddress()); | |||
| p [getFullPathName().length()] = 0; | |||
| fos.wFunc = FO_DELETE; | |||
| @@ -186,17 +184,17 @@ bool File::moveToTrash() const | |||
| bool File::copyInternal (const File& dest) const | |||
| { | |||
| return CopyFile (fullPath, dest.getFullPathName(), false) != 0; | |||
| return CopyFile (fullPath.toUTF16(), dest.getFullPathName().toUTF16(), false) != 0; | |||
| } | |||
| bool File::moveInternal (const File& dest) const | |||
| { | |||
| return MoveFile (fullPath, dest.getFullPathName()) != 0; | |||
| return MoveFile (fullPath.toUTF16(), dest.getFullPathName().toUTF16()) != 0; | |||
| } | |||
| void File::createDirectoryInternal (const String& fileName) const | |||
| { | |||
| CreateDirectory (fileName, 0); | |||
| CreateDirectory (fileName.toUTF16(), 0); | |||
| } | |||
| //============================================================================== | |||
| @@ -212,7 +210,7 @@ void FileInputStream::openHandle() | |||
| { | |||
| totalSize = file.getSize(); | |||
| HANDLE h = CreateFile (file.getFullPathName(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, | |||
| HANDLE h = CreateFile (file.getFullPathName().toUTF16(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, | |||
| OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, 0); | |||
| if (h != INVALID_HANDLE_VALUE) | |||
| @@ -239,7 +237,7 @@ size_t FileInputStream::readInternal (void* buffer, size_t numBytes) | |||
| //============================================================================== | |||
| void FileOutputStream::openHandle() | |||
| { | |||
| HANDLE h = CreateFile (file.getFullPathName(), GENERIC_WRITE, FILE_SHARE_READ, 0, | |||
| HANDLE h = CreateFile (file.getFullPathName().toUTF16(), GENERIC_WRITE, FILE_SHARE_READ, 0, | |||
| OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); | |||
| if (h != INVALID_HANDLE_VALUE) | |||
| @@ -284,7 +282,7 @@ int64 File::getSize() const | |||
| { | |||
| WIN32_FILE_ATTRIBUTE_DATA attributes; | |||
| if (GetFileAttributesEx (fullPath, GetFileExInfoStandard, &attributes)) | |||
| if (GetFileAttributesEx (fullPath.toUTF16(), GetFileExInfoStandard, &attributes)) | |||
| return (((int64) attributes.nFileSizeHigh) << 32) | attributes.nFileSizeLow; | |||
| return 0; | |||
| @@ -295,7 +293,7 @@ void File::getFileTimesInternal (int64& modificationTime, int64& accessTime, int | |||
| using namespace WindowsFileHelpers; | |||
| WIN32_FILE_ATTRIBUTE_DATA attributes; | |||
| if (GetFileAttributesEx (fullPath, GetFileExInfoStandard, &attributes)) | |||
| if (GetFileAttributesEx (fullPath.toUTF16(), GetFileExInfoStandard, &attributes)) | |||
| { | |||
| modificationTime = fileTimeToTime (&attributes.ftLastWriteTime); | |||
| creationTime = fileTimeToTime (&attributes.ftCreationTime); | |||
| @@ -312,7 +310,7 @@ bool File::setFileTimesInternal (int64 modificationTime, int64 accessTime, int64 | |||
| using namespace WindowsFileHelpers; | |||
| bool ok = false; | |||
| HANDLE h = CreateFile (fullPath, GENERIC_WRITE, FILE_SHARE_READ, 0, | |||
| HANDLE h = CreateFile (fullPath.toUTF16(), GENERIC_WRITE, FILE_SHARE_READ, 0, | |||
| OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); | |||
| if (h != INVALID_HANDLE_VALUE) | |||
| @@ -362,7 +360,7 @@ void File::findFileSystemRoots (Array<File>& destArray) | |||
| const String File::getVolumeLabel() const | |||
| { | |||
| TCHAR dest[64]; | |||
| if (! GetVolumeInformation (WindowsFileHelpers::getDriveFromPath (getFullPathName()), dest, | |||
| if (! GetVolumeInformation (WindowsFileHelpers::getDriveFromPath (getFullPathName()).toUTF16(), dest, | |||
| numElementsInArray (dest), 0, 0, 0, 0, 0)) | |||
| dest[0] = 0; | |||
| @@ -374,7 +372,7 @@ int File::getVolumeSerialNumber() const | |||
| TCHAR dest[64]; | |||
| DWORD serialNum; | |||
| if (! GetVolumeInformation (WindowsFileHelpers::getDriveFromPath (getFullPathName()), dest, | |||
| if (! GetVolumeInformation (WindowsFileHelpers::getDriveFromPath (getFullPathName()).toUTF16(), dest, | |||
| numElementsInArray (dest), &serialNum, 0, 0, 0, 0)) | |||
| return 0; | |||
| @@ -486,7 +484,7 @@ const File File::getCurrentWorkingDirectory() | |||
| bool File::setAsCurrentWorkingDirectory() const | |||
| { | |||
| return SetCurrentDirectory (getFullPathName()) != FALSE; | |||
| return SetCurrentDirectory (getFullPathName().toUTF16()) != FALSE; | |||
| } | |||
| //============================================================================== | |||
| @@ -495,11 +493,11 @@ const String File::getVersion() const | |||
| String result; | |||
| DWORD handle = 0; | |||
| DWORD bufferSize = GetFileVersionInfoSize (getFullPathName(), &handle); | |||
| DWORD bufferSize = GetFileVersionInfoSize (getFullPathName().toUTF16(), &handle); | |||
| HeapBlock<char> buffer; | |||
| buffer.calloc (bufferSize); | |||
| if (GetFileVersionInfo (getFullPathName(), 0, bufferSize, buffer)) | |||
| if (GetFileVersionInfo (getFullPathName().toUTF16(), 0, bufferSize, buffer)) | |||
| { | |||
| VS_FIXEDFILEINFO* vffi; | |||
| UINT len = 0; | |||
| @@ -533,7 +531,7 @@ const File File::getLinkedTarget() const | |||
| ComSmartPtr <IPersistFile> persistFile; | |||
| if (SUCCEEDED (shellLink.QueryInterface (IID_IPersistFile, persistFile))) | |||
| { | |||
| if (SUCCEEDED (persistFile->Load ((const WCHAR*) p, STGM_READ)) | |||
| if (SUCCEEDED (persistFile->Load (p.toUTF16(), STGM_READ)) | |||
| && SUCCEEDED (shellLink->Resolve (0, SLR_ANY_MATCH | SLR_NO_UI))) | |||
| { | |||
| WIN32_FIND_DATA winFindData; | |||
| @@ -574,7 +572,7 @@ public: | |||
| if (handle == INVALID_HANDLE_VALUE) | |||
| { | |||
| handle = FindFirstFile (directoryWithWildCard, &findData); | |||
| handle = FindFirstFile (directoryWithWildCard.toUTF16(), &findData); | |||
| if (handle == INVALID_HANDLE_VALUE) | |||
| return false; | |||
| @@ -628,7 +626,7 @@ bool PlatformUtilities::openDocument (const String& fileName, const String& para | |||
| JUCE_TRY | |||
| { | |||
| hInstance = ShellExecute (0, 0, fileName, parameters, 0, SW_SHOWDEFAULT); | |||
| hInstance = ShellExecute (0, 0, fileName.toUTF16(), parameters.toUTF16(), 0, SW_SHOWDEFAULT); | |||
| } | |||
| JUCE_CATCH_ALL | |||
| @@ -655,9 +653,9 @@ public: | |||
| { | |||
| cancelEvent = CreateEvent (0, FALSE, FALSE, 0); | |||
| pipeH = isPipe ? CreateNamedPipe (file, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, 0, | |||
| pipeH = isPipe ? CreateNamedPipe (file.toUTF16(), PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, 0, | |||
| PIPE_UNLIMITED_INSTANCES, 4096, 4096, 0, 0) | |||
| : CreateFile (file, GENERIC_READ | GENERIC_WRITE, 0, 0, | |||
| : CreateFile (file.toUTF16(), GENERIC_READ | GENERIC_WRITE, 0, 0, | |||
| OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); | |||
| } | |||
| @@ -62,7 +62,7 @@ static int CALLBACK wfontEnum1 (ENUMLOGFONTEXW* lpelfe, | |||
| lf.lfPitchAndFamily = FF_DONTCARE; | |||
| const String fontName (lpelfe->elfLogFont.lfFaceName); | |||
| fontName.copyToUnicode (lf.lfFaceName, LF_FACESIZE - 1); | |||
| fontName.copyToUTF16 (lf.lfFaceName, LF_FACESIZE - 1); | |||
| HDC dc = CreateCompatibleDC (0); | |||
| EnumFontFamiliesEx (dc, &lf, | |||
| @@ -168,7 +168,7 @@ public: | |||
| lfw.lfQuality = PROOF_QUALITY; | |||
| lfw.lfItalic = (BYTE) (italic ? TRUE : FALSE); | |||
| lfw.lfWeight = bold ? FW_BOLD : FW_NORMAL; | |||
| fontName.copyToUnicode (lfw.lfFaceName, LF_FACESIZE - 1); | |||
| fontName.copyToUTF16 (lfw.lfFaceName, LF_FACESIZE - 1); | |||
| lfw.lfHeight = size > 0 ? size : -256; | |||
| HFONT standardSizedFont = CreateFontIndirect (&lfw); | |||
| @@ -285,7 +285,7 @@ void MessageManager::doPlatformSpecificInitialisation() | |||
| wc.lpfnWndProc = (WNDPROC) juce_MessageWndProc; | |||
| wc.cbWndExtra = 4; | |||
| wc.hInstance = hmod; | |||
| wc.lpszClassName = className; | |||
| wc.lpszClassName = className.toUTF16(); | |||
| RegisterClassEx (&wc); | |||
| @@ -298,7 +298,7 @@ void MessageManager::doPlatformSpecificInitialisation() | |||
| void MessageManager::doPlatformSpecificShutdown() | |||
| { | |||
| DestroyWindow (juce_messageWindowHandle); | |||
| UnregisterClass (getMessageWindowClassName(), 0); | |||
| UnregisterClass (getMessageWindowClassName().toUTF16(), 0); | |||
| OleUninitialize(); | |||
| } | |||
| @@ -35,17 +35,16 @@ void SystemClipboard::copyTextToClipboard (const String& text) | |||
| { | |||
| if (EmptyClipboard() != 0) | |||
| { | |||
| const int len = text.length(); | |||
| const int bytesNeeded = CharPointer_UTF16::getBytesRequiredFor (text.getCharPointer()); | |||
| if (len > 0) | |||
| if (bytesNeeded > 0) | |||
| { | |||
| HGLOBAL bufH = GlobalAlloc (GMEM_MOVEABLE | GMEM_DDESHARE, | |||
| (len + 1) * sizeof (wchar_t)); | |||
| HGLOBAL bufH = GlobalAlloc (GMEM_MOVEABLE | GMEM_DDESHARE | GMEM_ZEROINIT, bytesNeeded + sizeof (WCHAR)); | |||
| if (bufH != 0) | |||
| { | |||
| WCHAR* const data = static_cast <WCHAR*> (GlobalLock (bufH)); | |||
| text.copyToUnicode (data, len); | |||
| text.copyToUTF16 (data, bytesNeeded); | |||
| GlobalUnlock (bufH); | |||
| SetClipboardData (CF_UNICODETEXT, bufH); | |||
| @@ -235,7 +235,7 @@ private: | |||
| uc.lpszUrlPath = file; | |||
| uc.lpszHostName = server; | |||
| if (InternetCrackUrl (address, 0, 0, &uc)) | |||
| if (InternetCrackUrl (address.toUTF16(), 0, 0, &uc)) | |||
| { | |||
| int disable = 1; | |||
| InternetSetOption (sessionHandle, INTERNET_OPTION_DISABLE_AUTODIAL, &disable, sizeof (disable)); | |||
| @@ -295,7 +295,7 @@ private: | |||
| INTERNET_BUFFERS buffers; | |||
| zerostruct (buffers); | |||
| buffers.dwStructSize = sizeof (INTERNET_BUFFERS); | |||
| buffers.lpcszHeader = static_cast <LPCTSTR> (headers); | |||
| buffers.lpcszHeader = headers.toUTF16(); | |||
| buffers.dwHeadersLength = headers.length(); | |||
| buffers.dwBufferTotal = (DWORD) postData.getSize(); | |||
| @@ -55,13 +55,13 @@ namespace | |||
| if (createForWriting) | |||
| { | |||
| if (RegCreateKeyEx (rootKey, name, 0, 0, REG_OPTION_NON_VOLATILE, | |||
| if (RegCreateKeyEx (rootKey, name.toUTF16(), 0, 0, REG_OPTION_NON_VOLATILE, | |||
| (KEY_WRITE | KEY_QUERY_VALUE), 0, &key, &result) == ERROR_SUCCESS) | |||
| return key; | |||
| } | |||
| else | |||
| { | |||
| if (RegOpenKeyEx (rootKey, name, 0, KEY_READ, &key) == ERROR_SUCCESS) | |||
| if (RegOpenKeyEx (rootKey, name.toUTF16(), 0, KEY_READ, &key) == ERROR_SUCCESS) | |||
| return key; | |||
| } | |||
| } | |||
| @@ -82,7 +82,7 @@ const String PlatformUtilities::getRegistryValue (const String& regValuePath, | |||
| unsigned long bufferSize = sizeof (buffer); | |||
| DWORD type = REG_SZ; | |||
| if (RegQueryValueEx (k, valueName, 0, &type, (LPBYTE) buffer, &bufferSize) == ERROR_SUCCESS) | |||
| if (RegQueryValueEx (k, valueName.toUTF16(), 0, &type, (LPBYTE) buffer, &bufferSize) == ERROR_SUCCESS) | |||
| { | |||
| if (type == REG_SZ) | |||
| result = buffer; | |||
| @@ -104,9 +104,9 @@ void PlatformUtilities::setRegistryValue (const String& regValuePath, | |||
| if (k != 0) | |||
| { | |||
| RegSetValueEx (k, valueName, 0, REG_SZ, | |||
| (const BYTE*) (const WCHAR*) value, | |||
| sizeof (WCHAR) * (value.length() + 1)); | |||
| RegSetValueEx (k, valueName.toUTF16(), 0, REG_SZ, | |||
| (const BYTE*) value.toUTF16().getAddress(), | |||
| CharPointer_UTF16::getBytesRequiredFor (value.getCharPointer())); | |||
| RegCloseKey (k); | |||
| } | |||
| @@ -124,7 +124,7 @@ bool PlatformUtilities::registryValueExists (const String& regValuePath) | |||
| unsigned long bufferSize = sizeof (buffer); | |||
| DWORD type = 0; | |||
| if (RegQueryValueEx (k, valueName, 0, &type, buffer, &bufferSize) == ERROR_SUCCESS) | |||
| if (RegQueryValueEx (k, valueName.toUTF16(), 0, &type, buffer, &bufferSize) == ERROR_SUCCESS) | |||
| exists = true; | |||
| RegCloseKey (k); | |||
| @@ -140,7 +140,7 @@ void PlatformUtilities::deleteRegistryValue (const String& regValuePath) | |||
| if (k != 0) | |||
| { | |||
| RegDeleteValue (k, valueName); | |||
| RegDeleteValue (k, valueName.toUTF16()); | |||
| RegCloseKey (k); | |||
| } | |||
| } | |||
| @@ -152,7 +152,7 @@ void PlatformUtilities::deleteRegistryKey (const String& regKeyPath) | |||
| if (k != 0) | |||
| { | |||
| RegDeleteKey (k, valueName); | |||
| RegDeleteKey (k, valueName.toUTF16()); | |||
| RegCloseKey (k); | |||
| } | |||
| } | |||
| @@ -31,7 +31,7 @@ | |||
| //============================================================================== | |||
| void Logger::outputDebugString (const String& text) | |||
| { | |||
| OutputDebugString (text + "\n"); | |||
| OutputDebugString ((text + "\n").toUTF16()); | |||
| } | |||
| //============================================================================== | |||
| @@ -318,7 +318,7 @@ void* PlatformUtilities::loadDynamicLibrary (const String& name) | |||
| JUCE_TRY | |||
| { | |||
| result = LoadLibrary (name); | |||
| result = LoadLibrary (name.toUTF16()); | |||
| } | |||
| JUCE_CATCH_ALL | |||
| @@ -348,7 +348,7 @@ public: | |||
| Pimpl (const String& name, const int timeOutMillisecs) | |||
| : handle (0), refCount (1) | |||
| { | |||
| handle = CreateMutex (0, TRUE, "Global\\" + name.replaceCharacter ('\\','/')); | |||
| handle = CreateMutex (0, TRUE, ("Global\\" + name.replaceCharacter ('\\','/')).toUTF16()); | |||
| if (handle != 0 && GetLastError() == ERROR_ALREADY_EXISTS) | |||
| { | |||
| @@ -90,7 +90,7 @@ public: | |||
| if (headers != 0) | |||
| { | |||
| V_VT (&headersVar) = VT_BSTR; | |||
| V_BSTR (&headersVar) = SysAllocString ((const OLECHAR*) headers->joinIntoString ("\r\n")); | |||
| V_BSTR (&headersVar) = SysAllocString ((const OLECHAR*) headers->joinIntoString ("\r\n").toUTF16().getAddress()); | |||
| } | |||
| if (postData != 0 && postData->getSize() > 0) | |||
| @@ -118,7 +118,7 @@ public: | |||
| } | |||
| } | |||
| browser->Navigate ((BSTR) (const OLECHAR*) url, | |||
| browser->Navigate ((BSTR) (const OLECHAR*) url.toUTF16().getAddress(), | |||
| &flags, &frame, | |||
| &postDataVar, &headersVar); | |||
| @@ -536,7 +536,7 @@ public: | |||
| void setTitle (const String& title) | |||
| { | |||
| SetWindowText (hwnd, title); | |||
| SetWindowText (hwnd, title.toUTF16()); | |||
| } | |||
| void setPosition (int x, int y) | |||
| @@ -900,7 +900,7 @@ public: | |||
| if (taskBarIcon != 0) | |||
| { | |||
| taskBarIcon->uFlags = NIF_TIP; | |||
| toolTip.copyToUnicode (taskBarIcon->szTip, sizeof (taskBarIcon->szTip) - 1); | |||
| toolTip.copyToUTF16 (taskBarIcon->szTip, sizeof (taskBarIcon->szTip) - 1); | |||
| Shell_NotifyIcon (NIM_MODIFY, taskBarIcon); | |||
| } | |||
| } | |||
| @@ -1076,7 +1076,7 @@ private: | |||
| wcex.cbSize = sizeof (wcex); | |||
| wcex.style = CS_OWNDC; | |||
| wcex.lpfnWndProc = (WNDPROC) windowProc; | |||
| wcex.lpszClassName = windowClassName; | |||
| wcex.lpszClassName = windowClassName.toUTF16(); | |||
| wcex.cbClsExtra = 0; | |||
| wcex.cbWndExtra = 32; | |||
| wcex.hInstance = moduleHandle; | |||
| @@ -1093,7 +1093,7 @@ private: | |||
| ~WindowClassHolder() | |||
| { | |||
| if (ComponentPeer::getNumPeers() == 0) | |||
| UnregisterClass (windowClassName, (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle()); | |||
| UnregisterClass (windowClassName.toUTF16(), (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle()); | |||
| clearSingletonInstance(); | |||
| } | |||
| @@ -1159,7 +1159,7 @@ private: | |||
| && Desktop::canUseSemiTransparentWindows()) | |||
| exstyle |= WS_EX_LAYERED; | |||
| hwnd = CreateWindowEx (exstyle, WindowClassHolder::getInstance()->windowClassName, L"", type, 0, 0, 0, 0, | |||
| hwnd = CreateWindowEx (exstyle, WindowClassHolder::getInstance()->windowClassName.toUTF16(), L"", type, 0, 0, 0, 0, | |||
| parentToAddTo, 0, (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle(), 0); | |||
| #if JUCE_DIRECT2D | |||
| @@ -2436,7 +2436,7 @@ bool AlertWindow::showNativeDialogBox (const String& title, | |||
| const String& bodyText, | |||
| bool isOkCancel) | |||
| { | |||
| return MessageBox (0, bodyText, title, | |||
| return MessageBox (0, bodyText.toUTF16(), title.toUTF16(), | |||
| MB_SETFOREGROUND | (isOkCancel ? MB_OKCANCEL | |||
| : MB_OK)) == IDOK; | |||
| } | |||
| @@ -2587,13 +2587,10 @@ void juce_updateMultiMonitorInfo (Array <Rectangle<int> >& monitorCoords, const | |||
| const Image juce_createIconForFile (const File& file) | |||
| { | |||
| Image image; | |||
| WCHAR filename [1024]; | |||
| file.getFullPathName().copyToUnicode (filename, 1023); | |||
| WORD iconNum = 0; | |||
| HICON icon = ExtractAssociatedIcon ((HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle(), | |||
| filename, &iconNum); | |||
| const_cast <WCHAR*> (file.getFullPathName().toUTF16().getAddress()), &iconNum); | |||
| if (icon != 0) | |||
| { | |||
| @@ -2908,12 +2905,11 @@ private: | |||
| static HDROP createHDrop (const StringArray& fileNames) | |||
| { | |||
| int totalChars = 0; | |||
| int totalBytes = 0; | |||
| for (int i = fileNames.size(); --i >= 0;) | |||
| totalChars += fileNames[i].length() + 1; | |||
| totalBytes += CharPointer_UTF16::getBytesRequiredFor (fileNames[i].getCharPointer()) + sizeof (WCHAR); | |||
| HDROP hDrop = (HDROP) GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, | |||
| sizeof (DROPFILES) + sizeof (WCHAR) * (totalChars + 2)); | |||
| HDROP hDrop = (HDROP) GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof (DROPFILES) + totalBytes + 4); | |||
| if (hDrop != 0) | |||
| { | |||
| @@ -2925,8 +2921,8 @@ static HDROP createHDrop (const StringArray& fileNames) | |||
| for (int i = 0; i < fileNames.size(); ++i) | |||
| { | |||
| fileNames[i].copyToUnicode (fname, 2048); | |||
| fname += fileNames[i].length() + 1; | |||
| const int bytesWritten = fileNames[i].copyToUTF16 (fname, 2048); | |||
| fname = reinterpret_cast<WCHAR*> (addBytesToPointer (fname, bytesWritten)); | |||
| } | |||
| *fname = 0; | |||
| @@ -2967,12 +2963,12 @@ bool DragAndDropContainer::performExternalDragDropOfText (const String& text) | |||
| FORMATETC format = { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; | |||
| STGMEDIUM medium = { TYMED_HGLOBAL, { 0 }, 0 }; | |||
| const int numChars = text.length(); | |||
| const int numBytes = CharPointer_UTF16::getBytesRequiredFor (text.getCharPointer()); | |||
| medium.hGlobal = GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, (numChars + 2) * sizeof (WCHAR)); | |||
| medium.hGlobal = GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, numBytes + 2); | |||
| WCHAR* const data = static_cast <WCHAR*> (GlobalLock (medium.hGlobal)); | |||
| text.copyToUnicode (data, numChars + 1); | |||
| text.copyToUTF16 (data, numBytes); | |||
| format.cfFormat = CF_UNICODETEXT; | |||
| GlobalUnlock (medium.hGlobal); | |||
| @@ -36,9 +36,13 @@ | |||
| class CharPointer_UTF16 | |||
| { | |||
| public: | |||
| #if JUCE_WINDOWS && ! DOXYGEN | |||
| typedef wchar_t CharType; | |||
| #else | |||
| typedef int16 CharType; | |||
| #endif | |||
| inline CharPointer_UTF16 (const CharType* const rawPointer) throw() | |||
| inline explicit CharPointer_UTF16 (const CharType* const rawPointer) throw() | |||
| : data (const_cast <CharType*> (rawPointer)) | |||
| { | |||
| } | |||
| @@ -54,19 +58,40 @@ public: | |||
| return *this; | |||
| } | |||
| inline CharPointer_UTF16& operator= (const CharType* text) throw() | |||
| { | |||
| data = const_cast <CharType*> (text); | |||
| return *this; | |||
| } | |||
| /** This is a pointer comparison, it doesn't compare the actual text. */ | |||
| inline bool operator== (const CharPointer_UTF16& other) const throw() | |||
| { | |||
| return data == other.data; | |||
| } | |||
| /** This is a pointer comparison, it doesn't compare the actual text. */ | |||
| inline bool operator!= (const CharPointer_UTF16& other) const throw() | |||
| { | |||
| return data == other.data; | |||
| } | |||
| /** Returns the address that this pointer is pointing to. */ | |||
| inline CharType* getAddress() const throw() { return data; } | |||
| inline CharType* getAddress() const throw() { return data; } | |||
| /** Returns the address that this pointer is pointing to. */ | |||
| inline operator const CharType*() const throw() { return data; } | |||
| /** Returns true if this pointer is pointing to a null character. */ | |||
| inline bool isEmpty() const throw() { return *data == 0; } | |||
| inline bool isEmpty() const throw() { return *data == 0; } | |||
| /** Returns the unicode character that this pointer is pointing to. */ | |||
| juce_wchar operator*() const throw() | |||
| { | |||
| uint32 n = (uint32) (uint16) *data; | |||
| if (n >= 0xd800 && n <= 0xdfff) | |||
| n = 0x10000 + (((n & ~0xd800) << 10) | (data[1] & ~0xdc00)); | |||
| if (n >= 0xd800 && n <= 0xdfff && ((uint32) (uint16) data[1]) >= 0xdc00) | |||
| n = 0x10000 + (((n - 0xd800) << 10) | (((uint32) (uint16) data[1]) - 0xdc00)); | |||
| return (juce_wchar) n; | |||
| } | |||
| @@ -76,7 +101,7 @@ public: | |||
| { | |||
| const juce_wchar n = *data++; | |||
| if (n >= 0xd800 && n <= 0xdfff) | |||
| if (n >= 0xd800 && n <= 0xdfff && ((uint32) (uint16) *data) >= 0xdc00) | |||
| ++data; | |||
| return *this; | |||
| @@ -88,11 +113,8 @@ public: | |||
| { | |||
| uint32 n = (uint32) (uint16) *data++; | |||
| if (n >= 0xd800 && n <= 0xdfff) | |||
| { | |||
| n = 0x10000 + (((n & ~0xd800) << 10) | (*data & ~0xdc00)); | |||
| ++data; | |||
| } | |||
| if (n >= 0xd800 && n <= 0xdfff && ((uint32) (uint16) *data) >= 0xdc00) | |||
| n = 0x10000 + ((((n - 0xd800) << 10) | (((uint32) (uint16) *data++) - 0xdc00))); | |||
| return (juce_wchar) n; | |||
| } | |||
| @@ -115,7 +137,7 @@ public: | |||
| } | |||
| /** Returns the character at a given character index from the start of the string. */ | |||
| juce_wchar operator[] (int characterIndex) const throw() | |||
| juce_wchar operator[] (const int characterIndex) const throw() | |||
| { | |||
| CharPointer_UTF16 p (*this); | |||
| p += characterIndex; | |||
| @@ -123,7 +145,7 @@ public: | |||
| } | |||
| /** Returns a pointer which is moved forwards from this one by the specified number of characters. */ | |||
| CharPointer_UTF16 operator+ (int numToSkip) const throw() | |||
| CharPointer_UTF16 operator+ (const int numToSkip) const throw() | |||
| { | |||
| CharPointer_UTF16 p (*this); | |||
| p += numToSkip; | |||
| @@ -131,19 +153,26 @@ public: | |||
| } | |||
| /** Writes a unicode character to this string, and advances this pointer to point to the next position. */ | |||
| void write (const juce_wchar charToWrite) throw() | |||
| void write (juce_wchar charToWrite) throw() | |||
| { | |||
| if (charToWrite < 0xd800 || (charToWrite > 0xdfff && charToWrite <= 0xffff)) | |||
| if (charToWrite >= 0x10000) | |||
| { | |||
| *data++ = (CharType) charToWrite; | |||
| charToWrite -= 0x10000; | |||
| *data++ = (CharType) (0xd800 + (charToWrite >> 10)); | |||
| *data++ = (CharType) (0xdc00 + (charToWrite & 0x3ff)); | |||
| } | |||
| else | |||
| { | |||
| *data++ = (CharType) ((0xd800 - (0x10000 >> 10)) + (charToWrite >> 10)); | |||
| *data++ = (CharType) (0xdc00 + (charToWrite & 0x3ff)); | |||
| *data++ = (CharType) charToWrite; | |||
| } | |||
| } | |||
| /** Writes a null character to this string (leaving the pointer's position unchanged). */ | |||
| inline void writeNull() const throw() | |||
| { | |||
| *data = 0; | |||
| } | |||
| /** Returns the number of characters in this string. */ | |||
| size_t length() const throw() | |||
| { | |||
| @@ -155,7 +184,10 @@ public: | |||
| const int n = *d++; | |||
| if (n >= 0xd800 && n <= 0xdfff) | |||
| ++d; | |||
| { | |||
| if (*d++ == 0) | |||
| break; | |||
| } | |||
| else if (n == 0) | |||
| break; | |||
| @@ -165,6 +197,12 @@ public: | |||
| return count; | |||
| } | |||
| /** Returns the number of characters in this string, or the given value, whichever is lower. */ | |||
| size_t lengthUpTo (const size_t maxCharsToCount) const throw() | |||
| { | |||
| return CharacterFunctions::lengthUpTo (*this, maxCharsToCount); | |||
| } | |||
| /** Returns the number of bytes that are used to represent this string. | |||
| This includes the terminating null character. | |||
| */ | |||
| @@ -178,8 +216,7 @@ public: | |||
| */ | |||
| static size_t getBytesRequiredFor (const juce_wchar charToWrite) throw() | |||
| { | |||
| return (charToWrite < 0xd800 || (charToWrite > 0xdfff && charToWrite <= 0xffff)) | |||
| ? 1 : 2; | |||
| return (charToWrite >= 0x10000) ? (sizeof (CharType) * 2) : sizeof (CharType); | |||
| } | |||
| /** Returns the number of bytes that would be needed to represent the given | |||
| @@ -211,13 +248,13 @@ public: | |||
| /** Copies a source string to this pointer, advancing this pointer as it goes. */ | |||
| template <typename CharPointer> | |||
| void copyAndAdvance (const CharPointer& src) throw() | |||
| void writeAll (const CharPointer& src) throw() | |||
| { | |||
| CharacterFunctions::copyAndAdvance (*this, src); | |||
| CharacterFunctions::copyAll (*this, src); | |||
| } | |||
| /** Copies a source string to this pointer, advancing this pointer as it goes. */ | |||
| void copyAndAdvance (const CharPointer_UTF16& src) throw() | |||
| void writeAll (const CharPointer_UTF16& src) throw() | |||
| { | |||
| const CharType* s = src.data; | |||
| @@ -229,13 +266,13 @@ public: | |||
| } | |||
| /** Copies a source string to this pointer, advancing this pointer as it goes. | |||
| The maxBytes parameter specifies the maximum number of bytes that can be written | |||
| The maxDestBytes parameter specifies the maximum number of bytes that can be written | |||
| to the destination buffer before stopping. | |||
| */ | |||
| template <typename CharPointer> | |||
| int copyAndAdvanceUpToBytes (const CharPointer& src, int maxBytes) throw() | |||
| int writeWithDestByteLimit (const CharPointer& src, const int maxDestBytes) throw() | |||
| { | |||
| return CharacterFunctions::copyAndAdvanceUpToBytes (*this, src, maxBytes); | |||
| return CharacterFunctions::copyWithDestByteLimit (*this, src, maxDestBytes); | |||
| } | |||
| /** Copies a source string to this pointer, advancing this pointer as it goes. | |||
| @@ -243,9 +280,9 @@ public: | |||
| written to the destination buffer before stopping (including the terminating null). | |||
| */ | |||
| template <typename CharPointer> | |||
| void copyAndAdvanceUpToNumChars (const CharPointer& src, int maxChars) throw() | |||
| void writeWithCharLimit (const CharPointer& src, const int maxChars) throw() | |||
| { | |||
| CharacterFunctions::copyAndAdvanceUpToNumChars (*this, src, maxChars); | |||
| CharacterFunctions::copyWithCharLimit (*this, src, maxChars); | |||
| } | |||
| /** Compares this string with another one. */ | |||
| @@ -257,7 +294,7 @@ public: | |||
| /** Compares this string with another one, up to a specified number of characters. */ | |||
| template <typename CharPointer> | |||
| int compareUpTo (const CharPointer& other, int maxChars) const throw() | |||
| int compareUpTo (const CharPointer& other, const int maxChars) const throw() | |||
| { | |||
| return CharacterFunctions::compareUpTo (*this, other, maxChars); | |||
| } | |||
| @@ -271,11 +308,29 @@ public: | |||
| /** Compares this string with another one, up to a specified number of characters. */ | |||
| template <typename CharPointer> | |||
| int compareIgnoreCaseUpTo (const CharPointer& other, int maxChars) const throw() | |||
| int compareIgnoreCaseUpTo (const CharPointer& other, const int maxChars) const throw() | |||
| { | |||
| return CharacterFunctions::compareIgnoreCaseUpTo (*this, other, maxChars); | |||
| } | |||
| #if JUCE_WINDOWS && ! DOXYGEN | |||
| int compareIgnoreCase (const CharPointer_UTF16& other) const throw() | |||
| { | |||
| return _wcsicmp (data, other.data); | |||
| } | |||
| int compareIgnoreCaseUpTo (const CharPointer_UTF16& other, int maxChars) const throw() | |||
| { | |||
| return _wcsnicmp (data, other.data, maxChars); | |||
| } | |||
| int indexOf (const CharPointer_UTF16& stringToFind) const throw() | |||
| { | |||
| const CharType* const t = wcsstr (data, stringToFind.getAddress()); | |||
| return t == 0 ? -1 : (int) (t - data); | |||
| } | |||
| #endif | |||
| /** Returns the character index of a substring, or -1 if it isn't found. */ | |||
| template <typename CharPointer> | |||
| int indexOf (const CharPointer& stringToFind) const throw() | |||
| @@ -315,9 +370,24 @@ public: | |||
| juce_wchar toLowerCase() const throw() { return CharacterFunctions::toLowerCase (operator*()); } | |||
| /** Parses this string as a 32-bit integer. */ | |||
| int getIntValue32() const throw() { return CharacterFunctions::getIntValue <int, CharPointer_UTF16> (*this); } | |||
| int getIntValue32() const throw() | |||
| { | |||
| #if JUCE_WINDOWS | |||
| return _wtoi (data); | |||
| #else | |||
| return CharacterFunctions::getIntValue <int, CharPointer_UTF16> (*this); | |||
| #endif | |||
| } | |||
| /** Parses this string as a 64-bit integer. */ | |||
| int64 getIntValue64() const throw() { return CharacterFunctions::getIntValue <int64, CharPointer_UTF16> (*this); } | |||
| int64 getIntValue64() const throw() | |||
| { | |||
| #if JUCE_WINDOWS | |||
| return _wtoi64 (data); | |||
| #else | |||
| return CharacterFunctions::getIntValue <int64, CharPointer_UTF16> (*this); | |||
| #endif | |||
| } | |||
| /** Parses this string as a floating point double. */ | |||
| double getDoubleValue() const throw() { return CharacterFunctions::getDoubleValue (*this); } | |||
| @@ -325,6 +395,15 @@ public: | |||
| /** Returns the first non-whitespace character in the string. */ | |||
| CharPointer_UTF16 findEndOfWhitespace() const throw() { return CharacterFunctions::findEndOfWhitespace (*this); } | |||
| /** These values are the byte-order-mark (BOM) values for a UTF-16 stream. */ | |||
| enum | |||
| { | |||
| byteOrderMarkBE1 = 0xfe, | |||
| byteOrderMarkBE2 = 0xff, | |||
| byteOrderMarkLE1 = 0xff, | |||
| byteOrderMarkLE2 = 0xfe | |||
| }; | |||
| private: | |||
| CharType* data; | |||
| @@ -38,7 +38,7 @@ class CharPointer_UTF32 | |||
| public: | |||
| typedef juce_wchar CharType; | |||
| inline CharPointer_UTF32 (const CharType* const rawPointer) throw() | |||
| inline explicit CharPointer_UTF32 (const CharType* const rawPointer) throw() | |||
| : data (const_cast <CharType*> (rawPointer)) | |||
| { | |||
| } | |||
| @@ -54,14 +54,35 @@ public: | |||
| return *this; | |||
| } | |||
| inline CharPointer_UTF32& operator= (const CharType* text) throw() | |||
| { | |||
| data = const_cast <CharType*> (text); | |||
| return *this; | |||
| } | |||
| /** This is a pointer comparison, it doesn't compare the actual text. */ | |||
| inline bool operator== (const CharPointer_UTF32& other) const throw() | |||
| { | |||
| return data == other.data; | |||
| } | |||
| /** This is a pointer comparison, it doesn't compare the actual text. */ | |||
| inline bool operator!= (const CharPointer_UTF32& other) const throw() | |||
| { | |||
| return data == other.data; | |||
| } | |||
| /** Returns the address that this pointer is pointing to. */ | |||
| inline CharType* getAddress() const throw() { return data; } | |||
| /** Returns the address that this pointer is pointing to. */ | |||
| inline CharType* getAddress() const throw() { return data; } | |||
| inline operator const CharType*() const throw() { return data; } | |||
| /** Returns true if this pointer is pointing to a null character. */ | |||
| inline bool isEmpty() const throw() { return *data == 0; } | |||
| inline bool isEmpty() const throw() { return *data == 0; } | |||
| /** Returns the unicode character that this pointer is pointing to. */ | |||
| inline juce_wchar operator*() const throw() { return *data; } | |||
| inline juce_wchar operator*() const throw() { return *data; } | |||
| /** Moves this pointer along to the next character in the string. */ | |||
| inline CharPointer_UTF32& operator++() throw() | |||
| @@ -90,30 +111,30 @@ public: | |||
| } | |||
| /** Moves this pointer forwards by the specified number of characters. */ | |||
| inline void operator+= (int numToSkip) throw() | |||
| inline void operator+= (const int numToSkip) throw() | |||
| { | |||
| data += numToSkip; | |||
| } | |||
| inline void operator-= (int numToSkip) throw() | |||
| inline void operator-= (const int numToSkip) throw() | |||
| { | |||
| data -= numToSkip; | |||
| } | |||
| /** Returns the character at a given character index from the start of the string. */ | |||
| inline juce_wchar operator[] (int characterIndex) const throw() | |||
| inline juce_wchar& operator[] (const int characterIndex) const throw() | |||
| { | |||
| return data [characterIndex]; | |||
| } | |||
| /** Returns a pointer which is moved forwards from this one by the specified number of characters. */ | |||
| CharPointer_UTF32 operator+ (int numToSkip) const throw() | |||
| CharPointer_UTF32 operator+ (const int numToSkip) const throw() | |||
| { | |||
| return CharPointer_UTF32 (data + numToSkip); | |||
| } | |||
| /** Returns a pointer which is moved backwards from this one by the specified number of characters. */ | |||
| CharPointer_UTF32 operator- (int numToSkip) const throw() | |||
| CharPointer_UTF32 operator- (const int numToSkip) const throw() | |||
| { | |||
| return CharPointer_UTF32 (data - numToSkip); | |||
| } | |||
| @@ -124,12 +145,23 @@ public: | |||
| *data++ = charToWrite; | |||
| } | |||
| inline void replaceChar (const juce_wchar newChar) throw() | |||
| { | |||
| *data = newChar; | |||
| } | |||
| /** Writes a null character to this string (leaving the pointer's position unchanged). */ | |||
| inline void writeNull() const throw() | |||
| { | |||
| *data = 0; | |||
| } | |||
| /** Returns the number of characters in this string. */ | |||
| size_t length() const throw() | |||
| { | |||
| #if JUCE_ANDROID | |||
| #if JUCE_NATIVE_WCHAR_IS_NOT_UTF32 | |||
| size_t n = 0; | |||
| while (data[n] == 0) | |||
| while (data[n] != 0) | |||
| ++n; | |||
| return n; | |||
| #else | |||
| @@ -137,6 +169,12 @@ public: | |||
| #endif | |||
| } | |||
| /** Returns the number of characters in this string, or the given value, whichever is lower. */ | |||
| size_t lengthUpTo (const size_t maxCharsToCount) const throw() | |||
| { | |||
| return CharacterFunctions::lengthUpTo (*this, maxCharsToCount); | |||
| } | |||
| /** Returns the number of bytes that are used to represent this string. | |||
| This includes the terminating null character. | |||
| */ | |||
| @@ -171,27 +209,31 @@ public: | |||
| /** Copies a source string to this pointer, advancing this pointer as it goes. */ | |||
| template <typename CharPointer> | |||
| void copyAndAdvance (const CharPointer& src) throw() | |||
| void writeAll (const CharPointer& src) throw() | |||
| { | |||
| CharacterFunctions::copyAndAdvance (*this, src); | |||
| CharacterFunctions::copyAll (*this, src); | |||
| } | |||
| #if ! JUCE_ANDROID | |||
| /** Copies a source string to this pointer, advancing this pointer as it goes. */ | |||
| void copyAndAdvance (const CharPointer_UTF32& src) throw() | |||
| void writeAll (const CharPointer_UTF32& src) throw() | |||
| { | |||
| data = wcscpy (data, src.data); | |||
| const CharType* s = src.data; | |||
| while ((*data = *s) != 0) | |||
| { | |||
| ++data; | |||
| ++s; | |||
| } | |||
| } | |||
| #endif | |||
| /** Copies a source string to this pointer, advancing this pointer as it goes. | |||
| The maxBytes parameter specifies the maximum number of bytes that can be written | |||
| The maxDestBytes parameter specifies the maximum number of bytes that can be written | |||
| to the destination buffer before stopping. | |||
| */ | |||
| template <typename CharPointer> | |||
| int copyAndAdvanceUpToBytes (const CharPointer& src, int maxBytes) throw() | |||
| int writeWithDestByteLimit (const CharPointer& src, const int maxDestBytes) throw() | |||
| { | |||
| return CharacterFunctions::copyAndAdvanceUpToBytes (*this, src, maxBytes); | |||
| return CharacterFunctions::copyWithDestByteLimit (*this, src, maxDestBytes); | |||
| } | |||
| /** Copies a source string to this pointer, advancing this pointer as it goes. | |||
| @@ -199,9 +241,9 @@ public: | |||
| written to the destination buffer before stopping (including the terminating null). | |||
| */ | |||
| template <typename CharPointer> | |||
| void copyAndAdvanceUpToNumChars (const CharPointer& src, int maxChars) throw() | |||
| void writeWithCharLimit (const CharPointer& src, const int maxChars) throw() | |||
| { | |||
| CharacterFunctions::copyAndAdvanceUpToNumChars (*this, src, maxChars); | |||
| CharacterFunctions::copyWithCharLimit (*this, src, maxChars); | |||
| } | |||
| /** Compares this string with another one. */ | |||
| @@ -211,7 +253,7 @@ public: | |||
| return CharacterFunctions::compare (*this, other); | |||
| } | |||
| #if ! JUCE_ANDROID | |||
| #if ! JUCE_NATIVE_WCHAR_IS_NOT_UTF32 | |||
| /** Compares this string with another one. */ | |||
| int compare (const CharPointer_UTF32& other) const throw() | |||
| { | |||
| @@ -221,7 +263,7 @@ public: | |||
| /** Compares this string with another one, up to a specified number of characters. */ | |||
| template <typename CharPointer> | |||
| int compareUpTo (const CharPointer& other, int maxChars) const throw() | |||
| int compareUpTo (const CharPointer& other, const int maxChars) const throw() | |||
| { | |||
| return CharacterFunctions::compareUpTo (*this, other, maxChars); | |||
| } | |||
| @@ -235,7 +277,7 @@ public: | |||
| /** Compares this string with another one, up to a specified number of characters. */ | |||
| template <typename CharPointer> | |||
| int compareIgnoreCaseUpTo (const CharPointer& other, int maxChars) const throw() | |||
| int compareIgnoreCaseUpTo (const CharPointer& other, const int maxChars) const throw() | |||
| { | |||
| return CharacterFunctions::compareIgnoreCaseUpTo (*this, other, maxChars); | |||
| } | |||
| @@ -270,24 +312,6 @@ public: | |||
| : CharacterFunctions::indexOfChar (*this, charToFind); | |||
| } | |||
| #if JUCE_WINDOWS && ! DOXYGEN | |||
| int compareIgnoreCase (const CharPointer_UTF32& other) const throw() | |||
| { | |||
| return _wcsicmp (data, other.data); | |||
| } | |||
| int compareIgnoreCaseUpTo (const CharPointer_UTF32& other, int maxChars) const throw() | |||
| { | |||
| return _wcsnicmp (data, other.data, maxChars); | |||
| } | |||
| int indexOf (const CharPointer_UTF32& stringToFind) const throw() | |||
| { | |||
| const CharType* const t = wcsstr (data, stringToFind.getAddress()); | |||
| return t == 0 ? -1 : (t - data); | |||
| } | |||
| #endif | |||
| /** Returns true if the first character of this string is whitespace. */ | |||
| bool isWhitespace() const { return CharacterFunctions::isWhitespace (*data) != 0; } | |||
| /** Returns true if the first character of this string is a digit. */ | |||
| @@ -307,24 +331,9 @@ public: | |||
| juce_wchar toLowerCase() const throw() { return CharacterFunctions::toLowerCase (*data); } | |||
| /** Parses this string as a 32-bit integer. */ | |||
| int getIntValue32() const throw() | |||
| { | |||
| #if JUCE_WINDOWS | |||
| return _wtoi (data); | |||
| #else | |||
| return CharacterFunctions::getIntValue <int, CharPointer_UTF32> (*this); | |||
| #endif | |||
| } | |||
| int getIntValue32() const throw() { return CharacterFunctions::getIntValue <int, CharPointer_UTF32> (*this); } | |||
| /** Parses this string as a 64-bit integer. */ | |||
| int64 getIntValue64() const throw() | |||
| { | |||
| #if JUCE_WINDOWS | |||
| return _wtoi64 (data); | |||
| #else | |||
| return CharacterFunctions::getIntValue <int64, CharPointer_UTF32> (*this); | |||
| #endif | |||
| } | |||
| int64 getIntValue64() const throw() { return CharacterFunctions::getIntValue <int64, CharPointer_UTF32> (*this); } | |||
| /** Parses this string as a floating point double. */ | |||
| double getDoubleValue() const throw() { return CharacterFunctions::getDoubleValue (*this); } | |||
| @@ -332,6 +341,11 @@ public: | |||
| /** Returns the first non-whitespace character in the string. */ | |||
| CharPointer_UTF32 findEndOfWhitespace() const throw() { return CharacterFunctions::findEndOfWhitespace (*this); } | |||
| CharPointer_UTF32 atomicSwap (const CharPointer_UTF32& newValue) | |||
| { | |||
| return CharPointer_UTF32 (reinterpret_cast <Atomic<CharType*>&> (data).exchange (newValue.data)); | |||
| } | |||
| private: | |||
| CharType* data; | |||
| }; | |||
| @@ -37,7 +37,7 @@ class CharPointer_UTF8 | |||
| public: | |||
| typedef char CharType; | |||
| inline CharPointer_UTF8 (const CharType* const rawPointer) throw() | |||
| inline explicit CharPointer_UTF8 (const CharType* const rawPointer) throw() | |||
| : data (const_cast <CharType*> (rawPointer)) | |||
| { | |||
| } | |||
| @@ -53,11 +53,32 @@ public: | |||
| return *this; | |||
| } | |||
| inline CharPointer_UTF8& operator= (const CharType* text) throw() | |||
| { | |||
| data = const_cast <CharType*> (text); | |||
| return *this; | |||
| } | |||
| /** This is a pointer comparison, it doesn't compare the actual text. */ | |||
| inline bool operator== (const CharPointer_UTF8& other) const throw() | |||
| { | |||
| return data == other.data; | |||
| } | |||
| /** This is a pointer comparison, it doesn't compare the actual text. */ | |||
| inline bool operator!= (const CharPointer_UTF8& other) const throw() | |||
| { | |||
| return data == other.data; | |||
| } | |||
| /** Returns the address that this pointer is pointing to. */ | |||
| inline CharType* getAddress() const throw() { return data; } | |||
| inline CharType* getAddress() const throw() { return data; } | |||
| /** Returns the address that this pointer is pointing to. */ | |||
| inline operator const CharType*() const throw() { return data; } | |||
| /** Returns true if this pointer is pointing to a null character. */ | |||
| inline bool isEmpty() const throw() { return *data == 0; } | |||
| inline bool isEmpty() const throw() { return *data == 0; } | |||
| /** Returns the unicode character that this pointer is pointing to. */ | |||
| juce_wchar operator*() const throw() | |||
| @@ -104,7 +125,7 @@ public: | |||
| { | |||
| juce_wchar bit = 0x40; | |||
| while ((n & bit) != 0 && bit > 0x10) | |||
| while ((n & bit) != 0 && bit > 0x8) | |||
| { | |||
| ++data; | |||
| bit >>= 1; | |||
| @@ -128,7 +149,7 @@ public: | |||
| uint32 bit = 0x40; | |||
| int numExtraValues = 0; | |||
| while ((n & bit) != 0 && bit > 0x10) | |||
| while ((n & bit) != 0 && bit > 0x8) | |||
| { | |||
| mask >>= 1; | |||
| ++numExtraValues; | |||
| @@ -184,32 +205,6 @@ public: | |||
| return p; | |||
| } | |||
| /** Writes a unicode character to this string, and advances this pointer to point to the next position. */ | |||
| void write (const juce_wchar charToWrite) throw() | |||
| { | |||
| const uint32 c = (uint32) charToWrite; | |||
| if (c >= 0x80) | |||
| { | |||
| int numExtraBytes = 1; | |||
| if (c >= 0x800) | |||
| { | |||
| ++numExtraBytes; | |||
| if (c >= 0x10000) | |||
| ++numExtraBytes; | |||
| } | |||
| *data++ = (CharType) ((0xff << (7 - numExtraBytes)) | (c >> (numExtraBytes * 6))); | |||
| while (--numExtraBytes >= 0) | |||
| *data++ = (CharType) (0x80 | (0x3f & (c >> (numExtraBytes * 6)))); | |||
| } | |||
| else | |||
| { | |||
| *data++ = (CharType) c; | |||
| } | |||
| } | |||
| /** Returns the number of characters in this string. */ | |||
| size_t length() const throw() | |||
| { | |||
| @@ -242,6 +237,12 @@ public: | |||
| return count; | |||
| } | |||
| /** Returns the number of characters in this string, or the given value, whichever is lower. */ | |||
| size_t lengthUpTo (const size_t maxCharsToCount) const throw() | |||
| { | |||
| return CharacterFunctions::lengthUpTo (*this, maxCharsToCount); | |||
| } | |||
| /** Returns the number of bytes that are used to represent this string. | |||
| This includes the terminating null character. | |||
| */ | |||
| @@ -294,27 +295,65 @@ public: | |||
| return CharPointer_UTF8 (data + strlen (data)); | |||
| } | |||
| /** Writes a unicode character to this string, and advances this pointer to point to the next position. */ | |||
| void write (const juce_wchar charToWrite) throw() | |||
| { | |||
| const uint32 c = (uint32) charToWrite; | |||
| if (c >= 0x80) | |||
| { | |||
| int numExtraBytes = 1; | |||
| if (c >= 0x800) | |||
| { | |||
| ++numExtraBytes; | |||
| if (c >= 0x10000) | |||
| ++numExtraBytes; | |||
| } | |||
| *data++ = (CharType) ((0xff << (7 - numExtraBytes)) | (c >> (numExtraBytes * 6))); | |||
| while (--numExtraBytes >= 0) | |||
| *data++ = (CharType) (0x80 | (0x3f & (c >> (numExtraBytes * 6)))); | |||
| } | |||
| else | |||
| { | |||
| *data++ = (CharType) c; | |||
| } | |||
| } | |||
| /** Writes a null character to this string (leaving the pointer's position unchanged). */ | |||
| inline void writeNull() const throw() | |||
| { | |||
| *data = 0; | |||
| } | |||
| /** Copies a source string to this pointer, advancing this pointer as it goes. */ | |||
| template <typename CharPointer> | |||
| void copyAndAdvance (const CharPointer& src) throw() | |||
| void writeAll (const CharPointer& src) throw() | |||
| { | |||
| CharacterFunctions::copyAndAdvance (*this, src); | |||
| CharacterFunctions::copyAll (*this, src); | |||
| } | |||
| /** Copies a source string to this pointer, advancing this pointer as it goes. */ | |||
| void copyAndAdvance (const CharPointer_UTF8& src) throw() | |||
| void writeAll (const CharPointer_UTF8& src) throw() | |||
| { | |||
| data = (CharType*) strcpy ((char*) data, src.data); | |||
| const CharType* s = src.data; | |||
| while ((*data = *s) != 0) | |||
| { | |||
| ++data; | |||
| ++s; | |||
| } | |||
| } | |||
| /** Copies a source string to this pointer, advancing this pointer as it goes. | |||
| The maxBytes parameter specifies the maximum number of bytes that can be written | |||
| The maxDestBytes parameter specifies the maximum number of bytes that can be written | |||
| to the destination buffer before stopping. | |||
| */ | |||
| template <typename CharPointer> | |||
| int copyAndAdvanceUpToBytes (const CharPointer& src, int maxBytes) throw() | |||
| int writeWithDestByteLimit (const CharPointer& src, const int maxDestBytes) throw() | |||
| { | |||
| return CharacterFunctions::copyAndAdvanceUpToBytes (*this, src, maxBytes); | |||
| return CharacterFunctions::copyWithDestByteLimit (*this, src, maxDestBytes); | |||
| } | |||
| /** Copies a source string to this pointer, advancing this pointer as it goes. | |||
| @@ -322,9 +361,9 @@ public: | |||
| written to the destination buffer before stopping (including the terminating null). | |||
| */ | |||
| template <typename CharPointer> | |||
| void copyAndAdvanceUpToNumChars (const CharPointer& src, int maxChars) throw() | |||
| void writeWithCharLimit (const CharPointer& src, const int maxChars) throw() | |||
| { | |||
| CharacterFunctions::copyAndAdvanceUpToNumChars (*this, src, maxChars); | |||
| CharacterFunctions::copyWithCharLimit (*this, src, maxChars); | |||
| } | |||
| /** Compares this string with another one. */ | |||
| @@ -336,7 +375,7 @@ public: | |||
| /** Compares this string with another one, up to a specified number of characters. */ | |||
| template <typename CharPointer> | |||
| int compareUpTo (const CharPointer& other, int maxChars) const throw() | |||
| int compareUpTo (const CharPointer& other, const int maxChars) const throw() | |||
| { | |||
| return CharacterFunctions::compareUpTo (*this, other, maxChars); | |||
| } | |||
| @@ -360,13 +399,13 @@ public: | |||
| /** Compares this string with another one, up to a specified number of characters. */ | |||
| template <typename CharPointer> | |||
| int compareIgnoreCaseUpTo (const CharPointer& other, int maxChars) const throw() | |||
| int compareIgnoreCaseUpTo (const CharPointer& other, const int maxChars) const throw() | |||
| { | |||
| return CharacterFunctions::compareIgnoreCaseUpTo (*this, other, maxChars); | |||
| } | |||
| /** Compares this string with another one, up to a specified number of characters. */ | |||
| int compareIgnoreCaseUpTo (const CharPointer_UTF8& other, int maxChars) const throw() | |||
| int compareIgnoreCaseUpTo (const CharPointer_UTF8& other, const int maxChars) const throw() | |||
| { | |||
| #if JUCE_WINDOWS | |||
| return strnicmp (data, other.data, maxChars); | |||
| @@ -434,6 +473,14 @@ public: | |||
| /** Returns the first non-whitespace character in the string. */ | |||
| CharPointer_UTF8 findEndOfWhitespace() const throw() { return CharacterFunctions::findEndOfWhitespace (*this); } | |||
| /** These values are the byte-order-mark (BOM) values for a UTF-8 stream. */ | |||
| enum | |||
| { | |||
| byteOrderMark1 = 0xef, | |||
| byteOrderMark2 = 0xbb, | |||
| byteOrderMark3 = 0xbf | |||
| }; | |||
| private: | |||
| CharType* data; | |||
| }; | |||
| @@ -44,18 +44,18 @@ BEGIN_JUCE_NAMESPACE | |||
| //============================================================================== | |||
| juce_wchar CharacterFunctions::toUpperCase (const juce_wchar character) throw() | |||
| { | |||
| return towupper (character); | |||
| return towupper ((wchar_t) character); | |||
| } | |||
| juce_wchar CharacterFunctions::toLowerCase (const juce_wchar character) throw() | |||
| { | |||
| return towlower (character); | |||
| return towlower ((wchar_t) character); | |||
| } | |||
| bool CharacterFunctions::isUpperCase (const juce_wchar character) throw() | |||
| { | |||
| #if JUCE_WINDOWS | |||
| return iswupper (character) != 0; | |||
| return iswupper ((wchar_t) character) != 0; | |||
| #else | |||
| return toLowerCase (character) != character; | |||
| #endif | |||
| @@ -64,7 +64,7 @@ bool CharacterFunctions::isUpperCase (const juce_wchar character) throw() | |||
| bool CharacterFunctions::isLowerCase (const juce_wchar character) throw() | |||
| { | |||
| #if JUCE_WINDOWS | |||
| return iswlower (character) != 0; | |||
| return iswlower ((wchar_t) character) != 0; | |||
| #else | |||
| return toUpperCase (character) != character; | |||
| #endif | |||
| @@ -78,7 +78,7 @@ bool CharacterFunctions::isWhitespace (const char character) throw() | |||
| bool CharacterFunctions::isWhitespace (const juce_wchar character) throw() | |||
| { | |||
| return iswspace (character) != 0; | |||
| return iswspace ((wchar_t) character) != 0; | |||
| } | |||
| bool CharacterFunctions::isDigit (const char character) throw() | |||
| @@ -88,7 +88,7 @@ bool CharacterFunctions::isDigit (const char character) throw() | |||
| bool CharacterFunctions::isDigit (const juce_wchar character) throw() | |||
| { | |||
| return iswdigit (character) != 0; | |||
| return iswdigit ((wchar_t) character) != 0; | |||
| } | |||
| bool CharacterFunctions::isLetter (const char character) throw() | |||
| @@ -99,7 +99,7 @@ bool CharacterFunctions::isLetter (const char character) throw() | |||
| bool CharacterFunctions::isLetter (const juce_wchar character) throw() | |||
| { | |||
| return iswalpha (character) != 0; | |||
| return iswalpha ((wchar_t) character) != 0; | |||
| } | |||
| bool CharacterFunctions::isLetterOrDigit (const char character) throw() | |||
| @@ -111,7 +111,7 @@ bool CharacterFunctions::isLetterOrDigit (const char character) throw() | |||
| bool CharacterFunctions::isLetterOrDigit (const juce_wchar character) throw() | |||
| { | |||
| return iswalnum (character) != 0; | |||
| return iswalnum ((wchar_t) character) != 0; | |||
| } | |||
| int CharacterFunctions::getHexDigitValue (const juce_wchar digit) throw() | |||
| @@ -138,11 +138,11 @@ int CharacterFunctions::ftime (char* const dest, const int maxChars, const char* | |||
| int CharacterFunctions::ftime (juce_wchar* const dest, const int maxChars, const juce_wchar* const format, const struct tm* const tm) throw() | |||
| { | |||
| #if JUCE_ANDROID | |||
| #if JUCE_NATIVE_WCHAR_IS_NOT_UTF32 | |||
| HeapBlock <char> tempDest; | |||
| tempDest.calloc (maxChars + 2); | |||
| int result = ftime (tempDest.getData(), maxChars, String (format).toUTF8(), tm); | |||
| CharPointer_UTF32 (dest).copyAndAdvance (CharPointer_UTF8 (tempDest.getData())); | |||
| CharPointer_UTF32 (dest).writeAll (CharPointer_UTF8 (tempDest.getData())); | |||
| return result; | |||
| #else | |||
| return (int) wcsftime (dest, maxChars, format, tm); | |||
| @@ -31,6 +31,11 @@ | |||
| #if JUCE_ANDROID && ! DOXYGEN | |||
| typedef uint32 juce_wchar; | |||
| #define JUCE_T(stringLiteral) CharPointer_UTF8 (stringLiteral) | |||
| #define JUCE_NATIVE_WCHAR_IS_NOT_UTF32 1 | |||
| #elif JUCE_WINDOWS && ! DOXYGEN | |||
| typedef uint32 juce_wchar; | |||
| #define JUCE_T(stringLiteral) L##stringLiteral | |||
| #define JUCE_NATIVE_WCHAR_IS_NOT_UTF32 1 | |||
| #else | |||
| /** A platform-independent unicode character type. */ | |||
| typedef wchar_t juce_wchar; | |||
| @@ -249,52 +254,71 @@ public: | |||
| static int ftime (juce_wchar* dest, int maxChars, const juce_wchar* format, const struct tm* tm) throw(); | |||
| //============================================================================== | |||
| template <typename DestCharPointerType, typename SrcCharPointerType> | |||
| static void copyAndAdvance (DestCharPointerType& dest, SrcCharPointerType src) throw() | |||
| template <typename CharPointerType> | |||
| static size_t lengthUpTo (const CharPointerType& text, const size_t maxCharsToCount) throw() | |||
| { | |||
| juce_wchar c; | |||
| size_t len = 0; | |||
| CharPointerType t (text); | |||
| while (len < maxCharsToCount && t.getAndAdvance() != 0) | |||
| ++len; | |||
| return len; | |||
| } | |||
| do | |||
| template <typename DestCharPointerType, typename SrcCharPointerType> | |||
| static void copyAll (DestCharPointerType& dest, SrcCharPointerType src) throw() | |||
| { | |||
| for (;;) | |||
| { | |||
| c = src.getAndAdvance(); | |||
| const juce_wchar c = src.getAndAdvance(); | |||
| if (c == 0) | |||
| break; | |||
| dest.write (c); | |||
| } | |||
| while (c != 0); | |||
| dest.writeNull(); | |||
| } | |||
| template <typename DestCharPointerType, typename SrcCharPointerType> | |||
| static int copyAndAdvanceUpToBytes (DestCharPointerType& dest, SrcCharPointerType src, int maxBytes) throw() | |||
| static int copyWithDestByteLimit (DestCharPointerType& dest, SrcCharPointerType src, int maxBytes) throw() | |||
| { | |||
| int numBytesDone = 0; | |||
| maxBytes -= sizeof (typename DestCharPointerType::CharType); // (allow for a terminating null) | |||
| for (;;) | |||
| { | |||
| const juce_wchar c = src.getAndAdvance(); | |||
| const size_t bytesNeeded = DestCharPointerType::getBytesRequiredFor (c); | |||
| const int bytesNeeded = (int) DestCharPointerType::getBytesRequiredFor (c); | |||
| maxBytes -= bytesNeeded; | |||
| if (maxBytes < 0) | |||
| if (c == 0 || maxBytes < 0) | |||
| break; | |||
| numBytesDone += bytesNeeded; | |||
| dest.write (c); | |||
| if (c == 0) | |||
| break; | |||
| } | |||
| dest.writeNull(); | |||
| return numBytesDone; | |||
| } | |||
| template <typename DestCharPointerType, typename SrcCharPointerType> | |||
| static void copyAndAdvanceUpToNumChars (DestCharPointerType& dest, SrcCharPointerType src, int maxChars) throw() | |||
| static void copyWithCharLimit (DestCharPointerType& dest, SrcCharPointerType src, int maxChars) throw() | |||
| { | |||
| while (--maxChars >= 0) | |||
| while (--maxChars > 0) | |||
| { | |||
| const juce_wchar c = src.getAndAdvance(); | |||
| dest.write (c); | |||
| if (c == 0) | |||
| break; | |||
| dest.write (c); | |||
| } | |||
| dest.writeNull(); | |||
| } | |||
| template <typename CharPointerType1, typename CharPointerType2> | |||
| @@ -377,7 +401,7 @@ public: | |||
| static int indexOf (CharPointerType1 haystack, const CharPointerType2& needle) throw() | |||
| { | |||
| int index = 0; | |||
| const int needleLength = needle.length(); | |||
| const int needleLength = (int) needle.length(); | |||
| for (;;) | |||
| { | |||
| @@ -33,6 +33,7 @@ | |||
| #pragma warning (disable: 4514 4996) | |||
| #endif | |||
| #include "../memory/juce_Atomic.h" | |||
| #include "juce_CharPointer_UTF8.h" | |||
| #include "juce_CharPointer_UTF16.h" | |||
| #include "juce_CharPointer_UTF32.h" | |||
| @@ -89,6 +90,26 @@ public: | |||
| */ | |||
| String (const juce_wchar* unicodeText, size_t maxChars); | |||
| /** Creates a string from a UTF-8 character string */ | |||
| String (const CharPointer_UTF8& text); | |||
| /** Creates a string from a UTF-16 character string */ | |||
| String (const CharPointer_UTF16& text); | |||
| /** Creates a string from a UTF-32 character string */ | |||
| String (const CharPointer_UTF32& text); | |||
| /** Creates a string from a UTF-32 character string */ | |||
| String (const CharPointer_UTF32& text, size_t maxChars); | |||
| #if JUCE_WINDOWS | |||
| /** Creates a string from a UTF-16 character string */ | |||
| String (const wchar_t* text); | |||
| /** Creates a string from a UTF-16 character string */ | |||
| String (const wchar_t* text, size_t maxChars); | |||
| #endif | |||
| /** Creates a string from a single character. */ | |||
| static const String charToString (juce_wchar character); | |||
| @@ -103,6 +124,9 @@ public: | |||
| */ | |||
| static const String empty; | |||
| /** This is the character encoding type used internally to store the string. */ | |||
| typedef CharPointer_UTF32 CharPointerType; | |||
| //============================================================================== | |||
| /** Generates a probably-unique 32-bit hashcode from this string. */ | |||
| int hashCode() const throw(); | |||
| @@ -127,15 +151,63 @@ public: | |||
| String& operator+= (char characterToAppend); | |||
| /** Appends a character at the end of this string. */ | |||
| String& operator+= (juce_wchar characterToAppend); | |||
| #if JUCE_WINDOWS | |||
| /** Appends a character at the end of this string. */ | |||
| String& operator+= (wchar_t characterToAppend); | |||
| /** Appends another string at the end of this one. */ | |||
| String& operator+= (const wchar_t* textToAppend); | |||
| #endif | |||
| /** Appends a decimal number at the end of this string. */ | |||
| String& operator+= (int numberToAppend); | |||
| /** Appends a string at the end of this one. | |||
| /** Appends a string to the end of this one. | |||
| @param textToAppend the string to add | |||
| @param maxCharsToTake the maximum number of characters to take from the string passed in | |||
| */ | |||
| void append (const String& textToAppend, size_t maxCharsToTake); | |||
| /** Appends a string to the end of this one. | |||
| @param textToAppend the string to add | |||
| @param maxCharsToTake the maximum number of characters to take from the string passed in | |||
| */ | |||
| void append (const juce_wchar* textToAppend, int maxCharsToTake); | |||
| template <class CharPointer> | |||
| void appendCharPointer (const CharPointer& textToAppend, size_t maxCharsToTake) | |||
| { | |||
| if (textToAppend.getAddress() != 0) | |||
| { | |||
| const size_t numExtraChars = textToAppend.lengthUpTo (maxCharsToTake); | |||
| if (numExtraChars > 0) | |||
| { | |||
| const int oldLen = length(); | |||
| preallocateStorage (oldLen + numExtraChars); | |||
| CharPointerType (text + oldLen).writeWithCharLimit (textToAppend, (int) (numExtraChars + 1)); | |||
| } | |||
| } | |||
| } | |||
| /** Appends a string to the end of this one. | |||
| @param textToAppend the string to add | |||
| @param maxCharsToTake the maximum number of characters to take from the string passed in | |||
| */ | |||
| template <class CharPointer> | |||
| void appendCharPointer (const CharPointer& textToAppend) | |||
| { | |||
| if (textToAppend.getAddress() != 0) | |||
| { | |||
| const size_t numExtraChars = textToAppend.length(); | |||
| if (numExtraChars > 0) | |||
| { | |||
| const int oldLen = length(); | |||
| preallocateStorage (oldLen + numExtraChars); | |||
| CharPointerType (text + oldLen).writeAll (textToAppend); | |||
| } | |||
| } | |||
| } | |||
| //============================================================================== | |||
| // Comparison methods.. | |||
| @@ -915,7 +987,7 @@ public: | |||
| that is returned must not be stored anywhere, as it can become invalid whenever | |||
| any string methods (even some const ones!) are called. | |||
| */ | |||
| inline operator const juce_wchar*() const throw() { return text; } | |||
| inline operator const juce_wchar*() const throw() { return text.getAddress(); } | |||
| //============================================================================== | |||
| /** Returns a unicode version of this string. | |||
| @@ -924,21 +996,55 @@ public: | |||
| that is returned must not be stored anywhere, as it can become invalid whenever | |||
| any string methods (even some const ones!) are called. | |||
| */ | |||
| inline operator juce_wchar*() throw() { return text; } | |||
| inline operator juce_wchar*() throw() { return text.getAddress(); } | |||
| //============================================================================== | |||
| /** Returns the character pointer currently being used to store this string. | |||
| Because it returns a reference to the string's internal data, the pointer | |||
| that is returned must not be stored anywhere, as it can be deleted whenever the | |||
| string changes. | |||
| */ | |||
| inline const CharPointerType& getCharPointer() const throw() { return text; } | |||
| /** Returns a pointer to a UTF-8 version of this string. | |||
| Because it returns a reference to the string's internal data, the pointer | |||
| that is returned must not be stored anywhere, as it can be deleted whenever the | |||
| string changes. | |||
| @see getNumBytesAsUTF8, fromUTF8, copyToUTF8, toCString | |||
| To find out how many bytes you need to store this string as UTF-8, you can call | |||
| CharPointer_UTF8::getBytesRequiredFor (myString.getCharPointer()) | |||
| @see getCharPointer, toUTF16, toUTF32 | |||
| */ | |||
| const char* toUTF8() const; | |||
| const CharPointer_UTF8 toUTF8() const; | |||
| /** Creates a String from a UTF-8 encoded buffer. | |||
| /** Returns a pointer to a UTF-32 version of this string. | |||
| Because it returns a reference to the string's internal data, the pointer | |||
| that is returned must not be stored anywhere, as it can be deleted whenever the | |||
| string changes. | |||
| To find out how many bytes you need to store this string as UTF-16, you can call | |||
| CharPointer_UTF16::getBytesRequiredFor (myString.getCharPointer()) | |||
| @see getCharPointer, toUTF8, toUTF32 | |||
| */ | |||
| CharPointer_UTF16 toUTF16() const; | |||
| /** Returns a pointer to a UTF-32 version of this string. | |||
| Because it returns a reference to the string's internal data, the pointer | |||
| that is returned must not be stored anywhere, as it can be deleted whenever the | |||
| string changes. | |||
| @see getCharPointer, toUTF8, toUTF16 | |||
| */ | |||
| inline CharPointer_UTF32 toUTF32() const throw() { return text; } | |||
| //============================================================================== | |||
| /** Creates a String from a UTF-8 encoded buffer. | |||
| If the size is < 0, it'll keep reading until it hits a zero. | |||
| */ | |||
| static const String fromUTF8 (const char* utf8buffer, int bufferSizeBytes = -1); | |||
| @@ -949,20 +1055,40 @@ public: | |||
| */ | |||
| int getNumBytesAsUTF8() const throw(); | |||
| //============================================================================== | |||
| /** Copies the string to a buffer as UTF-8 characters. | |||
| Returns the number of bytes copied to the buffer, including the terminating null | |||
| character. | |||
| @param destBuffer the place to copy it to; if this is a null pointer, | |||
| the method just returns the number of bytes required | |||
| (including the terminating null character). | |||
| @param maxBufferSizeBytes the size of the destination buffer, in bytes. If the | |||
| string won't fit, it'll put in as many as it can while | |||
| still allowing for a terminating null char at the end, and | |||
| will return the number of bytes that were actually used. | |||
| To find out how many bytes you need to store this string as UTF-8, you can call | |||
| CharPointer_UTF8::getBytesRequiredFor (myString.getCharPointer()) | |||
| @param destBuffer the place to copy it to; if this is a null pointer, the method just | |||
| returns the number of bytes required (including the terminating null character). | |||
| @param maxBufferSizeBytes the size of the destination buffer, in bytes. If the string won't fit, it'll | |||
| put in as many as it can while still allowing for a terminating null char at the | |||
| end, and will return the number of bytes that were actually used. | |||
| @see CharPointer_UTF8::writeWithDestByteLimit | |||
| */ | |||
| int copyToUTF8 (CharPointer_UTF8::CharType* destBuffer, int maxBufferSizeBytes) const throw(); | |||
| /** Copies the string to a buffer as UTF-16 characters. | |||
| Returns the number of bytes copied to the buffer, including the terminating null | |||
| character. | |||
| To find out how many bytes you need to store this string as UTF-16, you can call | |||
| CharPointer_UTF16::getBytesRequiredFor (myString.getCharPointer()) | |||
| @param destBuffer the place to copy it to; if this is a null pointer, the method just | |||
| returns the number of bytes required (including the terminating null character). | |||
| @param maxBufferSizeBytes the size of the destination buffer, in bytes. If the string won't fit, it'll | |||
| put in as many as it can while still allowing for a terminating null char at the | |||
| end, and will return the number of bytes that were actually used. | |||
| @see CharPointer_UTF16::writeWithDestByteLimit | |||
| */ | |||
| int copyToUTF8 (char* destBuffer, int maxBufferSizeBytes) const throw(); | |||
| int copyToUTF16 (CharPointer_UTF16::CharType* destBuffer, int maxBufferSizeBytes) const throw(); | |||
| //============================================================================== | |||
| /** Returns a version of this string using the default 8-bit multi-byte system encoding. | |||
| @@ -977,6 +1103,7 @@ public: | |||
| /** Returns the number of bytes required to represent this string as C-string. | |||
| The number returned does NOT include the trailing zero. | |||
| Note that you can also get this value by using CharPointer_UTF8::getBytesRequiredFor (myString.getCharPointer()) | |||
| */ | |||
| int getNumBytesAsCString() const throw(); | |||
| @@ -992,16 +1119,6 @@ public: | |||
| */ | |||
| int copyToCString (char* destBuffer, int maxBufferSizeBytes) const throw(); | |||
| //============================================================================== | |||
| /** Copies the string to a unicode buffer. | |||
| @param destBuffer the place to copy it to | |||
| @param maxCharsToCopy the maximum number of characters to copy to the buffer, | |||
| NOT including the trailing zero, so this shouldn't be | |||
| larger than the size of your destination buffer - 1 | |||
| */ | |||
| void copyToUnicode (juce_wchar* destBuffer, int maxCharsToCopy) const throw(); | |||
| //============================================================================== | |||
| /** Increases the string's internally allocated storage. | |||
| @@ -1052,7 +1169,7 @@ public: | |||
| private: | |||
| //============================================================================== | |||
| juce_wchar* text; | |||
| CharPointerType text; | |||
| //============================================================================== | |||
| struct Preallocation | |||
| @@ -1065,8 +1182,9 @@ private: | |||
| explicit String (const Preallocation&); | |||
| String (const String& stringToCopy, size_t charsToAllocate); | |||
| void createInternal (const juce_wchar* text, size_t numChars); | |||
| void appendInternal (const juce_wchar* text, int numExtraChars); | |||
| void appendFixedLength (const juce_wchar* text, int numExtraChars); | |||
| void enlarge (size_t newTotalNumChars); | |||
| void* createSpaceAtEndOfBuffer (size_t numExtraBytes) const; | |||
| // This private cast operator should prevent strings being accidentally cast | |||
| @@ -1095,6 +1213,14 @@ JUCE_API const String JUCE_CALLTYPE operator+ (String string1, const juce_wchar | |||
| JUCE_API const String JUCE_CALLTYPE operator+ (String string1, char characterToAppend); | |||
| /** Concatenates two strings. */ | |||
| JUCE_API const String JUCE_CALLTYPE operator+ (String string1, juce_wchar characterToAppend); | |||
| #if JUCE_WINDOWS | |||
| /** Concatenates two strings. */ | |||
| JUCE_API const String JUCE_CALLTYPE operator+ (String string1, wchar_t characterToAppend); | |||
| /** Concatenates two strings. */ | |||
| JUCE_API const String JUCE_CALLTYPE operator+ (String string1, const wchar_t* string2); | |||
| /** Concatenates two strings. */ | |||
| JUCE_API const String JUCE_CALLTYPE operator+ (const wchar_t* string1, const String& string2); | |||
| #endif | |||
| //============================================================================== | |||
| /** Appends a character at the end of a string. */ | |||
| @@ -1127,12 +1253,24 @@ JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const char* strin | |||
| /** Case-sensitive comparison of two strings. */ | |||
| JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const juce_wchar* string2) throw(); | |||
| /** Case-sensitive comparison of two strings. */ | |||
| JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF8& string2) throw(); | |||
| /** Case-sensitive comparison of two strings. */ | |||
| JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF16& string2) throw(); | |||
| /** Case-sensitive comparison of two strings. */ | |||
| JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF32& string2) throw(); | |||
| /** Case-sensitive comparison of two strings. */ | |||
| JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const String& string2) throw(); | |||
| /** Case-sensitive comparison of two strings. */ | |||
| JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const char* string2) throw(); | |||
| /** Case-sensitive comparison of two strings. */ | |||
| JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const juce_wchar* string2) throw(); | |||
| /** Case-sensitive comparison of two strings. */ | |||
| JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF8& string2) throw(); | |||
| /** Case-sensitive comparison of two strings. */ | |||
| JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF16& string2) throw(); | |||
| /** Case-sensitive comparison of two strings. */ | |||
| JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF32& string2) throw(); | |||
| /** Case-sensitive comparison of two strings. */ | |||
| JUCE_API bool JUCE_CALLTYPE operator> (const String& string1, const String& string2) throw(); | |||
| /** Case-sensitive comparison of two strings. */ | |||
| JUCE_API bool JUCE_CALLTYPE operator< (const String& string1, const String& string2) throw(); | |||
| @@ -1148,7 +1286,7 @@ JUCE_API bool JUCE_CALLTYPE operator<= (const String& string1, const String& str | |||
| template <class charT, class traits> | |||
| JUCE_API std::basic_ostream <charT, traits>& JUCE_CALLTYPE operator<< (std::basic_ostream <charT, traits>& stream, const String& stringToWrite) | |||
| { | |||
| return stream << stringToWrite.toUTF8(); | |||
| return stream << stringToWrite.toUTF8().getAddress(); | |||
| } | |||
| /** Writes a string to an OutputStream as UTF8. */ | |||
| @@ -317,27 +317,20 @@ const String StringArray::joinIntoString (const String& separator, int start, in | |||
| String result; | |||
| result.preallocateStorage (charsNeeded); | |||
| juce_wchar* dest = result; | |||
| String::CharPointerType dest (result.getCharPointer()); | |||
| while (start < last) | |||
| { | |||
| const String& s = strings.getReference (start); | |||
| const int len = s.length(); | |||
| if (len > 0) | |||
| { | |||
| s.copyToUnicode (dest, len); | |||
| dest += len; | |||
| } | |||
| if (! s.isEmpty()) | |||
| dest.writeAll (s.getCharPointer()); | |||
| if (++start < last && separatorLen > 0) | |||
| { | |||
| separator.copyToUnicode (dest, separatorLen); | |||
| dest += separatorLen; | |||
| } | |||
| dest.writeAll (separator.getCharPointer()); | |||
| } | |||
| *dest = 0; | |||
| dest.writeNull(); | |||
| return result; | |||
| } | |||
| @@ -85,8 +85,8 @@ namespace XmlIdentifierChars | |||
| { | |||
| static const uint32 legalChars[] = { 0, 0x7ff6000, 0x87fffffe, 0x7fffffe, 0 }; | |||
| return (c < numElementsInArray (legalChars) * 32) ? ((legalChars [c >> 5] & (1 << (c & 31))) != 0) | |||
| : isIdentifierCharSlow (c); | |||
| return ((int) c < (int) numElementsInArray (legalChars) * 32) ? ((legalChars [c >> 5] & (1 << (c & 31))) != 0) | |||
| : isIdentifierCharSlow (c); | |||
| } | |||
| /*static void generateIdentifierCharConstants() | |||