00001 00002 /* 00003 * 00004 * CmpiString.h 00005 * 00006 * (C) Copyright IBM Corp. 2003 00007 * 00008 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE 00009 * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE 00010 * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. 00011 * 00012 * You can obtain a current copy of the Common Public License from 00013 * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html 00014 * 00015 * Author: Adrian Schuur <schuur@de.ibm.com> 00016 * Contributors: 00017 * 00018 * Description: CMPI string provider wrapper 00019 */ 00020 00021 #ifndef _CmpiString_h_ 00022 #define _CmpiString_h_ 00023 #include "OW_config.h" 00024 00025 #include "cmpidt.h" 00026 #include "cmpift.h" 00027 #include <string.h> 00028 00029 #ifndef CmpiBoolean 00030 #define CmpiBoolean CMPIBoolean 00031 #define CmpiRc CMPIrc 00032 #endif 00033 00037 class CmpiString { /*: public CmpiObject { */ 00038 friend class CmpiBroker; 00039 friend class CmpiData; 00040 friend class CmpiObjectPath; 00041 friend class CmpiInstance; 00042 friend class CmpiObject; 00043 friend class CmpiArgs; 00044 friend class CmpiArrayIdx; 00045 private: 00046 protected: 00047 void *enc; 00050 inline CmpiString(CMPIString* c) { 00051 enc=c; 00052 } 00053 00056 inline CMPIString *getEnc() const 00057 { return (CMPIString*)enc; } 00058 public: 00059 00062 CmpiString() 00063 { enc=NULL; } 00064 00067 CmpiString(const CmpiString& s); 00068 00071 inline const char* charPtr() const 00072 { if (getEnc()) return (const char*)getEnc()->hdl; 00073 else return NULL; } 00074 00077 inline CmpiBoolean equals(const char *str) const 00078 { return (strcmp(charPtr(),str)==0); } 00079 inline CmpiBoolean equals(const CmpiString& str) const 00080 { return (strcmp(charPtr(),str.charPtr())==0); } 00081 00084 inline CmpiBoolean equalsIgnoreCase(const char *str) const 00085 { return (strcasecmp(charPtr(),str)==0); } 00086 inline CmpiBoolean equalsIgnoreCase(const CmpiString& str) const 00087 { return (strcasecmp(charPtr(),str.charPtr())==0); } 00088 }; 00089 00090 #endif 00091 00092