added simple utf8 functions

This commit is contained in:
2011-11-08 13:36:47 +00:00
parent 10b0469ee1
commit f2615f05a5
6 changed files with 252 additions and 14 deletions

View File

@ -28,6 +28,7 @@ pkginclude_HEADERS = \
time.h \
tio.h \
tre.h \
utf8.h \
xma.h
if ENABLE_CXX

View File

@ -54,7 +54,7 @@ DIST_SOURCES =
am__pkginclude_HEADERS_DIST = alg.h chr.h dll.h env.h fio.h fma.h \
fmt.h gdl.h htb.h lda.h main.h map.h mem.h oht.h opt.h path.h \
pio.h pma.h rbt.h rex.h sio.h sll.h stdio.h str.h time.h tio.h \
tre.h xma.h Mmgr.hpp StdMmgr.hpp Mmged.hpp
tre.h utf8.h xma.h Mmgr.hpp StdMmgr.hpp Mmged.hpp
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@ -225,8 +225,8 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
pkginclude_HEADERS = alg.h chr.h dll.h env.h fio.h fma.h fmt.h gdl.h \
htb.h lda.h main.h map.h mem.h oht.h opt.h path.h pio.h pma.h \
rbt.h rex.h sio.h sll.h stdio.h str.h time.h tio.h tre.h xma.h \
$(am__append_1)
rbt.h rex.h sio.h sll.h stdio.h str.h time.h tio.h tre.h \
utf8.h xma.h $(am__append_1)
all: all-am
.SUFFIXES:

View File

@ -0,0 +1,66 @@
/*
* $Id$
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
QSE is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
QSE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _QSE_CMN_UTF8_H_
#define _QSE_CMN_UTF8_H_
#include <qse/types.h>
#include <qse/macros.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* The qse_uctoutf8len() function returns the number bytes in the utf8 sequence
* that would result from the original unicode character.
* @return
* - 0 is returned if @a uc is invalid.
* - A positive integer is returned in all other cases.
*/
int qse_uctoutf8len (
qse_wchar_t uc
);
/**
* The qse_uctoutf8() function converts a unicode character to a utf8 sequence.
* @return
* - 0 is returned if @a uc is invalid.
* - A negative integer is returned if the utf8 sequence buffer is not
* large enough. It is the negated buffer size required.
* - A positive integer is returned in all other cases.
*/
int qse_uctoutf8 (
qse_wchar_t uc,
qse_mchar_t* utf8,
int size
);
int qse_utf8touc (
const qse_mchar_t* utf8,
int size,
qse_wchar_t* uc
);
#ifdef __cplusplus
}
#endif
#endif