gambas-source-code/gb.xml/src/CTextNode.cpp

91 lines
1.8 KiB
C++
Raw Normal View History

[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
#include "textnode.h"
#include "CTextNode.h"
/*========== TextNode */
#undef THIS
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
#define THIS (static_cast<CTextNode*>(_object)->node)
BEGIN_METHOD(CTextNode_new, GB_STRING content)
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
if(Node::NoInstanciate) return;
if(!THIS)
{
THIS = new TextNode;
static_cast<CNode*>(_object)->node = THIS;
}
if(!MISSING(content)) THIS->content = new fwstring(STRING(content));
//else THIS->content = new fwstring();
END_METHOD
BEGIN_METHOD_VOID(CTextNode_free)
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
delete THIS;
END_METHOD
GB_DESC CTextNodeDesc[] =
{
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
GB_DECLARE("XmlTextNode", sizeof(CTextNode)), GB_INHERITS("XmlNode"),
GB_METHOD("_new", "", CTextNode_new, "[(Content)s]"),
GB_METHOD("_free", "", CTextNode_free, ""),
GB_END_DECLARE
};
/*========== CommentNode */
#undef THIS
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
#define THIS (static_cast<CCommentNode*>(_object)->node)
BEGIN_METHOD_VOID(CCommentNode_new)
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
if(Node::NoInstanciate) return;
THIS = new CommentNode;
static_cast<CTextNode*>(_object)->node = THIS;
static_cast<CNode*>(_object)->node = THIS;
END_METHOD
BEGIN_METHOD_VOID(CCommentNode_free)
END_METHOD
GB_DESC CCommentNodeDesc[] =
{
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
GB_DECLARE("XmlCommentNode", sizeof(CCommentNode)),GB_INHERITS("XmlTextNode"),
GB_METHOD("_new", "", CCommentNode_new, ""),
GB_METHOD("_free", "", CCommentNode_free, ""),
GB_END_DECLARE
};
/*========== CDATANode */
#undef THIS
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
#define THIS (static_cast<CCDATANode*>(_object)->node)
BEGIN_METHOD_VOID(CCDATANode_new)
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
THIS = new CDATANode;
static_cast<CTextNode*>(_object)->node = THIS;
static_cast<CNode*>(_object)->node = THIS;
END_METHOD
BEGIN_METHOD_VOID(CCDATANode_free)
END_METHOD
GB_DESC CCDATANodeDesc[] =
{
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
GB_DECLARE("XmlCDATANode", sizeof(CCDATANode)),GB_INHERITS("XmlTextNode"),
GB_METHOD("_new", "", CCDATANode_new, ""),
GB_METHOD("_free", "", CCDATANode_free, ""),
GB_END_DECLARE
};