// ================================================================================================
// TBXML.h
// Fast processing of XML files
//
// ================================================================================================
// Created by Tom Bradley on 21/10/2009.
// Version 1.5
//
// Copyright 2012 71Squared All rights reserved.b
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// ================================================================================================
@class TBXML;
// ================================================================================================
// Error Codes
// ================================================================================================
enum TBXMLErrorCodes {
D_TBXML_DATA_NIL,
D_TBXML_DECODE_FAILURE,
D_TBXML_MEMORY_ALLOC_FAILURE,
D_TBXML_FILE_NOT_FOUND_IN_BUNDLE,
D_TBXML_ELEMENT_IS_NIL,
D_TBXML_ELEMENT_NAME_IS_NIL,
D_TBXML_ELEMENT_NOT_FOUND,
D_TBXML_ELEMENT_TEXT_IS_NIL,
D_TBXML_ATTRIBUTE_IS_NIL,
D_TBXML_ATTRIBUTE_NAME_IS_NIL,
D_TBXML_ATTRIBUTE_NOT_FOUND,
D_TBXML_PARAM_NAME_IS_NIL
};
// ================================================================================================
// Defines
// ================================================================================================
#define D_TBXML_DOMAIN @"com.71squared.tbxml"
#define MAX_ELEMENTS 100
#define MAX_ATTRIBUTES 100
#define TBXML_ATTRIBUTE_NAME_START 0
#define TBXML_ATTRIBUTE_NAME_END 1
#define TBXML_ATTRIBUTE_VALUE_START 2
#define TBXML_ATTRIBUTE_VALUE_END 3
#define TBXML_ATTRIBUTE_CDATA_END 4
// ================================================================================================
// Structures
// ================================================================================================
/** The TBXMLAttribute structure holds information about a single XML attribute. The structure holds the attribute name, value and next sibling attribute. This structure allows us to create a linked list of attributes belonging to a specific element.
*/
typedef struct _TBXMLAttribute {
char * name;
char * value;
struct _TBXMLAttribute * next;
} TBXMLAttribute;
/** The TBXMLElement structure holds information about a single XML element. The structure holds the element name & text along with pointers to the first attribute, parent element, first child element and first sibling element. Using this structure, we can create a linked list of TBXMLElements to map out an entire XML file.
*/
typedef struct _TBXMLElement {
char * name;
char * text;
TBXMLAttribute * firstAttribute;
struct _TBXMLElement * parentElement;
struct _TBXMLElement * firstChild;
struct _TBXMLElement * currentChild;
struct _TBXMLElement * nextSibling;
struct _TBXMLElement * previousSibling;
} TBXMLElement;
/** The TBXMLElementBuffer is a structure that holds a buffer of TBXMLElements. When the buffer of elements is used, an additional buffer is created and linked to the previous one. This allows for efficient memory allocation/deallocation elements.
*/
typedef struct _TBXMLElementBuffer {
TBXMLElement * elements;
struct _TBXMLElementBuffer * next;
struct _TBXMLElementBuffer * previous;
} TBXMLElementBuffer;
/** The TBXMLAttributeBuffer is a structure that holds a buffer of TBXMLAttributes. When the buffer of attributes is used, an additional buffer is created and linked to the previous one. This allows for efficient memeory allocation/deallocation of attributes.
*/
typedef struct _TBXMLAttributeBuffer {
TBXMLAttribute * attributes;
struct _TBXMLAttributeBuffer * next;
struct _TBXMLAttributeBuffer * previous;
} TBXMLAttributeBuffer;
// ================================================================================================
// Block Callbacks
// ================================================================================================
typedef void (^TBXMLSuccessBlock)(TBXML *);
typedef void (^TBXMLFailureBlock)(TBXML *, NSError *);
typedef void (^TBXMLIterateBlock)(TBXMLElement *);
typedef void (^TBXMLIterateAttributeBlock)(TBXMLAttribute *, NSString*, NSString*);
// ================================================================================================
// TBXML Public Interface
// ================================================================================================
@interface TBXML : NSObject {
@private
TBXMLElement * rootXMLElement;
TBXMLElementBuffer * currentElementBuffer;
TBXMLAttributeBuffer * currentAttributeBuffer;
long currentElement;
long currentAttribute;
char * bytes;
long bytesLength;
}
@property (nonatomic, readonly) TBXMLElement * rootXMLElement;
+ (id)tbxmlWithXMLString:(NSString*)aXMLString error:(NSError **)error;
+ (id)tbxmlWithXMLData:(NSData*)aData error:(NSError **)error;
+ (id)tbxmlWithXMLFile:(NSString*)aXMLFile error:(NSError **)error;
+ (id)tbxmlWithXMLFile:(NSString*)aXMLFile fileExtension:(NSString*)aFileExtension error:(NSError **)error;
+ (id)tbxmlWithXMLString:(NSString*)aXMLString __attribute__((deprecated));
+ (id)tbxmlWithXMLData:(NSData*)aData __attribute__((deprecated));
+ (id)tbxmlWithXMLFile:(NSString*)aXMLFile __attribute__((deprecated));
+ (id)tbxmlWithXMLFile:(NSString*)aXMLFile fileExtension:(NSString*)aFileExtension __attribute__((deprecated));
- (id)initWithXMLString:(NSString*)aXMLString error:(NSError **)error;
- (id)initWithXMLData:(NSData*)aData error:(NSError **)error;
- (id)initWithXMLFile:(NSString*)aXMLFile error:(NSError **)error;
- (id)initWithXMLFile:(NSString*)aXMLFile fileExtension:(NSString*)aFileExtension error:(NSError **)error;
- (id)initWithXMLString:(NSString*)aXMLString __attribute__((deprecated));
- (id)initWithXMLData:(NSData*)aData __attribute__((deprecated));
- (id)initWithXMLFile:(NSString*)aXMLFile __attribute__((deprecated));
- (id)initWithXMLFile:(NSString*)aXMLFile fileExtension:(NSString*)aFileExtension __attribute__((deprecated));
- (void) decodeData:(NSData*)data;
- (void) decodeData:(NSData*)data withError:(NSError **)error;
@end
// ================================================================================================
// TBXML Static Functions Interface
// ================================================================================================
@interface TBXML (StaticFunctions)
+ (NSString*) elementName:(TBXMLElement*)aXMLElement;
+ (NSString*) elementName:(TBXMLElement*)aXMLElement error:(NSError **)error;
+ (NSString*) textForElement:(TBXMLElement*)aXMLElement;
+ (NSString*) textForElement:(TBXMLElement*)aXMLElement error:(NSError **)error;
+ (NSString*) valueOfAttributeNamed:(NSString *)aName forElement:(TBXMLElement*)aXMLElement;
+ (NSString*) valueOfAttributeNamed:(NSString *)aName forElement:(TBXMLElement*)aXMLElement error:(NSError **)error;
+ (NSString*) attributeName:(TBXMLAttribute*)aXMLAttribute;
+ (NSString*) attributeName:
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
在网上找的Cocos2d 版 关节动画工具(类似 国内的Cocos2d-x 版) 英文参考: This tool provides a fast way of reusing animations made in Flash CS in Cocos2D projects. A minimaly tweaked version of the amazing exporter by Grapefrukt provides a way to export all the animation information (position, rotation, scale) of a Flash made character to xml. The FlashToCocos iOS library reads those xml files and recreates the characters in Cocos2D.
资源推荐
资源详情
资源评论
收起资源包目录
FlashToCocos2d cocos2d关节动画工具 (152个子文件)
MaxRectsBinPack.as 18KB
XMLDataSerializer.as 9KB
TextureExtractor.as 8KB
SimpleExport.as 8KB
AnimationExtractor.as 7KB
PNGAtlasPackerSerializer.as 5KB
MultiframeUtil.as 5KB
VectorExtractor.as 5KB
FontSheet.as 5KB
ChildFinder.as 4KB
AnimationExtractorDebug.as 4KB
Animation.as 4KB
ConsoleLog.as 4KB
TextureSheet.as 4KB
TextureExporter.as 4KB
FunctionQueue.as 3KB
TextureSheetDebug.as 3KB
FileOutSerializer.as 3KB
TextureSheetCollection.as 3KB
XMLAtlasDataSerializer.as 3KB
AnimationFrame.as 3KB
AnimationCollection.as 3KB
SVGImageSerializer.as 3KB
LogEvent.as 3KB
MultiframeBitmapTexture.as 3KB
FontExtractor.as 3KB
TextureBase.as 3KB
AtlasWrapperFileSerializer.as 3KB
ExtractorBase.as 3KB
ZipFileSerializer.as 3KB
Logger.as 2KB
Settings.as 2KB
PNGAtlasPackerDedupeSerializer.as 2KB
BitmapTexture.as 2KB
PNGImageSerializer.as 2KB
TextureAtlasRect.as 2KB
BaseDataSerializer.as 2KB
VectorTexture.as 2KB
AnimationMarker.as 2KB
AddXMLSpacesFilter.as 2KB
IDataSerializer.as 2KB
IImageSerializer.as 2KB
AnimationPart.as 2KB
Child.as 2KB
IFileSerializer.as 2KB
FontSheetCollection.as 2KB
IFilter.as 2KB
SimpleExportGui.as 2KB
ServerUploadSerializer.as 1KB
FunctionQueueEvent.as 527B
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
robot_02.fla 38KB
robot_01.fla 37KB
.gitignore 104B
.gitignore 21B
TBXML.h 9KB
TBXML+Compression.h 3KB
FTCCharacter.h 2KB
FTCCharacter.h 2KB
GameConfig.h 1KB
FTCSprite.h 981B
FTCSprite.h 981B
TBXML+HTTP.h 960B
FTCParser.h 538B
FTCParser.h 538B
HelloWorldLayer.h 517B
FTCFrameInfo.h 484B
FTCFrameInfo.h 484B
AppDelegate.h 379B
FTCAnimationInfo.h 355B
FTCAnimationInfo.h 355B
FTCAnimEvent.h 317B
FTCAnimEvent.h 317B
FTCEventInfo.h 314B
FTCEventInfo.h 314B
CCRobot.h 293B
RootViewController.h 244B
iTunesArtwork 61KB
TBXML.m 30KB
TBXML+Compression.m 9KB
FTCParser.m 8KB
FTCParser.m 8KB
FTCCharacter.m 6KB
FTCCharacter.m 6KB
RootViewController.m 4KB
AppDelegate.m 4KB
HelloWorldLayer.m 4KB
TBXML+HTTP.m 3KB
FTCSprite.m 2KB
FTCSprite.m 2KB
CCRobot.m 779B
FTCAnimEvent.m 476B
FTCAnimEvent.m 476B
main.m 353B
FTCAnimationInfo.m 267B
共 152 条
- 1
- 2
资源评论
- laoniu20102016-10-10非常感谢提供这个工具
- 健健2013-07-22很不错,能找到这个工具
- fmcf8132013-03-19感谢提供这个工具,找了一天了,方便大家啊!
keangame
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功