pl-nk v0.4.5
Plonk|Plink|Plank are a set of cross-platform C/C++ frameworks for audio software development
plonk_Text.h
00001 /*
00002  -------------------------------------------------------------------------------
00003  This file is part of the Plink, Plonk, Plank libraries
00004   by Martin Robinson
00005  
00006  http://code.google.com/p/pl-nk/
00007  
00008  Copyright University of the West of England, Bristol 2011-14
00009  All rights reserved.
00010  
00011  Redistribution and use in source and binary forms, with or without
00012  modification, are permitted provided that the following conditions are met:
00013  
00014  * Redistributions of source code must retain the above copyright
00015    notice, this list of conditions and the following disclaimer.
00016  * Redistributions in binary form must reproduce the above copyright
00017    notice, this list of conditions and the following disclaimer in the
00018    documentation and/or other materials provided with the distribution.
00019  * Neither the name of University of the West of England, Bristol nor 
00020    the names of its contributors may be used to endorse or promote products
00021    derived from this software without specific prior written permission.
00022  
00023  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00024  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00025  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
00026  DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF THE WEST OF ENGLAND, BRISTOL BE 
00027  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
00028  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
00029  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
00030  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
00031  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
00032  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
00033  
00034  This software makes use of third party libraries. For more information see:
00035  doc/license.txt included in the distribution.
00036  -------------------------------------------------------------------------------
00037  */
00038 
00039 #ifndef PLONK_TEXT_H
00040 #define PLONK_TEXT_H
00041 
00042 #include "../core/plonk_CoreForwardDeclarations.h"
00043 #include "plonk_ContainerForwardDeclarations.h"
00044 #include "plonk_DynamicContainer.h"
00045 
00046 #include "../core/plonk_Receiver.h"
00047 
00048 #include "plonk_ObjectArray.h"
00049 #include "plonk_ObjectArray2D.h"
00050 #include "plonk_NumericalArray.h"
00051 #include "plonk_NumericalArray2D.h"
00052 
00053 class FilePath;
00054 
00060 class Text : public CharArray
00061 {
00062 public:
00063     typedef ObjectArrayInternal<char>   Internal;
00064     typedef CharArray                   Base;    
00065     typedef WeakPointerContainer<Text>  Weak;
00066     
00067         static const char space;
00068         
00070         Text() throw();
00071             
00072     explicit Text (Internal* internalToUse) throw();
00073     
00074     
00078     static Text fromWeak (Weak const& weak) throw();
00079     static const Text& getNull() throw();
00080     static const Text& getEmpty() throw();
00081     
00082     
00084         Text (const char c) throw();
00085     
00086     Text (const int value) throw();
00087     Text (const LongLong value) throw();
00088     Text (const float value) throw();
00089     Text (const double value) throw();
00090     
00091     Text (Text const& copy) throw();
00092     Text (Dynamic const& other) throw();
00093 //    Text (FilePath const& path) throw();
00094     Text& operator= (Text const& other) throw();
00095 
00096         
00098         template<class CopyType>
00099         Text (NumericalArray<CopyType> const& copy) throw()
00100         :       Base (copy)
00101         {
00102         }
00103         
00105         template<class CopyType>
00106         Text (ObjectArray<CopyType> const& copy) throw()
00107         :       Base (copy)
00108         {
00109         }
00110         
00112         Text (const wchar_t* string) throw();
00113         
00114         ObjectArrayAssignmentDefinition(Text, char);
00115         
00117         Text (Text const& array0, Text const& array1) throw();
00118                 
00119         Text (NumericalArraySpec const& spec) throw();
00120         Text (NumericalArraySpec const& spec, const bool needsNullTermination) throw();
00121         static Text withSize (const int size, const bool zeroData = false) throw();     
00122         static Text newClear (const int size) throw();
00123         static Text fromValue (const int num) throw();
00124         static Text fromValue (const LongLong num) throw();
00125         static Text fromValue (const float num) throw();
00126         static Text fromValue (const double num) throw();
00127 
00128     Text& operator= (Base const& other) throw();
00129         Text& operator= (const char* other) throw();
00130         Text& operator= (const wchar_t* other) throw();
00131         
00132         Text operator+ (Text const& rightOperand) const throw();
00133         Text operator+= (Text const& rightOperand) throw();
00134 
00135         Text offset (Text const& rightOperand) const throw();
00136         Text& add (Text const& other) throw();
00137         
00138         Text (const char* nullTerminatedSourceArray);
00139         Text (const int size, const char* sourceArray, const bool needsNullTermination = false);
00140                 
00141         Text toUpper() const throw();
00142         Text toLower() const throw();
00143         
00144         bool equalsIgnoreCase (Text const& other) const throw();
00145         
00146         bool containsIgnoreCase (Text const& toFind) const throw();     
00147         int indexOfIgnoreCase (Text const& toFind, const int startIndex = 0) const throw();
00148         int indexOfAnyIgnoreCase (Text const& toFind, const int startIndex = 0) const throw();
00149         Text replaceIgnoreCase (Text const& find, Text const& substitute) const throw();
00150         Text replace (Text const& find, Text const& substitute) const throw();
00151         
00152         void print (const char *prefix = 0) const throw();
00153         
00154         static const Text& getPrintable() throw();
00155         static const Text& getAlphabetLower() throw();
00156         static const Text& getAlphabetUpper() throw();
00157         static const Text& getAlphabetAll() throw();
00158         static const Text& getDigits() throw();
00159         static const Text& getAlphabetAndDigits() throw();
00160         static const Text& getPunctuation() throw();
00161         static const Text& getStandardDelimiters() throw();
00162     
00163     static const Text& getMessageDone() throw();
00164     static const Text& getMessageNumChannelsChanged() throw();
00165     static const Text& getMessageAudioFileChanged() throw();
00166     static const Text& getMessageLooped() throw();
00167     static const Text& getMessagePatchStart() throw();
00168     static const Text& getMessagePatchEnd() throw();
00169 
00170     static const Text& getMessageTrigger() throw();
00171     static const Text& getMessageEvent() throw();
00172     static const Text& getMessageCuePoint() throw();
00173 
00174     
00175     PLONK_OBJECTARROWOPERATOR(Text);
00176 };
00177 
00178 Text operator+ (const char* text1, Text const& text2) throw();
00179 Text operator+ (const wchar_t* text1, Text const& text2) throw();
00180 
00181 
00182 #endif // PLONK_TEXT_H
 All Classes Functions Typedefs Enumerations Enumerator Properties