cocos2d-x  2.1.1

#include <CCString.h>

Inheritance diagram for CCString:
CCObject CCCopying

Public Member Functions

 CCString ()
 
 CCString (const char *str)
 
 CCString (const std::string &str)
 
 CCString (const CCString &str)
 
virtual ~CCString ()
 
CCStringoperator= (const CCString &other)
 
bool initWithFormat (const char *format,...)
 init a string with format, it's similar with the c function 'sprintf'
 
int intValue () const
 convert to int value
 
unsigned int uintValue () const
 convert to unsigned int value
 
float floatValue () const
 convert to float value
 
double doubleValue () const
 convert to double value
 
bool boolValue () const
 convert to bool value
 
const char * getCString () const
 get the C string
 
unsigned int length () const
 get the length of string
 
int compare (const char *) const
 compare to a c string
 
virtual CCObjectcopyWithZone (CCZone *pZone)
 
virtual bool isEqual (const CCObject *pObject)
 
- Public Member Functions inherited from CCObject
 CCObject (void)
 
virtual ~CCObject (void)
 
void release (void)
 
void retain (void)
 
CCObjectautorelease (void)
 
CCObjectcopy (void)
 
bool isSingleReference (void)
 
unsigned int retainCount (void)
 
virtual void update (float dt)
 

Static Public Member Functions

static CCStringcreate (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.
 
static CCStringcreateWithFormat (const char *format,...)
 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 kMaxStringLen macro in CCString.cpp file.
 
static CCStringcreateWithData (const unsigned char *pData, unsigned long nLen)
 create a string with binary data
 
static CCStringcreateWithContentsOfFile (const char *pszFileName)
 create a string with a file,
 

Public Attributes

std::string m_sString
 
- Public Attributes inherited from CCObject
unsigned int m_uID
 
int m_nLuaID
 

Additional Inherited Members

- Protected Attributes inherited from CCObject
unsigned int m_uReference
 
unsigned int m_uAutoReleaseCount
 

Constructor & Destructor Documentation

CCString ( )
CCString ( const char *  str)
CCString ( const std::string &  str)
CCString ( const CCString str)
virtual ~CCString ( )
virtual

Member Function Documentation

bool boolValue ( ) const

convert to bool value

int compare ( const char *  ) const

compare to a c string

virtual CCObject* copyWithZone ( CCZone pZone)
virtual

Reimplemented from CCCopying.

static CCString* 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 CCString pointer which is an autorelease object pointer, it means that you needn't do a release operation unless you retain it.
static CCString* createWithContentsOfFile ( const char *  pszFileName)
static

create a string with a file,

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

create a string with binary data

Returns
A CCString pointer which is an autorelease object pointer, it means that you needn't do a release operation unless you retain it.
static CCString* 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 kMaxStringLen macro in CCString.cpp file.

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

convert to double value

float floatValue ( ) const

convert to float value

const char* getCString ( ) const

get the C string

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

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

int intValue ( ) const

convert to int value

virtual bool isEqual ( const CCObject pObject)
virtual

Reimplemented from CCObject.

unsigned int length ( ) const

get the length of string

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

convert to unsigned int value

Member Data Documentation

std::string m_sString

The documentation for this class was generated from the following file:
  • /Users/zhangkoumyou/SourceCode/cocos2d-x/cocos2dx/cocoa/CCString.h