diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-20 13:55:58 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-20 13:55:58 +0000 |
commit | 04f4e2acfbc82946ca3def654214c08071a87359 (patch) | |
tree | 871e1f476ed5086e8ebbd7e182ea2a89707cc249 /include | |
parent | 24cbc87262dc8856741db8e9f8388c18b16583ad (diff) |
xml api became a set of functions
git-svn-id: http://svn.miranda-ng.org/main/trunk@14288 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'include')
-rw-r--r-- | include/delphi/m_xml.inc | 308 | ||||
-rw-r--r-- | include/m_xml.h | 175 |
2 files changed, 190 insertions, 293 deletions
diff --git a/include/delphi/m_xml.inc b/include/delphi/m_xml.inc index f58efbf78a..966cf736f1 100644 --- a/include/delphi/m_xml.inc +++ b/include/delphi/m_xml.inc @@ -60,193 +60,125 @@ type eXMLErrorBase64DecodeTruncatedData,
eXMLErrorBase64DecodeBufferTooSmall);
-const
- XML_API_SIZEOF_V1 = SizeOf(size_t)+26*sizeof(dword);
+function xmlCreateNode(const name, text:PWideChar; IsDeclaration:boolean):HXML; stdcall;
+ external AppDll name 'xmlCreateNode';
+procedure xmlDestroyNode(node:HXML); stdcall;
+ external AppDll name 'xmlDestroyNode';
+
+function xmlParseString(const str:PWideChar; datalen:pint; const tag:PWideChar):HXML; stdcall;
+ external AppDll name 'xmlParseString';
+function xmlToString(node:HXML;datalen:pint):PWideChar; stdcall;
+ external AppDll name 'xmlToString';
+
+function xmlAddChild(parent:HXML; const name,text:PWideChar):HXML; stdcall;
+ external AppDll name 'xmlAddChild';
+procedure xmlAddChild2(child,parent:HXML); stdcall;
+ external AppDll name 'xmlAddChild2';
+function xmlCopyNode(parent:HXML):HXML; stdcall;
+ external AppDll name 'xmlCopyNode';
+function xmlGetChild(parent:HXML;number:int):HXML; stdcall;
+ external AppDll name 'xmlGetChild';
+function xmlGetChildCount(h:HXML):int; stdcall;
+ external AppDll name 'xmlGetChildCount';
+function xmlGetChildByAttrValue(parent:HXML; const name,attrName,attrValue:PWideChar):HXML; stdcall;
+ external AppDll name 'xmlGetChildByAttrValue';
+function xmlGetFirstChild(parent:HXML):HXML; stdcall;
+ external AppDll name 'xmlGetFirstChild';
+function xmlGetNthChild(parent:HXML; const name:PWideChar; i:int):HXML; stdcall;
+ external AppDll name 'xmlGetNthChild';
+function xmlGetNextChild(parent:HXML; const name:PWideChar; i:pint):HXML; stdcall;
+ external AppDll name 'xmlGetNextChild';
+function xmlGetChildByPath(parent:HXML; const path:PWideChar;createNodeIfMissing:boolean):HXML; stdcall;
+ external AppDll name 'xmlGetChildByPath';
+function xmlGetNextNode(node:HXML):HXML; stdcall;
+ external AppDll name 'xmlGetNextNode';
+function xmlGetName(h:HXML):PWideChar; stdcall;
+ external AppDll name 'xmlGetName';
+function xmlGetParent(h:HXML):HXML; stdcall;
+ external AppDll name 'xmlGetParent';
+function xmlGetText(h:HXML):PWideChar; stdcall; // = getTextByIndex(HXML, 0)
+ external AppDll name 'xmlGetText';
+procedure xmlSetText(h:HXML;value:PWideChar); stdcall; // = setTextByIndex(HXML, LPCTSTR, 0)
+ external AppDll name 'xmlSetText';
+
+function xmlGetAttr(h:HXML;i:int):PWideChar; stdcall;
+ external AppDll name 'xmlGetAttr';
+function xmlGetAttrName(h:HXML;i:int):PWideChar; stdcall;
+ external AppDll name 'xmlGetAttrName';
+function xmlGetAttrValue(h:HXML;const attrName:PWideChar):PWideChar; stdcall;
+ external AppDll name 'xmlGetAttrValue';
+function xmlGetAttrCount(h:HXML):int; stdcall;
+ external AppDll name 'xmlGetAttrCount';
+procedure xmlAddAttr(h:HXML;const attrName,attrValue:PWideChar); stdcall;
+ external AppDll name 'xmlAddAttr';
+procedure xmlAddAttrInt(h:HXML; const attrName:PWideChar;attrValue:int); stdcall;
+ external AppDll name 'xmlAddAttrInt';
+
+procedure xmlFree(arg:pointer); stdcall;
+ external AppDll name 'xmlFree';
+
+function xmlIsDeclaration(node:HXML):boolean; stdcall;
+ external AppDll name 'xmlIsDeclaration';
+function xmlToStringWithFormatting(node:HXML; var datalen:int):PWideChar; stdcall;
+ external AppDll name 'xmlToStringWithFormatting';
+function xmlDeepCopy(node:HXML):HXML; stdcall;
+ external AppDll name 'xmlDeepCopy';
+procedure xmlSetAttrByIndex(node:HXML; i:int; value:PWideChar); stdcall;
+ external AppDll name 'xmlSetAttrByIndex';
+procedure xmlSetAttrByName(node:HXML; name:PWideChar; value:PWideChar); stdcall;
+ external AppDll name 'xmlSetAttrByName';
+function xmlAddChildEx(parent:HXML; name:PWideChar; isDeclaration:boolean; n:XML_ELEMENT_POS):HXML; stdcall;
+ external AppDll name 'xmlAddChildEx';
+procedure xmlAddChildEx2(child:HXML; parent:HXML; n:XML_ELEMENT_POS); stdcall;
+ external AppDll name 'xmlAddChildEx2';
+function xmlGetTextCount(node:HXML):int; stdcall;
+ external AppDll name 'xmlGetTextCount';
+function xmlGetTextByIndex(node:HXML; i:int):PWideChar; stdcall;
+ external AppDll name 'xmlGetTextByIndex';
+procedure xmlAddText(node:HXML; txt:PWideChar; n:XML_ELEMENT_POS); stdcall;
+ external AppDll name 'xmlAddText';
+procedure xmlSetTextByIndex(node:HXML; i:int; txt:PWideChar); stdcall;
+ external AppDll name 'xmlSetTextByIndex';
+function xmlGetClearCount(node:HXML):int; stdcall;
+ external AppDll name 'xmlGetClearCount';
+function xmlGetClear(node:HXML; i:int; var openTag:PWideChar; var closeTag:PWideChar):PWideChar; stdcall;
+ external AppDll name 'xmlGetClear';
+procedure xmlAddClear(node:HXML; lpszValue:PWideChar; openTag:PWideChar; closeTag:PWideChar; n:XML_ELEMENT_POS); stdcall;
+ external AppDll name 'xmlAddClear';
+procedure xmlSetClear(node:HXML; i:int; lpszValue:PWideChar); stdcall;
+ external AppDll name 'xmlSetClear';
+function xmlGetElementCount(node:HXML):int; stdcall;
+ external AppDll name 'xmlGetElementCount';
+function xmlGetElement(node:HXML; n:XML_ELEMENT_POS; var _type:XML_ELEMENT_TYPE;
+ var child:HXML;var value:PWideChar; var name:PWideChar;
+ var openTag:PWideChar; var closeTag:PWideChar):int; stdcall;
+ external AppDll name 'xmlGetElement';
+
+procedure xmlDeleteNodeContent(node:HXML); stdcall; // forces the deletion of the content of this node and the subtree
+ external AppDll name 'xmlDeleteNodeContent';
+procedure xmlDeleteAttrByIndex(node:HXML; i:int); stdcall;
+ external AppDll name 'xmlDeleteAttrByIndex';
+procedure xmlDeleteAttrByName(node:HXML; name:PWideChar); stdcall;
+ external AppDll name 'xmlDeleteAttrByName';
+procedure xmlDeleteText(node:HXML; i:int); stdcall;
+ external AppDll name 'xmlDeleteText';
+procedure xmlDeleteClear(node:HXML; i:int); stdcall;
+ external AppDll name 'xmlDeleteClear';
+
+function xmlPositionOfChildByIndex(node:HXML; i:int):XML_ELEMENT_POS; stdcall;
+ external AppDll name 'xmlPositionOfChildByIndex';
+function xmlPositionOfChildByNode(node:HXML; node1:HXML):XML_ELEMENT_POS; stdcall;
+ external AppDll name 'xmlPositionOfChildByNode';
+function xmlPositionOfChildByName(node:HXML; name:PWideChar; i:int):XML_ELEMENT_POS; stdcall;
+ external AppDll name 'xmlPositionOfChildByName';
+function xmlPositionOfText(node:HXML; i:int):XML_ELEMENT_POS; stdcall;
+ external AppDll name 'xmlPositionOfText';
+function xmlPositionOfClear(node:HXML; i:int):XML_ELEMENT_POS; stdcall;
+ external AppDll name 'xmlPositionOfClear';
+
+function xmlParseFile(filename:PAnsiChar; datalen:pint; tag:PAnsiChar):HXML; stdcall;
+ external AppDll name 'xmlParseFile';
+function xmlToFile(node:HXML; filename:PAnsiChar; withformattiing:int):XMLError; stdcall;
+ external AppDll name 'xmlToFile';
-type
- TXML_API_A = record
- cbSize :size_t;
-
- createNode :function(const name, text:PAnsiChar; IsDeclaration:boolean):HXML;cdecl;
- destroyNode :procedure(node:HXML);cdecl;
-
- parseString :function(const str:PAnsiChar; datalen:pint; const tag:PAnsiChar):HXML;cdecl;
- toString :function(node:HXML;datalen:pint):PAnsiChar;cdecl;
-
- addChild :function(parent:HXML; const name,text:PAnsiChar):HXML;cdecl;
- addChild2 :procedure(child,parent:HXML);cdecl;
- copyNode :function(parent:HXML):HXML;cdecl;
- getChild :function(parent:HXML;number:int):HXML;cdecl;
- getChildCount :function(h:HXML):int;cdecl;
- getChildByAttrValue:function(parent:HXML; const name,attrName,attrValue:PAnsiChar):HXML;cdecl;
- getFirstChild :function(parent:HXML):HXML;cdecl;
- getNthChild :function(parent:HXML; const name:PAnsiChar; i:int):HXML;cdecl;
- getNextChild :function(parent:HXML; const name:PAnsiChar; i:pint):HXML;cdecl;
- getChildByPath :function(parent:HXML; const path:PAnsiChar;createNodeIfMissing:boolean):HXML;cdecl;
- getNextNode :function(node:HXML):HXML;cdecl;
- getName :function(h:HXML):PAnsiChar;cdecl;
- getParent :function(h:HXML):HXML;cdecl;
- getText :function(h:HXML):PAnsiChar;cdecl; // = getTextByIndex(HXML, 0)
- setText :procedure(h:HXML;value:PAnsiChar);cdecl; // = setTextByIndex(HXML, LPCTSTR, 0)
-
- getAttr :function(h:HXML;i:int):PAnsiChar;cdecl;
- getAttrName :function(h:HXML;i:int):PAnsiChar;cdecl;
- getAttrValue :function(h:HXML;const attrName:PAnsiChar):PAnsiChar;cdecl;
- getAttrCount :function(h:HXML):int;cdecl;
- addAttr :procedure(h:HXML;const attrName,attrValue:PAnsiChar);cdecl;
- addAttrInt :procedure(h:HXML; const attrName:PAnsiChar;attrValue:int);cdecl;
-
- freeMem :procedure(arg:pointer);cdecl;
-
- // #if MIRANDA_VER >= 0x0900, methods added in XML API v2
- isDeclaration :function(node:HXML):boolean;cdecl;
- toStringWithFormatting:function(node:HXML; var datalen:int):PAnsiChar;cdecl;
- deepCopy :function(node:HXML):HXML;cdecl;
- setAttrByIndex :procedure(node:HXML; i:int; value:PAnsiChar);cdecl;
- setAttrByName :procedure(node:HXML; name:PAnsiChar; value:PAnsiChar);cdecl;
- addChildEx :function(parent:HXML; name:PAnsiChar; isDeclaration:boolean;
- n:XML_ELEMENT_POS):HXML;cdecl;
- addChildEx2 :procedure(child:HXML; parent:HXML; n:XML_ELEMENT_POS);cdecl;
- getTextCount :function(node:HXML):int;cdecl;
- getTextByIndex :function(node:HXML; i:int):PAnsiChar;cdecl;
- addText :procedure(node:HXML; txt:PAnsiChar; n:XML_ELEMENT_POS);cdecl;
- setTextByIndex :procedure(node:HXML; i:int; txt:PAnsiChar);cdecl;
- getClearCount :function(node:HXML):int;cdecl;
- getClear :function(node:HXML; i:int; var openTag:PAnsiChar;
- var closeTag:PAnsiChar):PAnsiChar;cdecl;
- addClear :procedure(node:HXML; lpszValue:PAnsiChar; openTag:PAnsiChar;
- closeTag:PAnsiChar; n:XML_ELEMENT_POS);cdecl;
- setClear :procedure(node:HXML; i:int; lpszValue:PAnsiChar);cdecl;
- getElementCount :function(node:HXML):int;cdecl;
- getElement :function(node:HXML; n:XML_ELEMENT_POS; var _type:XML_ELEMENT_TYPE;
- var child:HXML;var value:PAnsiChar; var name:PAnsiChar;
- var openTag:PAnsiChar; var closeTag:PAnsiChar):int;cdecl;
- // With getElement() it's possible to enumerate all the different contents
- // (attribute,child,text, clear) of the current node. The order is reflecting the order
- // of the original file/string. NOTE: 0 <= i < getElementCount().
- // type, child, value, name, openTag, closeTag will be filled on return, depending on type:
- // for XML_ELEM_TYPE_CHILD , child is valid;
- // for XML_ELEM_TYPE_ATTRIBUTE, name and value are valid;
- // for XML_ELEM_TYPE_TEXT , value is valid;
- // for XML_ELEM_TYPE_CLEAR , value, openTag and closeTag are valid.
-
- deleteNodeContent:procedure(node:HXML);cdecl; // forces the deletion of the content of this node and the subtree
- deleteAttrByIndex:procedure(node:HXML; i:int);cdecl;
- deleteAttrByName :procedure(node:HXML; name:PAnsiChar);cdecl;
- deleteText :procedure(node:HXML; i:int);cdecl;
- deleteClear :procedure(node:HXML; i:int);cdecl;
-
- positionOfChildByIndex:function(node:HXML; i:int):XML_ELEMENT_POS;cdecl;
- positionOfChildByNode :function(node:HXML; node1:HXML):XML_ELEMENT_POS;cdecl;
- positionOfChildByName :function(node:HXML; name:PAnsiChar; i:int):XML_ELEMENT_POS;cdecl;
- positionOfText :function(node:HXML; i:int):XML_ELEMENT_POS;cdecl;
- positionOfClear :function(node:HXML; i:int):XML_ELEMENT_POS;cdecl;
-
- parseFile:function(filename:PAnsiChar; datalen:pint; tag:PAnsiChar):HXML;
- toFile :function(node:HXML; filename:PAnsiChar; withformattiing:int):XMLError;
- end;
-
- TXML_API_W = record
- cbSize :size_t;
-
- createNode :function(const name, text:PWideChar; IsDeclaration:boolean):HXML;cdecl;
- destroyNode :procedure(node:HXML);cdecl;
-
- parseString :function(const str:PWideChar; datalen:pint; const tag:PWideChar):HXML;cdecl;
- toString :function(node:HXML;datalen:pint):PWideChar;cdecl;
-
- addChild :function(parent:HXML; const name,text:PWideChar):HXML;cdecl;
- addChild2 :procedure(child,parent:HXML);cdecl;
- copyNode :function(parent:HXML):HXML;cdecl;
- getChild :function(parent:HXML;number:int):HXML;cdecl;
- getChildCount :function(h:HXML):int;cdecl;
- getChildByAttrValue:function(parent:HXML; const name,attrName,attrValue:PWideChar):HXML;cdecl;
- getFirstChild :function(parent:HXML):HXML;cdecl;
- getNthChild :function(parent:HXML; const name:PWideChar; i:int):HXML;cdecl;
- getNextChild :function(parent:HXML; const name:PWideChar; i:pint):HXML;cdecl;
- getChildByPath :function(parent:HXML; const path:PWideChar;createNodeIfMissing:boolean):HXML;cdecl;
- getNextNode :function(node:HXML):HXML;cdecl;
- getName :function(h:HXML):PWideChar;cdecl;
- getParent :function(h:HXML):HXML;cdecl;
- getText :function(h:HXML):PWideChar;cdecl; // = getTextByIndex(HXML, 0)
- setText :procedure(h:HXML;value:PWideChar);cdecl; // = setTextByIndex(HXML, LPCTSTR, 0)
-
- getAttr :function(h:HXML;i:int):PWideChar;cdecl;
- getAttrName :function(h:HXML;i:int):PWideChar;cdecl;
- getAttrValue :function(h:HXML;const attrName:PWideChar):PWideChar;cdecl;
- getAttrCount :function(h:HXML):int;cdecl;
- addAttr :procedure(h:HXML;const attrName,attrValue:PWideChar);cdecl;
- addAttrInt :procedure(h:HXML; const attrName:PWideChar;attrValue:int);cdecl;
-
- freeMem :procedure(arg:pointer);cdecl;
-
- // #if MIRANDA_VER >= 0x0900, methods added in XML API v2
- isDeclaration :function(node:HXML):boolean;cdecl;
- toStringWithFormatting:function(node:HXML; var datalen:int):PWideChar;cdecl;
- deepCopy :function(node:HXML):HXML;cdecl;
- setAttrByIndex :procedure(node:HXML; i:int; value:PWideChar);cdecl;
- setAttrByName :procedure(node:HXML; name:PWideChar; value:PWideChar);cdecl;
- addChildEx :function(parent:HXML; name:PWideChar; isDeclaration:boolean;
- n:XML_ELEMENT_POS):HXML;cdecl;
- addChildEx2 :procedure(child:HXML; parent:HXML; n:XML_ELEMENT_POS);cdecl;
- getTextCount :function(node:HXML):int;cdecl;
- getTextByIndex :function(node:HXML; i:int):PWideChar;cdecl;
- addText :procedure(node:HXML; txt:PWideChar; n:XML_ELEMENT_POS);cdecl;
- setTextByIndex :procedure(node:HXML; i:int; txt:PWideChar);cdecl;
- getClearCount :function(node:HXML):int;cdecl;
- getClear :function(node:HXML; i:int; var openTag:PWideChar;
- var closeTag:PWideChar):PWideChar;cdecl;
- addClear :procedure(node:HXML; lpszValue:PWideChar; openTag:PWideChar;
- closeTag:PWideChar; n:XML_ELEMENT_POS);cdecl;
- setClear :procedure(node:HXML; i:int; lpszValue:PWideChar);cdecl;
- getElementCount :function(node:HXML):int;cdecl;
- getElement :function(node:HXML; n:XML_ELEMENT_POS; var _type:XML_ELEMENT_TYPE;
- var child:HXML;var value:PWideChar; var name:PWideChar;
- var openTag:PWideChar; var closeTag:PWideChar):int;cdecl;
- // With getElement() it's possible to enumerate all the different contents
- // (attribute,child,text, clear) of the current node. The order is reflecting the order
- // of the original file/string. NOTE: 0 <= i < getElementCount().
- // type, child, value, name, openTag, closeTag will be filled on return, depending on type:
- // for XML_ELEM_TYPE_CHILD , child is valid;
- // for XML_ELEM_TYPE_ATTRIBUTE, name and value are valid;
- // for XML_ELEM_TYPE_TEXT , value is valid;
- // for XML_ELEM_TYPE_CLEAR , value, openTag and closeTag are valid.
-
- deleteNodeContent:procedure(node:HXML);cdecl; // forces the deletion of the content of this node and the subtree
- deleteAttrByIndex:procedure(node:HXML; i:int);cdecl;
- deleteAttrByName :procedure(node:HXML; name:PWideChar);cdecl;
- deleteText :procedure(node:HXML; i:int);cdecl;
- deleteClear :procedure(node:HXML; i:int);cdecl;
-
- positionOfChildByIndex:function(node:HXML; i:int):XML_ELEMENT_POS;cdecl;
- positionOfChildByNode :function(node:HXML; node1:HXML):XML_ELEMENT_POS;cdecl;
- positionOfChildByName :function(node:HXML; name:PWideChar; i:int):XML_ELEMENT_POS;cdecl;
- positionOfText :function(node:HXML; i:int):XML_ELEMENT_POS;cdecl;
- positionOfClear :function(node:HXML; i:int):XML_ELEMENT_POS;cdecl;
-
- parseFile:function(filename:PAnsiChar; datalen:pint; tag:PAnsiChar):HXML;
- toFile :function(node:HXML; filename:PAnsiChar; withformattiing:int):XMLError;
- end;
-
-// every protocol should declare this variable to use the XML API
-//const
-// extern XML_API xi;
-
-const
-{
-a service to obtain the XML API
-
-wParam = 0;
-lParam = (LPARAM)(XML_API*).
-
-returns TRUE if all is Ok, and FALSE otherwise
-}
- MS_SYSTEM_GET_XI:PAnsiChar = 'Miranda/System/GetXmlApi';
-(*
-__forceinline int mir_getXI( XML_API* dest )
-{
- dest->cbSize = sizeof(*dest);
- return CallService( MS_SYSTEM_GET_XI, 0, (LPARAM)dest );
-}
-*)
{$ENDIF}
diff --git a/include/m_xml.h b/include/m_xml.h index 7591dab73b..f8277aef15 100644 --- a/include/m_xml.h +++ b/include/m_xml.h @@ -26,22 +26,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define M_XML_H__
#include <tchar.h>
-#include <newpluginapi.h>
+#include <m_core.h>
DECLARE_HANDLE(HXML);
typedef int XML_ELEMENT_POS; // XML_ELEMENT_POS is not interchangeable with simple indexes
-typedef enum
+enum XML_ELEMENT_TYPE
{
XML_ELEM_TYPE_CHILD = 0,
XML_ELEM_TYPE_ATTRIBUTE = 1,
XML_ELEM_TYPE_TEXT = 2,
XML_ELEM_TYPE_CLEAR = 3,
-}
- XML_ELEMENT_TYPE;
+};
/// Enumeration for XML parse errors.
-typedef enum XMLError
+enum XMLError
{
eXMLErrorNone = 0,
eXMLErrorMissingEndTag,
@@ -65,105 +64,71 @@ typedef enum XMLError eXMLErrorBase64DecodeIllegalCharacter,
eXMLErrorBase64DecodeTruncatedData,
eXMLErrorBase64DecodeBufferTooSmall
-} XMLError;
-
-typedef struct
-{
- size_t cbSize;
-
- HXML (*createNode)(LPCTSTR name, LPCTSTR text, char isDeclaration);
- void (*destroyNode)(HXML node);
-
- HXML (*parseString)(LPCTSTR string, int* datalen, LPCTSTR tag);
- LPTSTR (*toString)(HXML node, int* datalen);
-
- HXML (*addChild)(HXML parent, LPCTSTR name, LPCTSTR text);
- void (*addChild2)(HXML child, HXML parent);
- HXML (*copyNode)(HXML parent);
- HXML (*getChild)(HXML parent, int number);
- int (*getChildCount)(HXML);
- HXML (*getChildByAttrValue)(HXML parent, LPCTSTR name, LPCTSTR attrName, LPCTSTR attrValue);
- HXML (*getFirstChild)(HXML parent);
- HXML (*getNthChild)(HXML parent, LPCTSTR name, int i);
- HXML (*getNextChild)(HXML parent, LPCTSTR name, int *i);
- HXML (*getChildByPath)(HXML parent, LPCTSTR path, char createNodeIfMissing);
- HXML (*getNextNode)(HXML node);
- LPCTSTR (*getName)(HXML);
- HXML (*getParent)(HXML);
- LPCTSTR (*getText)(HXML); //=getTextByIndex(HXML, 0)
- void (*setText)(HXML, LPCTSTR); //=setTextByIndex(HXML, LPCTSTR, 0)
-
- LPCTSTR (*getAttr)(HXML, int i);
- LPCTSTR (*getAttrName)(HXML, int i);
- LPCTSTR (*getAttrValue)(HXML, LPCTSTR attrName);
- int (*getAttrCount)(HXML);
- void (*addAttr)(HXML, LPCTSTR attrName, LPCTSTR attrValue);
- void (*addAttrInt)(HXML, LPCTSTR attrName, int attrValue);
-
- void (*freeMem)(void*);
-
- // methods added in XML API v2
- char (*isDeclaration)(HXML);
- LPTSTR (*toStringWithFormatting)(HXML node, int* datalen);
- HXML (*deepCopy)(HXML);
- void (*setAttrByIndex)(HXML, int i, LPCTSTR value);
- void (*setAttrByName)(HXML, LPCTSTR name, LPCTSTR value);
- HXML (*addChildEx)(HXML parent, LPCTSTR name, char isDeclaration, XML_ELEMENT_POS n);
- void (*addChildEx2)(HXML child, HXML parent, XML_ELEMENT_POS n);
- int (*getTextCount)(HXML);
- LPCTSTR (*getTextByIndex)(HXML, int i);
- void (*addText)(HXML, LPCTSTR, XML_ELEMENT_POS n);
- void (*setTextByIndex)(HXML, int i, LPCTSTR);
- int (*getClearCount)(HXML);
- LPCTSTR (*getClear)(HXML, int i, LPCTSTR *openTag, LPCTSTR *closeTag);
- void (*addClear)(HXML, LPCTSTR lpszValue, LPCTSTR openTag, LPCTSTR closeTag, XML_ELEMENT_POS n);
- void (*setClear)(HXML, int i, LPCTSTR lpszValue);
- int (*getElementCount)(HXML);
- int (*getElement)(HXML, XML_ELEMENT_POS n, XML_ELEMENT_TYPE *type, HXML *child, LPCTSTR *value, LPCTSTR *name, LPCTSTR *openTag, LPCTSTR *closeTag);
- // With getElement() it's possible to enumerate all the different contents (attribute, child, text, clear) of the current node. The order is reflecting the order of the original file/string. NOTE: 0 <= i < getElementCount().
- // type, child, value, name, openTag, closeTag will be filled on return, depending on type:
- // for XML_ELEM_TYPE_CHILD, child is valid;
- // for XML_ELEM_TYPE_ATTRIBUTE, name and value are valid;
- // for XML_ELEM_TYPE_TEXT, value is valid;
- // for XML_ELEM_TYPE_CLEAR, value, openTag and closeTag are valid.
-
- void (*deleteNodeContent)(HXML); // forces the deletion of the content of this node and the subtree
- void (*deleteAttrByIndex)(HXML, int i);
- void (*deleteAttrByName)(HXML, LPCTSTR name);
- void (*deleteText)(HXML, int i);
- void (*deleteClear)(HXML, int i);
-
- XML_ELEMENT_POS (*positionOfChildByIndex)(HXML, int i);
- XML_ELEMENT_POS (*positionOfChildByNode)(HXML, HXML);
- XML_ELEMENT_POS (*positionOfChildByName)(HXML, LPCTSTR name, int i);
- XML_ELEMENT_POS (*positionOfText)(HXML, int i);
- XML_ELEMENT_POS (*positionOfClear)(HXML, int i);
-
- HXML (*parseFile)(LPCTSTR filename, int* datalen, LPCTSTR tag);
- XMLError (*toFile)(HXML node, LPCTSTR filename, int withformattiing);
-}
- XML_API;
-
-#define XML_API_SIZEOF_V1 (sizeof(size_t)+26*sizeof(void*))
-
-/* every protocol should declare this variable to use the XML API */
-extern XML_API xi;
-
-/*
-a service to obtain the XML API
-
-wParam = 0;
-lParam = (LPARAM)(XML_API*).
-
-returns TRUE if all is Ok, and FALSE otherwise
-*/
-
-#define MS_SYSTEM_GET_XI "Miranda/System/GetXmlApi"
-
-__forceinline int mir_getXI(XML_API* dest)
-{
- dest->cbSize = sizeof(*dest);
- return CallService(MS_SYSTEM_GET_XI, 0, (LPARAM)dest);
-}
+};
+
+EXTERN_C MIR_APP_DLL(HXML) xmlCreateNode(LPCTSTR name, LPCTSTR text, char isDeclaration);
+EXTERN_C MIR_APP_DLL(void) xmlDestroyNode(HXML node);
+
+EXTERN_C MIR_APP_DLL(HXML) xmlParseString(LPCTSTR string, int *datalen, LPCTSTR tag);
+EXTERN_C MIR_APP_DLL(LPTSTR) xmlToString(HXML node, int *datalen);
+
+EXTERN_C MIR_APP_DLL(HXML) xmlAddChild(HXML parent, LPCTSTR name, LPCTSTR text);
+EXTERN_C MIR_APP_DLL(void) xmlAddChild2(HXML child, HXML parent);
+EXTERN_C MIR_APP_DLL(HXML) xmlCopyNode(HXML parent);
+EXTERN_C MIR_APP_DLL(HXML) xmlGetChild(HXML parent, int number);
+EXTERN_C MIR_APP_DLL(int) xmlGetChildCount(HXML);
+EXTERN_C MIR_APP_DLL(HXML) xmlGetChildByAttrValue(HXML parent, LPCTSTR name, LPCTSTR attrName, LPCTSTR attrValue);
+EXTERN_C MIR_APP_DLL(HXML) xmlGetFirstChild(HXML parent);
+EXTERN_C MIR_APP_DLL(HXML) xmlGetNthChild(HXML parent, LPCTSTR name, int i);
+EXTERN_C MIR_APP_DLL(HXML) xmlGetNextChild(HXML parent, LPCTSTR name, int *i);
+EXTERN_C MIR_APP_DLL(HXML) xmlGetChildByPath(HXML parent, LPCTSTR path, char createNodeIfMissing);
+EXTERN_C MIR_APP_DLL(HXML) xmlGetNextNode(HXML node);
+EXTERN_C MIR_APP_DLL(LPCTSTR) xmlGetName(HXML);
+EXTERN_C MIR_APP_DLL(HXML) xmlGetParent(HXML);
+EXTERN_C MIR_APP_DLL(LPCTSTR) xmlGetText(HXML);
+EXTERN_C MIR_APP_DLL(void) xmlSetText(HXML, LPCTSTR);
+
+EXTERN_C MIR_APP_DLL(LPCTSTR) xmlGetAttr(HXML, int i);
+EXTERN_C MIR_APP_DLL(LPCTSTR) xmlGetAttrName(HXML, int i);
+EXTERN_C MIR_APP_DLL(LPCTSTR) xmlGetAttrValue(HXML, LPCTSTR attrName);
+EXTERN_C MIR_APP_DLL(int) xmlGetAttrCount(HXML);
+EXTERN_C MIR_APP_DLL(void) xmlAddAttr(HXML, LPCTSTR attrName, LPCTSTR attrValue);
+EXTERN_C MIR_APP_DLL(void) xmlAddAttrInt(HXML, LPCTSTR attrName, int attrValue);
+
+EXTERN_C MIR_APP_DLL(void) xmlFree(void*);
+
+// methods added in xml API v2
+EXTERN_C MIR_APP_DLL(char) xmlIsDeclaration(HXML);
+EXTERN_C MIR_APP_DLL(LPTSTR) xmlToStringWithFormatting(HXML node, int* datalen);
+EXTERN_C MIR_APP_DLL(HXML) xmlDeepCopy(HXML);
+EXTERN_C MIR_APP_DLL(void) xmlSetAttrByIndex(HXML, int i, LPCTSTR value);
+EXTERN_C MIR_APP_DLL(void) xmlSetAttrByName(HXML, LPCTSTR name, LPCTSTR value);
+EXTERN_C MIR_APP_DLL(HXML) xmlAddChildEx(HXML parent, LPCTSTR name, char isDeclaration, XML_ELEMENT_POS n);
+EXTERN_C MIR_APP_DLL(void) xmlAddChildEx2(HXML child, HXML parent, XML_ELEMENT_POS n);
+EXTERN_C MIR_APP_DLL(int) xmlGetTextCount(HXML);
+EXTERN_C MIR_APP_DLL(LPCTSTR) xmlGetTextByIndex(HXML, int i);
+EXTERN_C MIR_APP_DLL(void) xmlAddText(HXML, LPCTSTR, XML_ELEMENT_POS n);
+EXTERN_C MIR_APP_DLL(void) xmlSetTextByIndex(HXML, int i, LPCTSTR);
+EXTERN_C MIR_APP_DLL(int) xmlGetClearCount(HXML);
+EXTERN_C MIR_APP_DLL(LPCTSTR) xmlGetClear(HXML, int i, LPCTSTR *openTag, LPCTSTR *closeTag);
+EXTERN_C MIR_APP_DLL(void) xmlAddClear(HXML, LPCTSTR lpszValue, LPCTSTR openTag, LPCTSTR closeTag, XML_ELEMENT_POS n);
+EXTERN_C MIR_APP_DLL(void) xmlSetClear(HXML, int i, LPCTSTR lpszValue);
+EXTERN_C MIR_APP_DLL(int) xmlGetElementCount(HXML);
+EXTERN_C MIR_APP_DLL(int) xmlGetElement(HXML, XML_ELEMENT_POS n, XML_ELEMENT_TYPE *type, HXML *child, LPCTSTR *value, LPCTSTR *name, LPCTSTR *openTag, LPCTSTR *closeTag);
+
+EXTERN_C MIR_APP_DLL(void) xmlDeleteNodeContent(HXML); // forces the deletion of the content of this node and the subtree
+EXTERN_C MIR_APP_DLL(void) xmlDeleteAttrByIndex(HXML, int i);
+EXTERN_C MIR_APP_DLL(void) xmlDeleteAttrByName(HXML, LPCTSTR name);
+EXTERN_C MIR_APP_DLL(void) xmlDeleteText(HXML, int i);
+EXTERN_C MIR_APP_DLL(void) xmlDeleteClear(HXML, int i);
+
+EXTERN_C MIR_APP_DLL(HXML) xmlParseFile(LPCTSTR filename, int *datalen, LPCTSTR tag);
+EXTERN_C MIR_APP_DLL(XMLError) xmlToFile(HXML node, LPCTSTR filename, int withformattiing);
+
+EXTERN_C MIR_APP_DLL(XML_ELEMENT_POS) xmlPositionOfChildByIndex(HXML, int i);
+EXTERN_C MIR_APP_DLL(XML_ELEMENT_POS) xmlPositionOfChildByNode(HXML, HXML);
+EXTERN_C MIR_APP_DLL(XML_ELEMENT_POS) xmlPositionOfChildByName(HXML, LPCTSTR name, int i);
+EXTERN_C MIR_APP_DLL(XML_ELEMENT_POS) xmlPositionOfText(HXML, int i);
+EXTERN_C MIR_APP_DLL(XML_ELEMENT_POS) xmlPositionOfClear(HXML, int i);
#endif // M_XML_H__
|