Server
API Reference Guide
Product Documentation:

Visualization Server
Documentation Home
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions
IlsStringFactory Class Referenceabstract

This class can be used to implement a string factory that will be used by the class IlsString. More...

#include <ilserver/sstring.h>

Public Member Functions

virtual IlsString::RefCount getMinCount ()=0
 Return the minimum value of the reference counter that is of interest to the factory. More...
 
virtual IlsString getString (const char *value, int count=-1)=0
 Returns a pointer to an IlsString object built from the string value. More...
 
virtual void reachedMinCount (IlsString &)=0
 Called by the class IlsString every time the reference counter is equal or less than the value returned by the method getMinCount(). More...
 

Static Public Member Functions

static IlsStringFactoryGetSingletonPtr ()
 Gets a pointer to the IlsString factory if there is one.
 
static IlsStringFactorySetSingleton (IlsStringFactory *newFactory)
 Sets the IlsString factory. More...
 

Protected Member Functions

void deleteString (IlsString &)
 Deletes the internal representation of the string and resets the string to the null string.
 
IlsString makeNonFactoryString (const char *, int=-1)
 Creates a new instance of a string when needed. More...
 

Detailed Description

This class can be used to implement a string factory that will be used by the class IlsString.

Library: server
and mvcomp

See also
IlsString.

Member Function Documentation

◆ getMinCount()

virtual IlsString::RefCount IlsStringFactory::getMinCount ( )
pure virtual

Return the minimum value of the reference counter that is of interest to the factory.

If the factory is not interested in being notified, via the callback reachMinCount(), then this method should always return a negative number.

◆ getString()

virtual IlsString IlsStringFactory::getString ( const char *  value,
int  count = -1 
)
pure virtual

Returns a pointer to an IlsString object built from the string value.

An example of the use of this method would be to cache IlsString instances and to return a copy of the string if it exists already. If the count parameter is greater than zero, only the first count characters of the string should be used to create the new string.

◆ makeNonFactoryString()

IlsString IlsStringFactory::makeNonFactoryString ( const char *  ,
int  = -1 
)
protected

Creates a new instance of a string when needed.

This function calls the protected constructor of the class IlsString, which creates a string without using the string factory.

◆ reachedMinCount()

virtual void IlsStringFactory::reachedMinCount ( IlsString )
pure virtual

Called by the class IlsString every time the reference counter is equal or less than the value returned by the method getMinCount().

An example of the use of this method is to remove a string from a cache every time the reference count drops to zero, or to one if the string is also held by the cache.

◆ SetSingleton()

IlsStringFactory * IlsStringFactory::SetSingleton ( IlsStringFactory newFactory)
static

Sets the IlsString factory.

The function returns the pointer to the old factory if any. It is the responsibility of the user to delete any factories created if necessary.

Parameters
newFactorythe new string factory
Returns
the previous string factory