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 ()
 __String (const char *str)
 __String (const std::string &str)
 __String (const __String &str)
virtual ~__String ()
__Stringoperator= (const __String &other)
local operator= ( local other)
bool initWithFormat (const char *format,...) CC_FORMAT_PRINTF(2
 init a string with format, it's similar with the c function 'sprintf' More...
 
bool int intValue () const
 convert to int value More...
 
unsigned int uintValue () const
 convert to unsigned int value More...
 
local uintValue ()
 convert to unsigned int value More...
 
float floatValue () const
 convert to float value More...
 
local floatValue ()
 convert to float value More...
 
double doubleValue () const
 convert to double value More...
 
local doubleValue ()
 convert to double value More...
 
bool boolValue () const
 convert to bool value More...
 
local boolValue ()
 convert to bool value More...
 
const char * getCString () const
 get the C string More...
 
local getCString ()
 get the C string More...
 
int length () const
 get the length of string More...
 
local length ()
 get the length of string More...
 
int compare (const char *) const
 compare to a c string More...
 
local compare ()
 compare to a c string More...
 
void append (const std::string &str)
 append additional characters at the end of its current value More...
 
void appendWithFormat (const char *format,...)
 append(w/ format) additional characters at the end of its current value More...
 
__ArraycomponentsSeparatedByString (const char *delimiter)
 split a string More...
 
virtual bool isEqual (const Ref *pObject)
var isEqual ( var pObject)
local isEqual ( local pObject)
virtual void acceptVisitor (DataVisitor &visitor)
virtual __Stringclone () const
 returns a copy of the Ref 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 ()
- Public Member Functions inherited from Clonable
virtual ~Clonable ()
Refcopy () const
 returns a copy of the Ref. More...
 
var copy ()
 returns a copy of the Ref. More...
 
local copy ()
 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...
 
local create ( local 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...
 
local createWithData ( local pData, local nLen)
 create a string with binary data More...
 
static __StringcreateWithContentsOfFile (const std::string &filename)
 create a string with a file, More...
 
local createWithContentsOfFile ( local 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 ( )
__String ( const char *  str)
__String ( const std::string &  str)
__String ( const __String str)
virtual ~__String ( )
virtual

Member Function Documentation

virtual void acceptVisitor ( DataVisitor visitor)
virtual
void append ( const std::string &  str)

append additional characters at the end of its current value

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

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

bool boolValue ( ) const

convert to bool value

local boolValue ( )

convert to bool value

virtual __String* clone ( ) const
virtual

returns a copy of the Ref

Implements Clonable.

int compare ( const char *  ) const

compare to a c string

local compare ( local  )

compare to a c string

__Array*
componentsSeparatedByString
( const char *  delimiter)

split a string

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.
local create ( local  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.
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.
local createWithContentsOfFile ( local  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.
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.
local createWithData ( local  pData,
local  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.
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.
local createWithFormat ( local  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.
double doubleValue ( ) const

convert to double value

local doubleValue ( )

convert to double value

float floatValue ( ) const

convert to float value

local floatValue ( )

convert to float value

const char* getCString ( ) const

get the C string

local getCString ( )

get the C string

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

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

bool int intValue ( ) const

convert to int value

local intValue ( )

convert to int value

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

get the length of string

local length ( )

get the length of string

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

convert to unsigned int value

local uintValue ( )

convert to unsigned int value

Member Data Documentation

std::string _string
var _string
local _string

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