| 1 |
////////////////////////////////////////////////////////////////////////////// |
| 2 |
////////////////////////////////////////////////////////////////////////////// |
| 3 |
// |
| 4 |
// copyright : (C) 2008 by Eran Ifrah |
| 5 |
// file name : stringaccessor.h |
| 6 |
// |
| 7 |
// ------------------------------------------------------------------------- |
| 8 |
// A |
| 9 |
// _____ _ _ _ _ |
| 10 |
// / __ \ | | | | (_) | |
| 11 |
// | / \/ ___ __| | ___| | _| |_ ___ |
| 12 |
// | | / _ \ / _ |/ _ \ | | | __/ _ ) |
| 13 |
// | \__/\ (_) | (_| | __/ |___| | || __/ |
| 14 |
// \____/\___/ \__,_|\___\_____/_|\__\___| |
| 15 |
// |
| 16 |
// F i l e |
| 17 |
// |
| 18 |
// This program is free software; you can redistribute it and/or modify |
| 19 |
// it under the terms of the GNU General Public License as published by |
| 20 |
// the Free Software Foundation; either version 2 of the License, or |
| 21 |
// (at your option) any later version. |
| 22 |
// |
| 23 |
////////////////////////////////////////////////////////////////////////////// |
| 24 |
////////////////////////////////////////////////////////////////////////////// |
| 25 |
#ifndef __stringaccessor__ |
| 26 |
#define __stringaccessor__ |
| 27 |
|
| 28 |
#include <wx/string.h> |
| 29 |
#include "codelite_exports.h" |
| 30 |
#include <string> |
| 31 |
|
| 32 |
class WXDLLIMPEXP_CL StringAccessor |
| 33 |
{ |
| 34 |
std::wstring m_str; |
| 35 |
|
| 36 |
public: |
| 37 |
StringAccessor(const wxString &str); |
| 38 |
virtual ~StringAccessor(); |
| 39 |
|
| 40 |
size_t length() { |
| 41 |
return m_str.size(); |
| 42 |
} |
| 43 |
char safeAt(size_t pos); |
| 44 |
bool isWordChar(char ch); |
| 45 |
|
| 46 |
void setStr(const wxString& str) { |
| 47 |
this->m_str = str.c_str(); |
| 48 |
} |
| 49 |
wxChar* getStr() const { |
| 50 |
return (wchar_t*)m_str.c_str(); |
| 51 |
} |
| 52 |
bool match(const char *str, size_t from); |
| 53 |
}; |
| 54 |
#endif // __stringaccessor__ |