1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2003 VideoLAN (Centrale Réseaux) and its contributors
7 * Authors: Cyril Deguet <asmax@via.ecp.fr>
8 * Olivier Teulière <ipkiss@via.ecp.fr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
28 #include "../src/skin_common.hpp"
29 #include "pointer.hpp"
32 // Class for UNICODE strings handling
33 class UString: public SkinObject
36 static const uint32_t npos;
39 UString( const UString &rOther );
41 /// Create a new unicode string from an UTF8 string
42 UString( intf_thread_t *pIntf, const char *pString );
46 /// Get the unicode string
47 const uint32_t *u_str() const { return m_pString; }
49 /// Get the length of the string
50 uint32_t length() const { return m_length; }
51 uint32_t size() const { return m_length; }
54 bool operator ==( const UString &rOther ) const;
55 bool operator !=( const UString &rOther ) const;
56 bool operator <( const UString &rOther ) const;
57 bool operator <=( const UString &rOther ) const;
58 bool operator >( const UString &rOther ) const;
59 bool operator >=( const UString &rOther ) const;
61 void operator =( const UString &rOther );
62 /// Concatenation with assignment
63 void operator +=( const UString &rOther );
65 const UString operator +( const UString &rOther ) const;
66 const UString operator +( const char *pString ) const;
69 /// Search for the first occurance of the substring specified by str
70 /// in this string, starting at position. If found, it returns the
71 /// index of the first character of the matching substring. If not
72 /// found, it returns npos
73 uint32_t find( const UString &str, uint32_t position = 0 ) const;
74 uint32_t find( const char *pString, uint32_t position = 0 ) const;
76 /// Insert elements of str in place of n1 elements in this string,
77 /// starting at position position
78 void replace( uint32_t position, uint32_t n1, const UString &str );
79 void replace( uint32_t position, uint32_t n1, const char *pString );
81 /// Returns a string composed of copies of the lesser of n and size()
82 /// characters in this string starting at index position
83 UString substr( uint32_t position = 0, uint32_t n = npos) const;
96 typedef CountedPtr<UString> UStringPtr;