|
Aegis
4.25.D505
|
00001 // 00002 // aegis - project change supervisor 00003 // Copyright (C) 1995, 1998, 1999, 2004-2006, 2008, 2012 Peter Miller 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 3 of the License, or (at 00008 // your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 // 00018 00019 #ifndef COMMON_WSTR_H 00020 #define COMMON_WSTR_H 00021 00022 #include <common/ac/stddef.h> 00023 #include <common/ac/stdlib.h> 00024 #include <common/debug.h> 00025 00032 typedef unsigned long wstr_hash_ty; 00033 00034 struct wstring_ty 00035 { 00036 wstr_hash_ty wstr_hash; 00037 wstring_ty *wstr_next; 00038 long wstr_references; 00039 size_t wstr_length; 00040 wchar_t wstr_text[1]; 00041 }; 00042 00043 #define wstr_n_from_c_release() wstr_n_from_c((const char *)0, 0) 00044 00045 void wstr_release(void); 00046 wstring_ty *wstr_from_c(const char *); 00047 wstring_ty *wstr_from_wc(const wchar_t *); 00048 wstring_ty *wstr_n_from_c(const char *, size_t); 00049 wstring_ty *wstr_n_from_wc(const wchar_t *, size_t); 00050 wstring_ty *wstr_copy(wstring_ty *); 00051 void wstr_free(wstring_ty *); 00052 wstring_ty *wstr_catenate(const wstring_ty *, const wstring_ty *); 00053 wstring_ty *wstr_cat_three(const wstring_ty *, const wstring_ty *, 00054 const wstring_ty *); 00055 wstring_ty *wstr_to_upper(const wstring_ty *); 00056 wstring_ty *wstr_to_lower(const wstring_ty *); 00057 wstring_ty *wstr_capitalize(const wstring_ty *); 00058 wstring_ty *wstr_to_ident(const wstring_ty *); 00059 void wstr_to_mbs(const wstring_ty *, char **, size_t *); 00060 int wstr_equal(const wstring_ty *, const wstring_ty *); 00061 00062 #ifndef DEBUG 00063 #define wstr_equal(s1, s2) ((s1) == (s2)) 00064 #endif 00065 00066 struct string_ty; 00067 struct string_ty *wstr_to_str(const wstring_ty *); 00068 wstring_ty *str_to_wstr(const struct string_ty *); 00069 00070 wstring_ty *wstr_quote_shell(wstring_ty *); 00071 int wstr_column_width(wstring_ty *); 00072 00074 #endif // COMMON_WSTR_H 00075 // vim: set ts=8 sw=4 et :
1.7.6.1