Scratch that previous email!
if (buf[buf.length()-2] == '/')
doh!
What do I do with this?
if (*((*buf)-1) == '/')
Terry,
I would guess:
if (buf[buf.length()] == '/')
note: length() will return the -1 position in a 0 based array.
I'm working on thmlhtmlhref
On Thu, 2003-02-20 at 02:46, Troy A. Griffitts wrote:
Hey guys. I just added the new SWBuf class to the API and now need
help integrating it throughout.
CURRENT CVS IS BROKEN AND WON'T WORK TILL THIS IS DONE.
I was going to do it all myself, but realized that we have nearly 50
filters now!
SO, if you have cvs write access, please post a note claiming a few
filter that you are working on so we don't overlap our work.
Here is the gist...
SWBuf works pretty much like string, except that it can operate on
buffers that aren't null terminated, as well.
Have a look at tests/swbuftest.cpp and include/swbuf.h
Up until yesterday there was a FILTER_PAD define that basically told
us how much to guess at allocating a buffer to be sure we had enough
space for filter to do their job. The filters used to take a char *.
Now, FILTER_PAD is gone (hurray!) and we're passing SWBuf & in place
of char * to the filters.
Headers have been changed to reflect the new sigs, but the .cpp files
have not.
swbasicfilter.cpp and gbfhtml.cpp are done.
Quick help:
-char Filter::ProcessText(char *text, int maxlen, const SWKey *key,
- const SWModule *module)
+char Filter::processText(SWBuf &text, const SWKey *key,
+ const SWModule *module)
- pushString(buf, "whatever");
+ buf += "whatever";
- *(*buf)++ = 'x';
+ buf += 'x';
- pushString(buf, "%d %s", 4, "cows");
+ buf.appendFormatted("%d %s", 4, "cows");
- char *to, *from;
- len = strlen(text) + 1;
- // shift string to right of buffer
- if (len < maxlen) {
- memmove(&text[maxlen - len], text, len);
- from = (unsigned char *)&text[maxlen - len];
- }
- else from = (unsigned char *)text;
- for (to = (unsigned char *)text; *from; from++) {
+ const char *from;
+ SWBuf orig = text;
+ from = orig.c_str();
+ for (text = ""; *from; from++) {
_______________________________________
Thanks for considering helping on this one!
In His Grace,
-Troy.
_______________________________________________
sword-devel mailing list
[EMAIL PROTECTED]
http://www.crosswire.org/mailman/listinfo/sword-devel
_______________________________________________
sword-devel mailing list
[EMAIL PROTECTED]
http://www.crosswire.org/mailman/listinfo/sword-devel
_______________________________________________
sword-devel mailing list
[EMAIL PROTECTED]
http://www.crosswire.org/mailman/listinfo/sword-devel