17f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* 27f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Copyright (C) 2008 The Android Open Source Project 37f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * 47f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License"); 57f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * you may not use this file except in compliance with the License. 67f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * You may obtain a copy of the License at 77f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * 87f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * http://www.apache.org/licenses/LICENSE-2.0 97f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * 107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Unless required by applicable law or agreed to in writing, software 117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS, 127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * See the License for the specific language governing permissions and 147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * limitations under the License. 157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project */ 167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 177f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#ifndef bbs_STRING_EM_H 187f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#define bbs_STRING_EM_H 197f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 207f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** 217f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * This file contains string related functions. 227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project */ 237f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 247f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- includes ----------------------------------------------------------- */ 257f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 267f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include <stdarg.h> 277f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 287f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_BasicEm/Basic.h" 297f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 307f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- related objects --------------------------------------------------- */ 317f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 327f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- typedefs ----------------------------------------------------------- */ 337f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 347f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- constants ---------------------------------------------------------- */ 357f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 367f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- external functions ------------------------------------------------- */ 377f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 387f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** copies a string from srcA to dstA; returns dstA */ 397f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectchar* bbs_strcpy( char* dstA, const char* srcA ); 407f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 417f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** copies sizeA caracters from from srcA to dstA; returns dstA */ 427f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectchar* bbs_strncpy( char* dstA, const char* srcA, uint32 sizeA ); 437f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 447f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** adds a string srcA to string dstA; returns dstA */ 457f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectchar* bbs_strcat( char* dstA, const char* srcA ); 467f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 477f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** adds sizeA characters from srcA to string dstA; returns dstA */ 487f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectchar* bbs_strncat( char* dstA, const char* srcA, uint32 sizeA ); 497f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 507f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** returns number of characters in string excluding terminating 0 */ 517f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bbs_strlen( const char* strA ); 527f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 537f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** returns true if both strings are equal */ 547f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectflag bbs_strequal( const char* str1A, const char* str2A ); 557f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 567f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** returns true if all characters of the smaller of both string are equal with the other string */ 577f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectflag bbs_strmatch( const char* str1A, const char* str2A ); 587f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 597f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** writes a formated string to buffer with size limitation; returns number of characters written 607f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Not all possible format types of stdlib function snprintf are handled in this function 617f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project */ 627f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bbs_snprintf( char* dstA, uint32 bufSizeA, const char* formatA, ... ); 637f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 647f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** writes a formated string to buffer with size limitation; returns number of characters written 657f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Not all possible format types of stdlib function vsnprintf are handled in this function 667f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project */ 677f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bbs_vsnprintf( char* dstA, uint32 bufSizeA, const char* formatA, va_list argsA ); 687f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 697f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** converts a string to an integer */ 707f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectint32 bbs_atoi( const char* strA ); 717f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 727f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#endif /* bbs_STRING_EM_H */ 737f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 74