16,471
社区成员
发帖
与我相关
我的任务
分享
#ifndef __String_h__
#define __String_h__
#include "XXXXXExport.h"
#include "XXXXXHeader.h"
namespace XXXXXCore
{
class String;
typedef std::list<String> StringList;
typedef StringList::iterator StringListIter;
typedef std::vector<String> StringVector;
typedef StringVector::iterator StringVectorIter;
typedef std::map<String,String> MapString;
typedef MapString::iterator MapStringIter;
class _XXXXXXExport String
{
public:
String(){}
String(std::string str):m_str(str){}
String(char * str):m_str(str){}
String(const char * str):m_str(str){}
String(const String &str):m_str(str.m_str){}
virtual ~String(){}
std::string str()const{ return m_str;}
bool empty()const{ return m_str.empty();}
long size(){ return m_str.size();}
std::string &str_ref(){ return m_str;}
void to_upper(){ boost::algorithm::to_upper(m_str);}
void to_lower(){ boost::algorithm::to_lower(m_str);}
void trim(){ boost::algorithm::trim(m_str);}
bool starts_with(const String &value){ return boost::algorithm::starts_with(m_str,value.m_str);}
bool ends_with(const String &value){ return boost::algorithm::ends_with(m_str,value.m_str);}
bool equals(const String &value){ return boost::algorithm::equals(m_str,value.m_str);}
StringVector split(String &separator);
bool contains(const String &value){ return boost::contains(m_str,value.m_str);}
bool operator==(const String &value)const { return value.m_str == m_str;}
bool operator!=(const String &value)const { return value.m_str != m_str;}
String operator+(const String &value)const { std::string temp = m_str; temp+= value.m_str;return temp;}
String &operator+=(const String &value){ m_str += value.m_str;return *this;}
bool operator<(const String &value)const { return m_str < value.m_str;}
protected:
std::string m_str;
};
static const String BLANK;
}
#endif
#ifndef __XXXXXXExport_h__
#define __XXXXXXExport_h__
#include "XXXXXHeader.h"
#if defined XXXXXCore_EXPORTS
# define _XXXXXCoreExport __declspec( dllexport )
#else
# define _XXXXXXCoreExport __declspec( dllimport )
#endif
class _XXXXXExport boost::noncopyable_::noncopyable;
#endif
#define XXXXCore_EXPORTS
倒是不会报错![/quote]
那看看能不能满足你的要求咯,能满足就行,呵呵#define XXXXCore_EXPORTS
倒是不会报错!