summaryrefslogtreecommitdiff
path: root/xml/type.c
blob: 2c5bc0f4937c661457aaa86ba886985f3d53e0b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
 *  $Id: type.c,v 1.4 2004/12/17 19:56:16 lordjaxom Exp $
 */

#include "xml/type.h"
#include "xml/function.h"
#include <stdio.h>

cxType cxType::False(false);
cxType cxType::True(true);

const std::string &cxType::String(void) {
	if (mType == number) {
		char *buffer;
		asprintf(&buffer, "%d", mNumber);
		mString = buffer;
		mType = string;
		free(buffer);
	} else if (mType == boolean) {
		mString = mNumber ? cxFunction::True : cxFunction::False;
		mType = string;
	}
	return mString;
}