⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eb_utils.h

📁 这是法国Kaleido公司提供了一个手机mmi设计平台
💻 H
字号:
/***************************************************************************
EB_Utils.h  - utilities  
-------------------
begin                : Tue Mar 3 2004
copyright            : (C) 2004 by DigitalAirways
email                : info@digitalairways.com
***************************************************************************/

/*
* Copyright (c) 2000-2005 DigitalAirways, sarl. All Rights Reserved.
*
* This software is the confidential and proprietary information of
* DigitalAirways, sarl. ("Confidential Information").  You shall not
* disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into
* with DigitalAirways.
* A copy of this license is included in the licence.txt file included
* in this software package.
*/

/*
**************************************************************
* TODO
**************************************************************

- 



**************************************************************
* HISTORY
**************************************************************

- 

*/

#ifndef __EB_UTILS__
#define __EB_UTILS__

#include "EB_Defs.h"


#ifdef DEV_DEBUG
// To display the infos
#define VERB_LEV_SESSION	0x0001
#define VERB_LEV_DEBUG		0x0002
#define VERB_LEV_USER		0x0004
#define VERB_LEV_MONITOR	0x0008
#define VERB_LEV_ERROR		0x0010
#define VERB_LEV_UDPERR		0x0020

#ifdef  __cplusplus
extern "C" {
#endif
	KREBDEV_API void Verbose( int iCallerType, const char *fmt, ... ) ;
#ifdef DEV_PROFILE
	KREBDEV_API KALEIDO_TIME_TYPE getHighperfTime() ;
#endif
#ifdef  __cplusplus
}
#endif
#endif /* def DEV_DEBUG */


// This macro allows to swap 2 values
#define SWAP(x,y,temp) temp=x;x=y;y=temp

// This macro allows to change the blob owned by a SAFE pointer
#define SAFE_CHANGE_STRING(T,F) SAFE_FREE(T); T=xstrdup(F);

// Array copies
#define arraycopy(A, B, C, D, E) { for(int arraycopyidx=0; arraycopyidx<E; arraycopyidx++) C[D+arraycopyidx] = A[B+arraycopyidx] ; }

#define isSeparator(X) strchr(Statics__SEPARATORS, X)

#define ustrdup(X) ((pchar) xstrdup((char*) X))

KREBDLIBS_API char * istrstr(char* lookin, char* lookfor) ;


// Hext convertions
KREBDLIBS_API int hexaToInt(unsigned char hexa);
KREBDLIBS_API void char2Hext(unsigned char c, unsigned char* toHext);
KREBDLIBS_API unsigned char hext2Char(unsigned char* fromHext);

/*
* May be used when toupper is not available on the target platform.
* In that case, EB_PFDefs.h should define a macro like 
*  #define toupper kaleido_toupper
*/
KREBDLIBS_API int kaleido_toupper( int in);

// Numeric to String conversion
KREBDLIBS_API void i2a(int i, char* work) ;
KREBDLIBS_API int a2i(char* value, char** endptr = NULL) ;

// QueryStrings extractions
KREBDLIBS_API char* getArg(char* queryString, int index, char* bufOut);
KREBDLIBS_API char* getArgValByIndex(char* queryString, int index, char* bufOut);
KREBDLIBS_API char* getArgValByName(char* queryString, char* argName, char* bufOut);
//SmallArrayList* parseQS(char* queryString) ;

/*
* This function is designed to return an unquoted string from a quoted one.
* If the first character is a double-quote, this character is stripped.
* If the last character is a double-quote, it is replaced by a NULL.
* Warning: the returned string is a modified version of the original one.
*/
KREBDLIBS_API char* unquoteString(char* inString);


// QueryStrings building

/*
* This function allows to append a variable to a queryString.
*
* Ex: appendQueryString(qString, "myVar", "myVal") ;
* 
* copies in qString the string: [myVar=myVal]
*
* The returned value is qString. 
*
*
* Warning: ensure that queryString is properly sized.
*/
KREBDLIBS_API char* appendQueryString(char* queryString, char* var, char* val) ;

/*
* This function allows to create a queryString from the definition of a format, a set 
* of variable's names and a set of variable's contents.
*
* Ex: makeQueryString(qString, "ISSS", "arg1", 89, "arg2", "toto=tutu", "arg3", "", "arg4", "good day") ;
* 
* copies in qString the string: [arg1=89&arg2="toto=tutu"&arg3=""&arg4=good day]
*
* The returned value is qString.
*
* The format must contain the following characters:
*  S : string
*  I : integer
*
* If a string contains '=' or '&', it must be included between double quotes.
*
* Warning: ensure that queryString is properly sized.
*/
KREBDLIBS_API char* makeQueryString(char* queryString, char* format, ...) ;



/*
* This function allows to find a string in the table ptrTable of pointers containing recordNum sets of recordLen pointers.
* The keyPos'th pointer of each tested record is considered as a string and its value is compared to foFind.
* If the string is identical, this function returns the index of the first pointer of the concerned record.
* If there is no matching string, NULL is returned.
* VERY IMPORTANT: this function is optimized considering that the keys contained in the table MUST BE SORTED
* using ASCENDANT order.
*/
KREBDLIBS_API int findInStringTable(char** ptrTable, int recordNum, int recordLen, int keyPos, char* toFind);


/*
* This function allows to escape '=','&' ,'\' of a value of a queryString.
* It stops escaping when encoutered a '\0'
*/
KREBDLIBS_API void escapeString(char* inBuffer, char* outBuffer);

/*
* This function allows to remove escape from a value of a queryString.('=','&' ,'\')
* It stops escaping when encoutered an unescape '&' or '\0'
*/
KREBDLIBS_API void unEscapeString(char* inBuffer, char* outBuffer);
		

#endif /* ndef __EB_UTILS__ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -