00001 /* -*- C++ -*- */ 00002 /* 00003 * Copyright 2003-2004 The Apache Software Foundation. 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 */ 00018 00019 #if !defined(AXIS_AXISUTILS_H__INCLUDED_) 00020 #define AXIS_AXISUTILS_H__INCLUDED_ 00021 00022 #include <axis/server/GDefine.h> 00023 #include <string> 00024 00025 using namespace std; 00026 00027 #define CONVERT_BUFFER_SIZE 1024 00028 /* 00029 @class AxisUtils 00030 @brief interface for the AxisUtils class. 00031 00032 @author Susantha Kumara (skumara@virtusa.com) 00033 @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk) 00034 */ 00035 class AxisUtils 00036 { 00037 friend class TypeMapping; 00038 friend class URIMapping; 00039 public: 00040 /* 00041 * Converts the given character pointer value to lowercase. 00042 * @param pchWord The character pointer to be converted. 00043 * @return The converted lowercase character value 00044 */ 00045 static char *toLowerCase (const char* pchWord); 00046 /* 00047 * Converts the given string to lowercase. 00048 * @param pchWord The string to be converted. 00049 * @return The converted lowercase string value 00050 */ 00051 static string toLowerCase (const string sWord); 00052 /* 00053 * Converts the given character pointer value to uppercase. 00054 * @param pchWord The character pointer to be converted. 00055 * @return The converted uppercase character value 00056 */ 00057 static char *toUpperCase (const char* pchWord); 00058 /* 00059 * Converts the given string to uppercase. 00060 * @param pchWord The string to be converted. 00061 * @return The converted uppercase string value 00062 */ 00063 static string toUpperCase (const string sWord); 00064 /* 00065 * Searchs for the specified character in the given character array and 00066 * returns whether it is found or not. 00067 * @param pchStringToSearch The character array to be searched. 00068 * @param cCharacter The character to search. 00069 */ 00070 static bool isCharacterAvailable (const char* pchStringToSearch, 00071 const char cCharacter); 00072 /* 00073 * Searchs for the specified character in the given string and returns 00074 * whether it is found or not. 00075 * @param sString The string array to be searched. 00076 * @param cCharacter The character to search. 00077 */ 00078 static bool isCharacterAvailable (const string &sString, 00079 const char cCharacter); 00080 /* 00081 * Clears the content of passed character array 00082 * @param arrCh The character array which is to be cleared. 00083 * @param iSize The size of the array which is to be cleared. 00084 */ 00085 static int clearArray (char* arrCh, int iSize); 00086 static void Initialize (); 00087 static const AxisXMLCh* ToAxisXMLCh (const AxisChar* pch); 00088 AxisUtils (); 00089 virtual ~ AxisUtils (); 00090 /* any usefull static const AxisXMLCh strings. */ 00091 00092 private: 00093 static const AxisXMLCh *Convert (const AxisChar * pch); 00094 static AxisXMLCh m_Buffer[CONVERT_BUFFER_SIZE]; 00095 00096 }; 00097 00098 #endif