|
// CSS class created by Yarin Licht, 2008.
#include "css.h"
BOOL CSS::newdoc()
{
open = FALSE;
dw = 1000;
psz = new char[dw];
if(!psz) return FALSE;
psz[0] = 0;
return TRUE;
}
void CSS::deldoc()
{
delete [] psz;
dw = 0;
open = FALSE;
return;
}
BOOL CSS::div(char *arga = 0)
{
if(arga)
{
if(open)
strcat(psz, "}\r\n");
if(psz[0] != 0) strcat(psz, "\r\n");
strcat(psz, arga);
strcat(psz, " {\r\n");
open = TRUE;
}
else
{
if(!open) return FALSE;
strcat(psz, "}\r\n");
open = FALSE;
}
if(!extmem(1000, dw - 100)) return FALSE;
return TRUE;
}
BOOL CSS::tag(char *arga, char *argb)
{
if(!open || !arga || !argb) return FALSE;
strcat(psz, "\t");
strcat(psz, arga);
strcat(psz, ": ");
strcat(psz, argb);
strcat(psz, ";\r\n");
if(!extmem(1000, dw - 100)) return FALSE;
return TRUE;
}
BOOL CSS::extmem(DWORD arga, DWORD argb = 0)
{
if(strlen(psz) < argb) return TRUE;
char *newpsz = new char[dw + arga];
if(!newpsz) return FALSE;
dw += arga;
newpsz[0] = 0;
strcpy(newpsz, psz);
delete [] psz;
psz = newpsz;
return TRUE;
}
char *CSS::text()
{
return psz;
}
// End of file.
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.