[an error occurred while processing this directive]
[an error occurred while processing this directive] [an error occurred while processing this directive]

Pegasus CIM Object Broker Documentation

[an error occurred while processing this directive]


[an error occurred while processing this directive]

 

Contents

o Introduction
o Objectives
o Overview
o Credits
o Pegasus Architecture
   o Design Goals
   o The Broker
   o Pegasus Providers.
   o Extension Services
   o Pegasus Clients.
   o Functional Flow
o Pegasus Components
   o Component Descriptions
   o Pegasus Directory Structure
o Pegasus Utilization
   o Pegasus Availability
   o Pegasus Installation
   o Pegasus Operation
   o Pegasus CIM Clients
   o Pegasus Providers
   o Pegasus MOF Compiler
o Programming Pegasus
   o CIM Objects in Pegasus
   o CIM Object Table
   o Class Definitions
o Pegasus Interfaces
   o CIM Operations over HTTP
   o Pegasus Client Interfaces
   o Pegasus Provider Interfaces
   o Pegasus Service Extension Interfaces
   o Repository Interfaces
o Writing Providers.
o Glossary
o Pegasus Code Examples
   o Client Examples
   o Client Coding Examples
   o Provider Coding Examples
o Document References
o Pegausus FAQ
o
In file ../../src/Pegasus/Common/String.h:

class PEGASUS_COMMON_LINKAGE String

This class implements the CIM string type.

Documentation

This class implements the CIM string type. The intrinsic string format is UTF-16, which is a superset of the UCS-2 characters allowed in CIM strings. Facilities are provided for converting to and from UTF-8 character strings.

Many of the method interfaces refer to a number of characters. In all cases, these characters are counted as 8- or 16-bit memory chunks rather than logical UTF-8 or UTF-16 character chains.


Inheritance:


Public Fields

[more]static const String EMPTY
Represents an empty string.

Public Methods

[more] String ()
Constructs an empty String
[more] String (const String& str)
Constructs a String with the value of another String.
[more] String (const String& str, Uint32 n)
Constructs a String with a specified number of characters of the value of another String.
[more] String (const Char16* str)
Constructs a String with the value from a Char16 buffer.
[more] String (const Char16* str, Uint32 n)
Constructs a String with a specified number of characters of the value from a Char16 buffer.
[more] String (const char* str)
Constructs a String with the value from a C string in UTF-8 format.
[more] String (const char* str, Uint32 n)
Constructs a String with a specified number of characters of the value from a C string in UTF-8 format.
[more] ~String ()
Destructs a String object
[more]String& operator= (const String& str)
Assigns the value of a String to the value of another String.
[more]String& assign (const String& str)
Assigns the value of a String to the value of another String.
[more]String& assign (const Char16* str)
Assigns the value of a String to the value in a Char16 buffer.
[more]String& assign (const Char16* str, Uint32 n)
Assigns the value of a String with a specified number of characters of the value from a Char16 buffer.
[more]String& assign (const char* str)
Assigns the value of a String to the value from a C string in UTF-8 format.
[more]String& assign (const char* str, Uint32 n)
Assigns the value of a String with a specified number of characters of the value from a C string in UTF-8 format.
[more]void clear ()
Sets a String value to the empty String
[more]void reserveCapacity (Uint32 capacity)
Reserves memory for a specified number of (16-bit) characters.
[more]Uint32 size () const
Returns the number of characters in a String value.
[more]const Char16* getChar16Data () const
Gets a null-terminated Char16 buffer containing the String value.
[more]CString getCString () const
Gets a CString object containing the String value in UTF-8 format.
[more]Char16& operator[] (Uint32 index)
Gets a specified character from the String value.
[more]const Char16 operator[] (Uint32 index) const
Gets a specified character from the String value.
[more]String& append (const Char16& c)
Appends a character to the String.
[more]String& append (const Char16* str, Uint32 n)
Appends a specified number of characters to the String from a Char16 buffer.
[more]String& append (const String& str)
Appends a String value to the String.
[more]void remove (Uint32 index, Uint32 size = PEG_NOT_FOUND)
Removes a specified number of characters from the String starting at a given index.
[more]String subString (Uint32 index, Uint32 n = PEG_NOT_FOUND) const
Creates a new String containing up to the specified number of characters from the specified index in the String.
[more]Uint32 find (Char16 c) const
Finds the index of the first occurrence of a specified character in the String.
[more]Uint32 find (Uint32 index, Char16 c) const
Finds the index of the first occurrence of a specified character in the String beginning at a specified index.
[more]Uint32 find (const String& s) const
Finds the index of the first occurrence of a specified String value in the String.
[more]Uint32 reverseFind (Char16 c) const
Finds the index of the last occurrence of a specified character in the String.
[more]void toLower ()
Converts all characters in the String to lower case
[more]void toUpper ()
Experimental Interface
Converts all characters in the String to upper case
[more]static int compare (const String& s1, const String& s2, Uint32 n)
Compares the first n characters of two String objects.
[more]static int compare (const String& s1, const String& s2)
Compares two String objects.
[more]static int compareNoCase (const String& s1, const String& s2)
Compares two String objects, ignoring case differences.
[more]static Boolean equal (const String& s1, const String& s2)
Compares two String objects for equality.
[more]static Boolean equalNoCase (const String& s1, const String& s2)
Compares two strings and returns true if they are equal independent of the case of the characters.

ostatic const String EMPTY
Represents an empty string. This value may be used as a convenience to avoid construction of an empty String object.

o String()
Constructs an empty String

o String(const String& str)
Constructs a String with the value of another String.
Parameters:
str - The String from which to copy the value.

o String(const String& str, Uint32 n)
Constructs a String with a specified number of characters of the value of another String.
Throws:
IndexOutOfBoundsException If the specified String does not contain the specified number of characters.
bad_alloc If the construction fails because of a memory allocation failure.
Parameters:
str - The String from which to copy the value.
n - A Uint32 specifying the number of characters to copy.

o String(const Char16* str)
Constructs a String with the value from a Char16 buffer.
Throws:
NullPointer If the buffer pointer is NULL.
bad_alloc If the construction fails because of a memory allocation failure.
Parameters:
str - The Char16 buffer from which to copy the value.

o String(const Char16* str, Uint32 n)
Constructs a String with a specified number of characters of the value from a Char16 buffer.
Throws:
NullPointer If the buffer pointer is NULL.
bad_alloc If the construction fails because of a memory allocation failure.
Parameters:
str - The Char16 buffer from which to copy the value.
n - A Uint32 specifying the number of characters to copy.

o String(const char* str)
Constructs a String with the value from a C string in UTF-8 format.
Throws:
NullPointer If the C string pointer is NULL.
bad_alloc If the construction fails because of a memory allocation failure.
Exception If the C string contains invalid UTF-8.
Parameters:
str - The C string from which to copy the value.

o String(const char* str, Uint32 n)
Constructs a String with a specified number of characters of the value from a C string in UTF-8 format.
Throws:
NullPointer If the C string pointer is NULL.
bad_alloc If the construction fails because of a memory allocation failure.
Exception If the C string contains invalid UTF-8.
Parameters:
str - The C string from which to copy the value.
n - A Uint32 specifying the number of characters to copy.

o ~String()
Destructs a String object

oString& operator=(const String& str)
Assigns the value of a String to the value of another String.
Throws:
bad_alloc If the assignment fails because of a memory allocation failure.
Parameters:
str - The String from which to copy the value.
Returns:
A reference to the target String object with its newly assigned value.

oString& assign(const String& str)
Assigns the value of a String to the value of another String.
Throws:
bad_alloc If the assignment fails because of a memory allocation failure.
Parameters:
str - The String from which to copy the value.
Returns:
A reference to the target String object with its newly assigned value.

oString& assign(const Char16* str)
Assigns the value of a String to the value in a Char16 buffer.
Throws:
NullPointer If the buffer pointer is NULL.
bad_alloc If the assignment fails because of a memory allocation failure.
Parameters:
str - The Char16 buffer from which to copy the value.
Returns:
A reference to the target String object with its newly assigned value.

oString& assign(const Char16* str, Uint32 n)
Assigns the value of a String with a specified number of characters of the value from a Char16 buffer.
Throws:
NullPointer If the buffer pointer is NULL.
bad_alloc If the assignment fails because of a memory allocation failure.
Parameters:
str - The Char16 buffer from which to copy the value.
n - A Uint32 specifying the number of characters to copy.
Returns:
A reference to the target String object with its newly assigned value.

oString& assign(const char* str)
Assigns the value of a String to the value from a C string in UTF-8 format.
Throws:
NullPointer If the C string pointer is NULL.
bad_alloc If the assignment fails because of a memory allocation failure.
Exception If the C string contains invalid UTF-8.
Parameters:
str - The C string from which to copy the value.
Returns:
A reference to the target String object with its newly assigned value.

oString& assign(const char* str, Uint32 n)
Assigns the value of a String with a specified number of characters of the value from a C string in UTF-8 format.
Throws:
NullPointer If the C string pointer is NULL.
bad_alloc If the assignment fails because of a memory allocation failure.
Exception If the C string contains invalid UTF-8.
Parameters:
str - The C string from which to copy the value.
n - A Uint32 specifying the number of characters to copy.
Returns:
A reference to the target String object with its newly assigned value.

ovoid clear()
Sets a String value to the empty String

ovoid reserveCapacity(Uint32 capacity)
Reserves memory for a specified number of (16-bit) characters. This method does not change the size() of the string or any other external behavior. If the capacity of the string is already greater than or equal to the specified size, this method has no effect. The capacity of a String is set only for performance reasons.
Parameters:
capacity - A Uint32 specifying the number of characters the String should be prepared to hold.

oUint32 size() const
Returns the number of characters in a String value. No termination character is included in the count. For example, String("abcd").size() returns 4.

oconst Char16* getChar16Data() const
Gets a null-terminated Char16 buffer containing the String value. The buffer is valid until the original String object is modified or destructed.
Returns:
A pointer to a null-terminated Char16 buffer containing the String value.

oCString getCString() const
Gets a CString object containing the String value in UTF-8 format. Important: A character pointer extracted from a CString object is only valid while the CString object exists and is unmodified. (See the CString documentation.) Thus, in the following example, the variable p holds a dangling (invalid) pointer:
              const char * p = (const char *)test.getCString();
        
This situation can be corrected by declaring a CString variable in the same scope.

Throws:
bad_alloc If the operation fails because of a memory allocation failure.
Returns:
A CString object containing the String value in UTF-8 format.

oChar16& operator[](Uint32 index)
Gets a specified character from the String value.
Throws:
IndexOutOfBoundsException If the String does not contain a character at the specified index.
Parameters:
index - Index of the character to access.
Returns:
The Char16 character at the specified index.

oconst Char16 operator[](Uint32 index) const
Gets a specified character from the String value.
Throws:
IndexOutOfBoundsException If the String does not contain a character at the specified index.
Parameters:
index - Index of the character to access.
Returns:
The Char16 character at the specified index.

oString& append(const Char16& c)
Appends a character to the String.
Throws:
bad_alloc If the append fails because of a memory allocation failure.
Parameters:
c - The Char16 character to append.
Returns:
A reference to the String object containing the newly appended character.

oString& append(const Char16* str, Uint32 n)
Appends a specified number of characters to the String from a Char16 buffer.
Throws:
NullPointer If the buffer pointer is NULL.
bad_alloc If the append fails because of a memory allocation failure.
Parameters:
str - The Char16 buffer from which to append the characters.
n - A Uint32 specifying the number of characters to append from the buffer.
Returns:
A reference to the String object containing the newly appended characters.

oString& append(const String& str)
Appends a String value to the String.
Throws:
bad_alloc If the append fails because of a memory allocation failure.
Parameters:
str - The String to append.
Returns:
A reference to the String object containing the newly appended characters.

ovoid remove(Uint32 index, Uint32 size = PEG_NOT_FOUND)
Removes a specified number of characters from the String starting at a given index. If the number of characters to remove is specified as PEG_NOT_FOUND, then all characters from the index to the end of the String are removed.
Throws:
IndexOutOfBoundsException If the index plus the size (if not PEG_NOT_FOUND) is greater than the number of characters in the String.
Parameters:
index - Uint32 position in String from which to remove characters.
- size A Uint32 specifying the number of characters to remove. The default value is PEG_NOT_FOUND, which means all characters from the index to the end of the String are to be removed.

oString subString(Uint32 index, Uint32 n = PEG_NOT_FOUND) const
Creates a new String containing up to the specified number of characters from the specified index in the String.
Throws:
bad_alloc If the operation fails because of a memory allocation failure.
Parameters:
index - A Uint32 specifying the index at which to copy characters into the new String.
n - A Uint32 specifying the maximum number of characters to copy into the new String. If the value is PEG_NOT_FOUND or is greater than the number of characters from the index to the end of the String, the new String contains all characters from the index to the end of the String.
Returns:
A new String containing up to the specified number of characters from the specified index in the String.

oUint32 find(Char16 c) const
Finds the index of the first occurrence of a specified character in the String. If the character is not found, PEG_NOT_FOUND is returned.
Parameters:
c - The Char16 value to find in the String.
Returns:
The Uint32 index of the character in the String if found, PEG_NOT_FOUND otherwise.

oUint32 find(Uint32 index, Char16 c) const
Finds the index of the first occurrence of a specified character in the String beginning at a specified index. If the character is not found, PEG_NOT_FOUND is returned.
Parameters:
c - The Char16 value to find in the String.
index - The Uint32 index at which to start the search.
Returns:
The Uint32 index of the character in the String if found, PEG_NOT_FOUND otherwise.

oUint32 find(const String& s) const
Finds the index of the first occurrence of a specified String value in the String. If the String value is not found, PEG_NOT_FOUND is returned.
Parameters:
s - The String value to find in the String.
Returns:
The Uint32 index of the beginning of the String value if found, PEG_NOT_FOUND otherwise.

oUint32 reverseFind(Char16 c) const
Finds the index of the last occurrence of a specified character in the String. If the character is not found, PEG_NOT_FOUND is returned.
Parameters:
c - The Char16 value to find in the String.
Returns:
The Uint32 index of the character in the String if found, PEG_NOT_FOUND otherwise.

ovoid toLower()
Converts all characters in the String to lower case

ovoid toUpper()
Experimental Interface
Converts all characters in the String to upper case

ostatic int compare(const String& s1, const String& s2, Uint32 n)
Compares the first n characters of two String objects.
Parameters:
s1 - The first String to compare.
s2 - The second String to compare.
n - The maximum number of characters to compare.
Returns:
A negative integer if the first n characters of s1 are lexographically less than s2, 0 if the first n characters of s1 and s2 are equal, and a positive integer otherwise.

ostatic int compare(const String& s1, const String& s2)
Compares two String objects. (Note: Use the comparison operators < <= > >= to compare String objects.)
Parameters:
s1 - The first String to compare.
s2 - The second String to compare.
Returns:
A negative integer if s1 is lexographically less than s2, 0 if s1 and s2 are equal, and a positive integer otherwise.

ostatic int compareNoCase(const String& s1, const String& s2)
Compares two String objects, ignoring case differences.
Parameters:
s1 - The first String to compare.
s2 - The second String to compare.
Returns:
A negative integer if s1 is lexographically less than s2, 0 if s1 and s2 are equal, and a positive integer otherwise. (Case differences are ignored in all cases.)

ostatic Boolean equal(const String& s1, const String& s2)
Compares two String objects for equality. For example,
            String s1 = "Hello World";
            String s2 = s1;
            assert(String::equal(s1, s2));
        
Parameters:
s1 - The first String to compare.
s2 - The second String to compare.
Returns:
True if the two strings are equal, false otherwise.

ostatic Boolean equalNoCase(const String& s1, const String& s2)
Compares two strings and returns true if they are equal independent of the case of the characters.
Parameters:
s1 - The first String to compare.
s2 - The second String to compare.
Returns:
true if the strings are equal independent of case, false otherwise.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java


[an error occurred while processing this directive]