|
CEF C++ API Docs - Revision 439 | ||||||
| FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
CEF string classes can convert between all supported string types. For example, the CefStringWide class uses wchar_t as the underlying character type and provides two approaches for converting data to/from a UTF8 string (std::string).
1. Implicit conversion using the assignment operator overload.
CefStringWide aCefString; std::string aUTF8String; aCefString = aUTF8String; // Assign std::string to CefStringWide aUTF8String = aCefString; // Assign CefStringWide to std::string2. Explicit conversion using the FromString/ToString methods.
CefStringWide aCefString; std::string aUTF8String; aCefString.FromString(aUTF8String); // Assign std::string to CefStringWide aUTF8String = aCefString.ToString(); // Assign CefStringWide to std::stringConversion will only occur if the assigned value is a different string type. Assigning a std::string to a CefStringUTF8, for example, will copy the data without performing a conversion. CEF string classes are safe for reading from multiple threads but not for modification. It is the user's responsibility to provide synchronization if modifying CEF strings from multiple threads.
| Inner Classes, Typedefs, and Enums | |
typedef |
CefStringBase::char_type
|
|
CefStringBase::std
|
typedef |
CefStringBase::struct_type
|
typedef |
CefStringBase::userfree_struct_type
|
| Constructor Summary | |
CefStringBase( const std::wstring& src )
Create a new string from an existing std::wstring. |
|
CefStringBase( const CefStringBase& str )
Create a new string from an existing string. |
|
CefStringBase( const std::string& src )
Create a new string from an existing std::string. |
|
CefStringBase( const char* src )
|
|
CefStringBase()
Default constructor. |
|
CefStringBase( const wchar_t* src )
|
|
CefStringBase( const CefStringBase::char_type* src, size_t src_len, bool copy )
Create a new string from an existing character array. |
|
CefStringBase( const CefStringBase::struct_type* src )
Create a new string referencing an existing string structure without taking ownership. |
|
virtual ~CefStringBase()
|
|
| Method Summary | |
void |
Attach( CefStringBase::struct_type* str, bool owner )
Attach to the specified string structure. |
void |
AttachToUserFree( CefStringBase::userfree_struct_type str )
Take ownership of the specified userfree structure's string data. |
const CefStringBase::char_type* |
c_str() const
Return a read-only pointer to the string data. |
void |
clear()
Clear the string data. |
void |
ClearAndFree()
Clear the state of this class. |
int |
compare( const CefStringBase& str ) const
Compare this string to the specified string. |
void |
Detach()
Detach from the underlying string structure. |
CefStringBase::userfree_struct_type |
DetachToUserFree()
Create a userfree structure and give it ownership of this class' string data. |
bool |
empty() const
Returns true if the string is empty. |
bool |
FromASCII( const char* str )
Set this string's data from an existing ASCII string. |
bool |
FromString( const std::string& str )
Set this string's data from an existing std::string. |
bool |
FromString( const CefStringBase::char_type* src, size_t src_len, bool copy )
Set this string's data to the specified character array. |
bool |
FromWString( const std::wstring& str )
Set this string's data from an existing std::wstring. |
const CefStringBase::struct_type* |
GetStruct() const
Returns a read-only pointer to the underlying string structure. |
CefStringBase::struct_type* |
GetWritableStruct()
Returns a writable pointer to the underlying string structure. |
bool |
IsOwner() const
Returns true if this class owns the underlying string structure. |
size_t |
length() const
Return the length of the string data. |
bool |
operator!=( const CefStringBase& str ) const
|
bool |
operator<( const CefStringBase& str ) const
Comparison operator overloads. |
bool |
operator<=( const CefStringBase& str ) const
|
CefStringBase& |
operator=( const wchar_t* str )
|
CefStringBase& |
operator=( const CefStringBase& str )
Assignment operator overloads. |
CefStringBase& |
operator=( const char* str )
|
CefStringBase& |
operator=( const std::wstring& str )
|
CefStringBase& |
operator=( const std::string& str )
|
bool |
operator==( const CefStringBase& str ) const
|
bool |
operator>( const CefStringBase& str ) const
|
bool |
operator>=( const CefStringBase& str ) const
|
inline size_t |
size() const
Return the length of the string data. |
std::string |
ToString() const
Return this string's data as a std::string. |
std::wstring |
ToWString() const
Return this string's data as a std::wstring. |
| Constructor Detail |
public CefStringBase( const std::wstring& src );
public CefStringBase( const CefStringBase& str );
public CefStringBase( const std::string& src );
public CefStringBase( const char* src );
public CefStringBase();
public CefStringBase( const wchar_t* src );
public CefStringBase( const CefStringBase::char_type* src, size_t src_len, bool copy );
public CefStringBase( const CefStringBase::struct_type* src );
public virtual ~CefStringBase();
| Method Detail |
public void Attach( CefStringBase::struct_type* str, bool owner );
public void AttachToUserFree( CefStringBase::userfree_struct_type str );
public const CefStringBase::char_type* c_str() const;
public void clear();
public void ClearAndFree();
public int compare( const CefStringBase& str ) const;
public void Detach();
public CefStringBase::userfree_struct_type DetachToUserFree();
public bool empty() const;
public bool FromASCII( const char* str );
public bool FromString( const std::string& str );
public bool FromString( const CefStringBase::char_type* src, size_t src_len, bool copy );
public bool FromWString( const std::wstring& str );
public const CefStringBase::struct_type* GetStruct() const;
public CefStringBase::struct_type* GetWritableStruct();
public bool IsOwner() const;
public size_t length() const;
public bool operator!=( const CefStringBase& str ) const;
public bool operator<( const CefStringBase& str ) const;
public bool operator<=( const CefStringBase& str ) const;
public CefStringBase& operator=( const wchar_t* str );
public CefStringBase& operator=( const CefStringBase& str );
public CefStringBase& operator=( const char* str );
public CefStringBase& operator=( const std::wstring& str );
public CefStringBase& operator=( const std::string& str );
public bool operator==( const CefStringBase& str ) const;
public bool operator>( const CefStringBase& str ) const;
public bool operator>=( const CefStringBase& str ) const;
public inline size_t size() const;
public std::string ToString() const;
public std::wstring ToWString() const;
|
CEF C++ API Docs - Revision 439 | ||||||
| FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||