cocos2d-x  2.2.3-gd2.113-rev1ec524e
Loading...
Searching...
No Matches
CCString Class Reference

#include <CCString.h>

Inheritance diagram for CCString:
[legend]
Collaboration diagram for CCString:
[legend]

Public Member Functions

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

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. More...
 
static CCStringcreateWithFormat (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 kMaxStringLen macro in CCString.cpp file. More...
 
static CCString static CCStringcreateWithData (const unsigned char *pData, unsigned long nLen)
 create a string with binary data More...
 
static CCStringcreateWithContentsOfFile (const char *pszFileName)
 create a string with a file, More...
 
- Static Public Member Functions inherited from CCObject
static CCObjectcreateWithCoder (DS_Dictionary *)
 

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
 
int m_nTag
 
int m_eObjType
 
unsigned int m_uObjectIdxInArray
 

Constructor & Destructor Documentation

◆ CCString() [1/4]

CCString ( )

NA.

◆ CCString() [2/4]

CCString ( const char *  str)

NA.

◆ CCString() [3/4]

CCString ( const std::string &  str)

NA.

◆ CCString() [4/4]

CCString ( const CCString str)

NA.

◆ ~CCString()

virtual ~CCString ( )
virtual

NA.

Member Function Documentation

◆ acceptVisitor()

virtual void acceptVisitor ( CCDataVisitor visitor)
virtual

NA.

Reimplemented from CCObject.

◆ boolValue()

bool boolValue ( ) const

convert to bool value

◆ compare()

int compare ( const char *  ) const

compare to a c string

◆ copyWithZone()

virtual CCObject * copyWithZone ( CCZone pZone)
virtual

Reimplemented from CCCopying.

◆ create()

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.

◆ createWithContentsOfFile()

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.

◆ createWithData()

static CCString 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.

◆ createWithFormat()

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. NA

◆ doubleValue()

double doubleValue ( ) const

convert to double value

◆ floatValue()

float floatValue ( ) const

convert to float value

◆ getCString()

const char * getCString ( ) const

get the C string

◆ initWithFormat()

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

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

◆ intValue()

bool int intValue ( ) const

convert to int value

◆ isEqual()

virtual bool isEqual ( const CCObject pObject)
virtual

Reimplemented from CCObject.

◆ length()

unsigned int length ( ) const

get the length of string

◆ operator=()

CCString & operator= ( const CCString other)

◆ uintValue()

unsigned int uintValue ( ) const

convert to unsigned int value

Member Data Documentation

◆ m_sString

std::string m_sString

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