This is Webservice SDK for mbed. LPCXpresso1769/LPC1768/FRDM-K64F/LPC4088
Dependents: MbedFileServer_1768MiniDK2 RedWireBridge IssueDebug_gcc MiMicRemoteMCU-for-Mbed ... more
NyLPC_cStr.h
00001 /********************************************************************************* 00002 * PROJECT: MiMic 00003 * -------------------------------------------------------------------------------- 00004 * 00005 * This file is part of MiMic 00006 * Copyright (C)2011 Ryo Iizuka 00007 * 00008 * MiMic is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published 00010 * by the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00020 * 00021 * For further information please contact. 00022 * http://nyatla.jp/ 00023 * <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp> 00024 * 00025 *********************************************************************************/ 00026 #ifndef NYLPC_CSTR_H_ 00027 #define NYLPC_CSTR_H_ 00028 00029 #include "NyLPC_stdlib.h" 00030 /********************************************************************** 00031 * 00032 * NyLPC_TcStr class 00033 * 00034 **********************************************************************/ 00035 #ifdef __cplusplus 00036 extern "C" { 00037 #endif /* __cplusplus */ 00038 00039 /** 00040 * 長さ付き文字列を定義します。 00041 */ 00042 typedef struct NyLPC_TcStr NyLPC_TcStr_t; 00043 00044 struct NyLPC_TcStr 00045 { 00046 NyLPC_TInt16 s;//バッファサイズ 00047 NyLPC_TInt16 l;//現在の文字列長 00048 void* buf; 00049 }; 00050 00051 /** 00052 バッファをNyLPC_cStr_tに初期化して、キャストして返します。 00053 */ 00054 void NyLPC_cStr_initialize(NyLPC_TcStr_t* i_inst,void* i_buf,int sizeof_buf); 00055 00056 #define NyLPC_cStr_finalize(i) 00057 00058 /** 00059 * 文字をバッファへ追加します。 00060 * @return 00061 * TRUE 追加に成功;FALSE 追加に失敗 00062 */ 00063 NyLPC_TBool NyLPC_cStr_put(NyLPC_TcStr_t* i_inst,NyLPC_TChar i_c); 00064 00065 /** 00066 * 残容量を返します。 00067 * @return 00068 * バイト単位のバッファの残り容量 00069 */ 00070 #define NyLPC_cStr_capacity(i_inst) ((i_inst)->s-(i_inst)->l) 00071 00072 /** 00073 現在の長さを返します。 00074 */ 00075 #define NyLPC_cStr_len(i_inst) ((i_inst)->l) 00076 /** 00077 * 文字列ポインタを返します。 00078 */ 00079 #define NyLPC_cStr_str(i_inst) ((NyLPC_TChar*)((i_inst)->buf)) 00080 /** 00081 文字列長さをリセットします。 00082 */ 00083 #define NyLPC_cStr_clear(i_inst) (i_inst)->l=0 00084 /** 00085 * NULL terminated文字列が同一か返します。 00086 */ 00087 #define NyLPC_cStr_isEqual(i_inst,i_str) (strcmp(NyLPC_cStr_str(i_inst),(i_str))==0) 00088 /** 00089 * NULL terminated文字列が同一か返します。 00090 * 大文字小文字を区別しません。 00091 */ 00092 #define NyLPC_cStr_isEqualIgnoreCase(i_inst,i_str) (NyLPC_stricmp(NyLPC_cStr_str(i_inst),(i_str))==0) 00093 00094 /** 00095 * 文字列を大文字にします。 00096 * 00097 * 00098 */ 00099 void NyLPC_cStr_toUpper(NyLPC_TcStr_t* i_inst); 00100 00101 #ifdef __cplusplus 00102 } 00103 #endif /* __cplusplus */ 00104 00105 #endif /* NYLPC_CSTR_H_ */
Generated on Tue Jul 12 2022 15:46:16 by 1.7.2