Fixed #3806: SAXParser supported with manual binding in JSB

This commit is contained in:
pandamicro 2014-01-21 18:12:12 +08:00
parent b454bf01e3
commit a467fe3244
3 changed files with 45 additions and 5 deletions

View File

@ -1 +1 @@
16af4ad046f4db00af7a229d89c406054d8616c3
4d5ce0b03be411b27323ef9800c2a292e03499f9

View File

@ -3,6 +3,7 @@
#include "jsapi.h"
#include "ScriptingCore.h"
#include "platform/CCSAXParser.h"
class JSScheduleWrapper;
@ -200,5 +201,44 @@ private:
};
class CC_DLL __JSSAXDelegator: public cocos2d::SAXDelegator
{
public:
static __JSSAXDelegator* getInstance() {
static __JSSAXDelegator* pInstance = NULL;
if (pInstance == NULL) {
pInstance = new __JSSAXDelegator();
}
return pInstance;
};
~__JSSAXDelegator();
cocos2d::SAXParser* getParser();
std::string parse(std::string path);
bool preloadPlist(std::string path) {
return true;
}
std::string getList(std::string path) {
return path;
}
// implement pure virtual methods of SAXDelegator
void startElement(void *ctx, const char *name, const char **atts);
void endElement(void *ctx, const char *name);
void textHandler(void *ctx, const char *ch, int len);
private:
cocos2d::SAXParser _parser;
JSObject* _obj;
std::string _result;
bool _isStoringCharacters;
std::string _currentValue;
};
#endif

View File

@ -26,7 +26,7 @@ headers = %(cocosdir)s/cocos/2d/cocos2d.h %(cocosdir)s/cocos/audio/include/Simpl
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set SimpleAudioEngine Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak TextFieldTTF EGLViewProtocol EGLView Component __NodeRGBA __LayerRGBA
classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set SimpleAudioEngine Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak TextFieldTTF EGLViewProtocol EGLView Component __NodeRGBA __LayerRGBA SAXParser
classes_need_extend = Node Layer.* Sprite MenuItemFont Scene DrawNode
@ -60,11 +60,11 @@ skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserDat
Texture2D::[initWithPVRTCData addPVRTCImage releaseData setTexParameters initWithData keepData getPixelFormatInfoMap],
Set::[begin end acceptVisitor],
IMEDispatcher::[*],
SAXParser::[*],
Thread::[*],
Profiler::[*],
ProfilingTimer::[*],
CallFunc::[create initWithFunction],
SAXParser::[(?!(init))],
SAXDelegator::[*],
Color3bObject::[*],
TouchDispatcher::[*],
@ -136,14 +136,14 @@ rename_classes = ParticleSystemQuad::ParticleSystem,
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents = Node Director SimpleAudioEngine FileUtils TMXMapInfo Application EGLViewProtocol
classes_have_no_parents = Node Director SimpleAudioEngine FileUtils TMXMapInfo Application EGLViewProtocol SAXParser
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip = Object Clonable
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes = Action FiniteTimeAction ActionInterval ActionEase EaseRateAction EaseElastic EaseBounce ActionInstant GridAction Grid3DAction TiledGrid3DAction Director SpriteFrameCache TransitionEaseScene Set SimpleAudioEngine FileUtils Application ClippingNode Label EGLViewProtocol EGLView Component
abstract_classes = Action FiniteTimeAction ActionInterval ActionEase EaseRateAction EaseElastic EaseBounce ActionInstant GridAction Grid3DAction TiledGrid3DAction Director SpriteFrameCache TransitionEaseScene Set SimpleAudioEngine FileUtils Application ClippingNode Label EGLViewProtocol EGLView Component SAXParser
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
script_control_cpp = no