diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-05-11 07:51:40 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-05-11 07:51:40 +0000 |
commit | 033c41ed57348abb3a418166b1fb39bfad3312de (patch) | |
tree | 72edbb0b7ff35ef35e4d533bca384b4f7c986942 /src/xmldocument.h | |
parent | ad92dc50b7cdf7cfe086f21d19442d03a90fd05d (diff) | |
download | libbu++-033c41ed57348abb3a418166b1fb39bfad3312de.tar.gz libbu++-033c41ed57348abb3a418166b1fb39bfad3312de.tar.bz2 libbu++-033c41ed57348abb3a418166b1fb39bfad3312de.tar.xz libbu++-033c41ed57348abb3a418166b1fb39bfad3312de.zip |
Added a list template class, seems to work pretty well for now, I may have
forgotten proper cleanup in the deconstructor, but besides that you can do
almost everything you need. I'll make a slist/stack next, probably with the
same basic code, just a different structure (not doubley-linked).
The xml system from old-libbu++ is almost completely converted, I was going to
re-write it, but this seemed easier at first, it may not have been, we'll see.
It almost parses everything again, and almost outputs again, and it does use
streams now.
The FString is partway to doing minimum chunk allocations, so that adding
single-characters will be really fast up to the minimum chunk size. I also
figured out how to add this optimization without any extra variables taking
up space, and it's optional in the template, which is cool. You can specify
the size of the blocks (default 256 bytes), if it's 0 then they'll be like the
old FString, 1 chunk per operation.
The next FString update should be allowing efficient removal from the begining
of the string by faking it, and simply moving a secondary base pointer ahead,
and then optimizing appends after that fact to simply move the existing data
around if you shouldn't have to re-allocate (alla FlexBuf). The final fun
addition that I'm planning is a simple switch in the template (boolean) that
will switch an FString into a thread-safe mode without changing the interface
or anything that you can do with them at all. It may increasing memory usage,
but they should still be better than std::strings, and totally thread-safe.
The best part of that is that if it's done with a boolean template parameter and
if statements that only test that parameter controlling flow, the code that you
don't want (threadsafe/non-threadsafe) won't be included at all
post-optimization.
Diffstat (limited to 'src/xmldocument.h')
-rw-r--r-- | src/xmldocument.h | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/src/xmldocument.h b/src/xmldocument.h index 6671c41..e0c36eb 100644 --- a/src/xmldocument.h +++ b/src/xmldocument.h | |||
@@ -39,13 +39,7 @@ public: | |||
39 | * the node and setting the content and name. If this is set to true the | 39 | * the node and setting the content and name. If this is set to true the |
40 | * node is appended, but the context node doesn't change. | 40 | * node is appended, but the context node doesn't change. |
41 | */ | 41 | */ |
42 | void addNode( const char *sName=NULL, const char *sContent=NULL, bool bClose=false ); | 42 | void addNode( const Bu::FString &sName ); |
43 | |||
44 | /** | ||
45 | * Set the name of the current node context. | ||
46 | *@param sName The new name of the node. | ||
47 | */ | ||
48 | void setName( const char *sName ); | ||
49 | 43 | ||
50 | /** | 44 | /** |
51 | * Close the current node context. This will move the current context to | 45 | * Close the current node context. This will move the current context to |