File: Convert.h

package info (click to toggle)
storm-lang 0.7.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 52,028 kB
  • sloc: ansic: 261,471; cpp: 140,432; sh: 14,891; perl: 9,846; python: 2,525; lisp: 2,504; asm: 860; makefile: 678; pascal: 70; java: 52; xml: 37; awk: 12
file content (39 lines) | stat: -rw-r--r-- 1,662 bytes parent folder | download | duplicates (2)
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
#pragma once
#include "GcArray.h"

namespace storm {
	STORM_PKG(core);

	/**
	 * Converting to/from various encodings.
	 *
	 * All functions named 'convert' read from a null-terminated string and outputs the encoded data
	 * to 'to' until a maximum of 'maxCount' characters have been emitted (including the null
	 * character). The number of filled entries is returned, including the terminating null character.
	 * Note that encoding might be invalid if the convert functions run out of space.
	 */

	// Convert from 'char' to 'wchar'.
	size_t convert(const char *from, wchar *to, size_t maxCount);
	size_t convert(const char *from, size_t fromCount, wchar *to, size_t maxCount);
	size_t convert(const char *from, size_t fromCount, wchar *to, size_t maxCount, bool nullTerminate);
	GcArray<wchar> *toWChar(Engine &e, const char *from);
	GcArray<wchar> *toWChar(Engine &e, const char *from, size_t fromCount);
	GcArray<wchar> *toWCharNoNull(Engine &e, const char *from, size_t fromCount);

	// Convert from 'wchar' to 'char'.
	size_t convert(const wchar *from, char *to, size_t maxCount);
	size_t convert(const wchar *from, size_t fromCount, char *to, size_t maxCount);
	size_t convert(const wchar *from, size_t fromCount, char *to, size_t maxCount, bool nullTerminate);
	GcArray<char> *toChar(Engine &e, const wchar *from);
	GcArray<char> *toChar(Engine &e, const wchar *from, size_t fromCount);
	GcArray<char> *toCharNoNull(Engine &e, const wchar *from, size_t fromCount);

#ifdef POSIX

	// Convert from 'wchar_t' to 'wchar'
	size_t convert(const wchar_t *from, wchar *to, size_t maxCount);
	GcArray<wchar> *toWChar(Engine &e, const wchar_t *from);

#endif
}