cocos2d-x  3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
__String Class Reference

#include <CCString.h>

Inheritance diagram for __String:
Ref Clonable

Public Member Functions

 __String ()
 NA NA More...
 
 __String (const char *str)
 NA NA More...
 
 __String (const std::string &str)
 NA NA More...
 
 __String (const __String &str)
 NA NA More...
 
virtual ~__String ()
 NA NA More...
 
__Stringoperator= (const __String &other)
 
bool initWithFormat (const char *format,...) CC_FORMAT_PRINTF(2
 init a string with format, it's similar with the c function 'sprintf' NA NA More...
 
bool int intValue () const
 convert to int value NA More...
 
unsigned int uintValue () const
 convert to unsigned int value NA More...
 
float floatValue () const
 convert to float value NA More...
 
double doubleValue () const
 convert to double value NA More...
 
bool boolValue () const
 convert to bool value NA More...
 
const char * getCString () const
 get the C string NA More...
 
int length () const
 get the length of string NA More...
 
int compare (const char *) const
 compare to a c string NA More...
 
void append (const std::string &str)
 append additional characters at the end of its current value NA NA More...
 
void appendWithFormat (const char *format,...)
 append(w/ format) additional characters at the end of its current value NA NA More...
 
__ArraycomponentsSeparatedByString (const char *delimiter)
 split a string NA NA More...
 
virtual bool isEqual (const Ref *pObject)
 
virtual void acceptVisitor (DataVisitor &visitor)
 NA NA More...
 
virtual __Stringclone () const
 NA NA More...
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 NA NA More...
 
- Public Member Functions inherited from Clonable
virtual ~Clonable ()
 NA NA More...
 
Refcopy () const
 returns a copy of the Ref. More...
 

Static Public Member Functions

static __Stringcreate (const std::string &str)
 create a string with std string, you can also pass a c string pointer because the default constructor of std::string can access a c string pointer. More...
 
static __StringcreateWithFormat (const char *format,...) CC_FORMAT_PRINTF(1
 create a string with format, it's similar with the c function 'sprintf', the default buffer size is (1024*100) bytes, if you want to change it, you should modify the kMax__StringLen macro in __String.cpp file. More...
 
static __String static __StringcreateWithData (const unsigned char *pData, size_t nLen)
 create a string with binary data More...
 
static __StringcreateWithContentsOfFile (const std::string &filename)
 create a string with a file, More...
 

Public Attributes

std::string _string
 

Additional Inherited Members

- Protected Member Functions inherited from Ref
 Ref ()
 Constructor. More...
 
- Protected Attributes inherited from Ref
unsigned int _referenceCount
 count of references More...
 

Constructor & Destructor Documentation

__String ( )

NA NA

__String ( const char *  str)

NA NA

__String ( const std::string &  str)

NA NA

__String ( const __String str)

NA NA

virtual ~__String ( )
virtual

NA NA

Member Function Documentation

virtual void acceptVisitor ( DataVisitor visitor)
virtual

NA NA

void append ( const std::string &  str)

append additional characters at the end of its current value NA NA

void appendWithFormat ( const char *  format,
  ... 
)

append(w/ format) additional characters at the end of its current value NA NA

bool boolValue ( ) const

convert to bool value NA

virtual __String* clone ( ) const
virtual

NA NA

Implements Clonable.

int compare ( const char *  ) const

compare to a c string NA

__Array* componentsSeparatedByString ( const char *  delimiter)

split a string NA NA

static __String* create ( const std::string &  str)
static

create a string with std string, you can also pass a c string pointer because the default constructor of std::string can access a c string pointer.

Returns
A String pointer which is an autorelease object pointer, it means that you needn't do a release operation unless you retain it. NA
static __String* createWithContentsOfFile ( const std::string &  filename)
static

create a string with a file,

Returns
A String pointer which is an autorelease object pointer, it means that you needn't do a release operation unless you retain it. NA
static __String static __String* createWithData ( const unsigned char *  pData,
size_t  nLen 
)
static

create a string with binary data

Returns
A String pointer which is an autorelease object pointer, it means that you needn't do a release operation unless you retain it. NA
static __String* createWithFormat ( const char *  format,
  ... 
)
static

create a string with format, it's similar with the c function 'sprintf', the default buffer size is (1024*100) bytes, if you want to change it, you should modify the kMax__StringLen macro in __String.cpp file.

Returns
A String pointer which is an autorelease object pointer, it means that you needn't do a release operation unless you retain it. NA
double doubleValue ( ) const

convert to double value NA

float floatValue ( ) const

convert to float value NA

const char* getCString ( ) const

get the C string NA

bool initWithFormat ( const char *  format,
  ... 
)

init a string with format, it's similar with the c function 'sprintf' NA NA

bool int intValue ( ) const

convert to int value NA

virtual bool isEqual ( const Ref pObject)
virtual
int length ( ) const

get the length of string NA

__String& operator= ( const __String other)
unsigned int uintValue ( ) const

convert to unsigned int value NA

Member Data Documentation

std::string _string

The documentation for this class was generated from the following file: