summaryrefslogtreecommitdiff
path: root/libodbcpp/ustring.cpp
blob: dd8ee3b8406ad8babbd13b35d4a4da2f0983b140 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <stdarg.h>
#include <stdio.h>
#include "ustring.h"

ODBC::String::String()
{
}
ODBC::String::String(std::basic_string<unsigned char> s) :
	std::basic_string<unsigned char>(s)
{
}
ODBC::String::String(std::basic_string<char> s) :
	std::basic_string<unsigned char>((unsigned char *)s.c_str())
{
}
ODBC::String::String(const char * s) :
	std::basic_string<unsigned char>((unsigned char *)s)
{
}
ODBC::String::String(const unsigned char * s) :
	std::basic_string<unsigned char>(s)
{
}

ODBC::String::operator unsigned char * () const
{
	return (unsigned char*)c_str();
}

ODBC::String
ODBC::String::Format(const char * fmt, ...)
{
	char * buf;
	va_list va;
	va_start(va, fmt);
	if (vasprintf(&buf, fmt, va)) {
		buf = NULL;
	}
	va_end(va);
	return buf;
}